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_ipc_CrashReporterClient_h
8 #define mozilla_ipc_CrashReporterClient_h
10 #include "mozilla/Assertions.h"
11 #include "mozilla/StaticMutex.h"
12 #include "mozilla/StaticPtr.h"
13 #include "mozilla/Unused.h"
14 #include "nsExceptionHandler.h"
19 class CrashReporterClient
{
21 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CrashReporterClient
);
23 // |aTopLevelProtocol| must have a child-to-parent message:
25 // async InitCrashReporter(NativeThreadId threadId);
27 static void InitSingleton(T
* aToplevelProtocol
) {
29 Unused
<< aToplevelProtocol
->SendInitCrashReporter(
30 CrashReporter::CurrentThreadId());
33 static void InitSingleton();
35 static void DestroySingleton();
36 static RefPtr
<CrashReporterClient
> GetSingleton();
39 explicit CrashReporterClient();
40 ~CrashReporterClient();
43 static StaticMutex sLock
;
44 static StaticRefPtr
<CrashReporterClient
> sClientSingleton
45 MOZ_GUARDED_BY(sLock
);
49 } // namespace mozilla
51 #endif // mozilla_ipc_CrashReporterClient_h