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/. */
7 #ifndef mozilla_TimelineMarker_h_
8 #define mozilla_TimelineMarker_h_
10 #include "AbstractTimelineMarker.h"
11 #include "js/RootingAPI.h"
15 // Objects of this type can be added to the timeline if there is an interested
16 // consumer. The class can also be subclassed to let a given marker creator
17 // provide custom details.
18 class TimelineMarker
: public AbstractTimelineMarker
{
20 TimelineMarker(const char* aName
, MarkerTracingType aTracingType
,
21 MarkerStackRequest aStackRequest
= MarkerStackRequest::STACK
);
23 TimelineMarker(const char* aName
, const TimeStamp
& aTime
,
24 MarkerTracingType aTracingType
,
25 MarkerStackRequest aStackRequest
= MarkerStackRequest::STACK
);
27 virtual void AddDetails(JSContext
* aCx
,
28 dom::ProfileTimelineMarker
& aMarker
) override
;
29 virtual JSObject
* GetStack() override
;
35 // While normally it is not a good idea to make a persistent root,
36 // in this case changing nsDocShell to participate in cycle
37 // collection was deemed too invasive, and the markers are only held
38 // here temporarily to boot.
39 JS::PersistentRooted
<JSObject
*> mStackTrace
;
41 void CaptureStackIfNecessary(MarkerTracingType aTracingType
,
42 MarkerStackRequest aStackRequest
);
45 } // namespace mozilla
47 #endif /* mozilla_TimelineMarker_h_ */