/src/mozilla-central/docshell/base/timeline/AutoGlobalTimelineMarker.cpp
Line | Count | Source (jump to first uncovered line) |
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 | | #include "AutoGlobalTimelineMarker.h" |
8 | | |
9 | | #include "TimelineConsumers.h" |
10 | | #include "MainThreadUtils.h" |
11 | | |
12 | | namespace mozilla { |
13 | | |
14 | | AutoGlobalTimelineMarker::AutoGlobalTimelineMarker(const char* aName, |
15 | | MarkerStackRequest aStackRequest /* = STACK */ |
16 | | MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL) |
17 | | : mName(aName) |
18 | | , mStackRequest(aStackRequest) |
19 | 0 | { |
20 | 0 | MOZ_GUARD_OBJECT_NOTIFIER_INIT; |
21 | 0 | MOZ_ASSERT(NS_IsMainThread()); |
22 | 0 |
|
23 | 0 | RefPtr<TimelineConsumers> timelines = TimelineConsumers::Get(); |
24 | 0 | if (!timelines || timelines->IsEmpty()) { |
25 | 0 | return; |
26 | 0 | } |
27 | 0 | |
28 | 0 | timelines->AddMarkerForAllObservedDocShells(mName, MarkerTracingType::START, mStackRequest); |
29 | 0 | } |
30 | | |
31 | | AutoGlobalTimelineMarker::~AutoGlobalTimelineMarker() |
32 | 0 | { |
33 | 0 | MOZ_ASSERT(NS_IsMainThread()); |
34 | 0 |
|
35 | 0 | RefPtr<TimelineConsumers> timelines = TimelineConsumers::Get(); |
36 | 0 | if (!timelines || timelines->IsEmpty()) { |
37 | 0 | return; |
38 | 0 | } |
39 | 0 | |
40 | 0 | timelines->AddMarkerForAllObservedDocShells(mName, MarkerTracingType::END, mStackRequest); |
41 | 0 | } |
42 | | |
43 | | } // namespace mozilla |