Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/gfx/vr/ipc/VRProcessManager.h
Line
Count
Source (jump to first uncovered line)
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/. */
6
#ifndef GFX_VR_PROCESS_MANAGER_H
7
#define GFX_VR_PROCESS_MANAGER_H
8
9
10
namespace mozilla {
11
namespace gfx {
12
13
class VRProcessParent;
14
class VRManagerChild;
15
class PVRGPUChild;
16
class VRChild;
17
18
// The VRProcessManager is a singleton responsible for creating VR-bound
19
// objects that may live in another process.
20
class VRProcessManager final
21
{
22
public:
23
  static VRProcessManager* Get();
24
  static void Initialize();
25
  static void Shutdown();
26
27
  ~VRProcessManager();
28
29
  // If not using a VR process, launch a new VR process asynchronously.
30
  void LaunchVRProcess();
31
  void DestroyProcess();
32
33
  bool CreateGPUBridges(base::ProcessId aOtherProcess,
34
                        mozilla::ipc::Endpoint<PVRGPUChild>* aOutVRBridge);
35
36
  VRChild* GetVRChild();
37
38
private:
39
  VRProcessManager();
40
41
  DISALLOW_COPY_AND_ASSIGN(VRProcessManager);
42
43
  bool CreateGPUVRManager(base::ProcessId aOtherProcess,
44
                              mozilla::ipc::Endpoint<PVRGPUChild>* aOutEndpoint);
45
  void OnXPCOMShutdown();
46
  void CleanShutdown();
47
48
  // Permanently disable the VR process and record a message why.
49
  void DisableVRProcess(const char* aMessage);
50
51
  class Observer final : public nsIObserver {
52
  public:
53
    NS_DECL_ISUPPORTS
54
    NS_DECL_NSIOBSERVER
55
    explicit Observer(VRProcessManager* aManager);
56
57
  protected:
58
0
    ~Observer() {}
59
60
    VRProcessManager* mManager;
61
  };
62
  friend class Observer;
63
64
  RefPtr<Observer> mObserver;
65
  VRProcessParent* mProcess;
66
};
67
68
} // namespace gfx
69
} // namespace mozilla
70
71
#endif // GFX_VR_PROCESS_MANAGER_H