1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4  * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 
6 #ifndef mozilla_codecoveragehandler_h
7 #define mozilla_codecoveragehandler_h
8 
9 #include "mozilla/StaticPtr.h"
10 #include "mozilla/ipc/CrossProcessMutex.h"
11 
12 namespace mozilla {
13 
14 class CodeCoverageHandler {
15  public:
16   static void Init();
17   static void Init(CrossProcessMutexHandle aHandle);
18   static CodeCoverageHandler* Get();
19   CrossProcessMutex* GetMutex();
20   CrossProcessMutexHandle GetMutexHandle();
21   static void FlushCounters(const bool initialized = false);
22   static void FlushCountersSignalHandler(int);
23 
24  private:
25   CodeCoverageHandler();
26   explicit CodeCoverageHandler(CrossProcessMutexHandle aHandle);
27 
28   static StaticAutoPtr<CodeCoverageHandler> instance;
29   CrossProcessMutex mGcovLock;
30 
31   DISALLOW_COPY_AND_ASSIGN(CodeCoverageHandler);
32 
33   void SetSignalHandlers();
34 };
35 
36 }  // namespace mozilla
37 
38 #endif  // mozilla_codecoveragehandler_h
39