Bug 1517921 [wpt PR 14728] - [manifest] Make sure deleted tests are removed from...
[gecko.git] / docshell / base / timeline / DocLoadingTimelineMarker.h
blob8f6a7db78081f28d1f9aae213d0830c89a4aba3a
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_DocLoadingTimelineMarker_h_
8 #define mozilla_DocLoadingTimelineMarker_h_
10 #include "TimelineMarker.h"
11 #include "mozilla/dom/ProfileTimelineMarkerBinding.h"
13 namespace mozilla {
15 class DocLoadingTimelineMarker : public TimelineMarker {
16 public:
17 explicit DocLoadingTimelineMarker(const char* aName)
18 : TimelineMarker(aName, MarkerTracingType::TIMESTAMP),
19 mUnixTime(PR_Now()) {}
21 virtual void AddDetails(JSContext* aCx,
22 dom::ProfileTimelineMarker& aMarker) override {
23 TimelineMarker::AddDetails(aCx, aMarker);
24 aMarker.mUnixTime.Construct(mUnixTime);
27 private:
28 // Certain consumers might use Date.now() or similar for tracing time.
29 // However, TimelineMarkers use process creation as an epoch, which provides
30 // more precision. To allow syncing, attach an additional unix timestamp.
31 // Using this instead of `AbstractTimelineMarker::GetTime()'s` timestamp
32 // is strongly discouraged.
33 PRTime mUnixTime;
36 } // namespace mozilla
38 #endif // mozilla_DocLoadingTimelineMarker_h_