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_AbstractTimelineMarker_h_
8 : #define mozilla_AbstractTimelineMarker_h_
9 :
10 : #include "TimelineMarkerEnums.h" // for MarkerTracingType
11 : #include "nsDOMNavigationTiming.h" // for DOMHighResTimeStamp
12 : #include "nsXULAppAPI.h" // for GeckoProcessType
13 : #include "mozilla/UniquePtr.h"
14 :
15 : struct JSContext;
16 : class JSObject;
17 :
18 : namespace mozilla {
19 : class TimeStamp;
20 :
21 : namespace dom {
22 : struct ProfileTimelineMarker;
23 : }
24 :
25 : class AbstractTimelineMarker
26 : {
27 : private:
28 : AbstractTimelineMarker() = delete;
29 : AbstractTimelineMarker(const AbstractTimelineMarker& aOther) = delete;
30 : void operator=(const AbstractTimelineMarker& aOther) = delete;
31 :
32 : public:
33 : AbstractTimelineMarker(const char* aName,
34 : MarkerTracingType aTracingType);
35 :
36 : AbstractTimelineMarker(const char* aName,
37 : const TimeStamp& aTime,
38 : MarkerTracingType aTracingType);
39 :
40 : virtual ~AbstractTimelineMarker();
41 :
42 : virtual UniquePtr<AbstractTimelineMarker> Clone();
43 : virtual bool Equals(const AbstractTimelineMarker& aOther);
44 :
45 : virtual void AddDetails(JSContext* aCx, dom::ProfileTimelineMarker& aMarker) = 0;
46 : virtual JSObject* GetStack() = 0;
47 :
48 0 : const char* GetName() const { return mName; }
49 0 : DOMHighResTimeStamp GetTime() const { return mTime; }
50 0 : MarkerTracingType GetTracingType() const { return mTracingType; }
51 :
52 0 : uint8_t GetProcessType() const { return mProcessType; };
53 0 : bool IsOffMainThread() const { return mIsOffMainThread; };
54 :
55 : private:
56 : const char* mName;
57 : DOMHighResTimeStamp mTime;
58 : MarkerTracingType mTracingType;
59 :
60 : uint8_t mProcessType; // @see `enum GeckoProcessType`.
61 : bool mIsOffMainThread;
62 :
63 : protected:
64 : void SetCurrentTime();
65 : void SetCustomTime(const TimeStamp& aTime);
66 : void SetCustomTime(DOMHighResTimeStamp aTime);
67 : void SetProcessType(GeckoProcessType aProcessType);
68 : void SetOffMainThread(bool aIsOffMainThread);
69 : };
70 :
71 : } // namespace mozilla
72 :
73 : #endif /* mozilla_AbstractTimelineMarker_h_ */
|