Bug 1743256 [wpt PR 31764] - Implement contain-intrinsic-size: auto, a=testonly
[gecko.git] / ipc / glue / CrashReporterClient.h
blobb771dcb7a20049a2c877749085ceeac9bd33b873
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"
16 namespace mozilla {
17 namespace ipc {
19 class CrashReporterClient {
20 public:
21 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CrashReporterClient);
23 // |aTopLevelProtocol| must have a child-to-parent message:
25 // async InitCrashReporter(NativeThreadId threadId);
26 template <typename T>
27 static void InitSingleton(T* aToplevelProtocol) {
28 InitSingleton();
29 Unused << aToplevelProtocol->SendInitCrashReporter(
30 CrashReporter::CurrentThreadId());
33 static void InitSingleton();
35 static void DestroySingleton();
36 static RefPtr<CrashReporterClient> GetSingleton();
38 private:
39 explicit CrashReporterClient();
40 ~CrashReporterClient();
42 private:
43 static StaticMutex sLock;
44 static StaticRefPtr<CrashReporterClient> sClientSingleton;
47 } // namespace ipc
48 } // namespace mozilla
50 #endif // mozilla_ipc_CrashReporterClient_h