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_MessagePortTimelineMarker_h_
8 : #define mozilla_MessagePortTimelineMarker_h_
9 :
10 : #include "TimelineMarker.h"
11 : #include "mozilla/dom/ProfileTimelineMarkerBinding.h"
12 :
13 : namespace mozilla {
14 :
15 0 : class MessagePortTimelineMarker : public TimelineMarker
16 : {
17 : public:
18 0 : MessagePortTimelineMarker(dom::ProfileTimelineMessagePortOperationType aOperationType,
19 : MarkerTracingType aTracingType)
20 0 : : TimelineMarker("MessagePort", aTracingType, MarkerStackRequest::NO_STACK)
21 0 : , mOperationType(aOperationType)
22 0 : {}
23 :
24 0 : virtual UniquePtr<AbstractTimelineMarker> Clone() override
25 : {
26 : MessagePortTimelineMarker* clone =
27 0 : new MessagePortTimelineMarker(mOperationType, GetTracingType());
28 0 : clone->SetCustomTime(GetTime());
29 0 : return UniquePtr<AbstractTimelineMarker>(clone);
30 : }
31 :
32 0 : virtual void AddDetails(JSContext* aCx, dom::ProfileTimelineMarker& aMarker) override
33 : {
34 0 : TimelineMarker::AddDetails(aCx, aMarker);
35 :
36 0 : if (GetTracingType() == MarkerTracingType::START) {
37 0 : aMarker.mMessagePortOperation.Construct(mOperationType);
38 : }
39 0 : }
40 :
41 : private:
42 : dom::ProfileTimelineMessagePortOperationType mOperationType;
43 : };
44 :
45 : } // namespace mozilla
46 :
47 : #endif /* mozilla_MessagePortTimelineMarker_h_ */
|