Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef mozilla_WorkerTimelineMarker_h_
8 : #define mozilla_WorkerTimelineMarker_h_
9 :
10 : #include "TimelineMarker.h"
11 : #include "mozilla/dom/ProfileTimelineMarkerBinding.h"
12 :
13 : namespace mozilla {
14 :
15 0 : class WorkerTimelineMarker : public TimelineMarker
16 : {
17 : public:
18 0 : WorkerTimelineMarker(dom::ProfileTimelineWorkerOperationType aOperationType,
19 : MarkerTracingType aTracingType)
20 0 : : TimelineMarker("Worker", aTracingType, MarkerStackRequest::NO_STACK)
21 0 : , mOperationType(aOperationType)
22 0 : {}
23 :
24 0 : virtual UniquePtr<AbstractTimelineMarker> Clone() override
25 : {
26 0 : WorkerTimelineMarker* clone = new WorkerTimelineMarker(mOperationType, GetTracingType());
27 0 : clone->SetCustomTime(GetTime());
28 0 : return UniquePtr<AbstractTimelineMarker>(clone);
29 : }
30 :
31 0 : virtual void AddDetails(JSContext* aCx, dom::ProfileTimelineMarker& aMarker) override
32 : {
33 0 : TimelineMarker::AddDetails(aCx, aMarker);
34 :
35 0 : if (GetTracingType() == MarkerTracingType::START) {
36 0 : aMarker.mWorkerOperation.Construct(mOperationType);
37 : }
38 0 : }
39 :
40 : private:
41 : dom::ProfileTimelineWorkerOperationType mOperationType;
42 : };
43 :
44 : } // namespace mozilla
45 :
46 : #endif /* mozilla_WorkerTimelineMarker_h_ */
|