Bug 1517921 [wpt PR 14728] - [manifest] Make sure deleted tests are removed from...
[gecko.git] / docshell / base / timeline / TimelineMarker.h
blobb7c5a83ce9e0567689d82017c29410da19b3d4de
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"
13 namespace mozilla {
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 {
19 public:
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;
31 protected:
32 void CaptureStack();
34 private:
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_ */