Line data Source code
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 :
21 : class InitThreadAnnotationRAII {
22 : public:
23 2 : InitThreadAnnotationRAII()
24 : {
25 2 : if (GetEnabled()) {
26 0 : InitThreadAnnotation();
27 : }
28 2 : }
29 :
30 0 : ~InitThreadAnnotationRAII() {
31 0 : if (GetEnabled()) {
32 0 : ShutdownThreadAnnotation();
33 : }
34 0 : }
35 : };
36 :
37 : }
38 :
39 : #endif
|