/src/mozilla-central/mozglue/misc/AutoProfilerLabel.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 2; 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 "mozilla/AutoProfilerLabel.h" |
8 | | |
9 | | namespace mozilla { |
10 | | |
11 | | static ProfilerLabelEnter sEnter = nullptr; |
12 | | static ProfilerLabelExit sExit = nullptr; |
13 | | |
14 | | void |
15 | | RegisterProfilerLabelEnterExit(ProfilerLabelEnter aEnter, |
16 | | ProfilerLabelExit aExit) |
17 | 3 | { |
18 | 3 | sEnter = aEnter; |
19 | 3 | sExit = aExit; |
20 | 3 | } |
21 | | |
22 | | AutoProfilerLabel::AutoProfilerLabel(const char* aLabel, |
23 | | const char* aDynamicString, |
24 | | uint32_t aLine |
25 | | MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL) |
26 | 0 | { |
27 | 0 | MOZ_GUARD_OBJECT_NOTIFIER_INIT; |
28 | 0 |
|
29 | 0 | mProfilingStack = sEnter ? sEnter(aLabel, aDynamicString, this, aLine) : nullptr; |
30 | 0 | } |
31 | | |
32 | | AutoProfilerLabel::~AutoProfilerLabel() |
33 | 0 | { |
34 | 0 | if (sExit && mProfilingStack) { |
35 | 0 | sExit(mProfilingStack); |
36 | 0 | } |
37 | 0 | } |
38 | | |
39 | | } // namespace mozilla |
40 | | |