/src/mozilla-central/toolkit/crashreporter/ThreadAnnotation.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
2 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | | |
5 | | #ifndef ThreadAnnotation_h |
6 | | #define ThreadAnnotation_h |
7 | | |
8 | | #include <functional> |
9 | | |
10 | | #include "nsExceptionHandler.h" |
11 | | |
12 | | // Thread annotation interfaces for the crash reporter. |
13 | | namespace CrashReporter { |
14 | | |
15 | | void InitThreadAnnotation(); |
16 | | |
17 | | void ShutdownThreadAnnotation(); |
18 | | |
19 | | void GetFlatThreadAnnotation(const std::function<void(const char*)>& aCallback, |
20 | | bool aIsHandlingException=false); |
21 | | |
22 | | class InitThreadAnnotationRAII { |
23 | | public: |
24 | | InitThreadAnnotationRAII() |
25 | 0 | { |
26 | 0 | if (GetEnabled()) { |
27 | 0 | InitThreadAnnotation(); |
28 | 0 | } |
29 | 0 | } |
30 | | |
31 | 0 | ~InitThreadAnnotationRAII() { |
32 | 0 | if (GetEnabled()) { |
33 | 0 | ShutdownThreadAnnotation(); |
34 | 0 | } |
35 | 0 | } |
36 | | }; |
37 | | |
38 | | } |
39 | | |
40 | | #endif |