/src/mozilla-central/gfx/vr/ipc/VRProcessParent.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 | | |
7 | | #ifndef GFX_VR_PROCESS_PARENT_H |
8 | | #define GFX_VR_PROCESS_PARENT_H |
9 | | |
10 | | #include "mozilla/UniquePtr.h" |
11 | | |
12 | | #include "mozilla/ipc/GeckoChildProcessHost.h" |
13 | | #include "mozilla/ipc/TaskFactory.h" |
14 | | |
15 | | namespace mozilla { |
16 | | namespace gfx { |
17 | | |
18 | | class VRChild; |
19 | | |
20 | | class VRProcessParent final : public mozilla::ipc::GeckoChildProcessHost |
21 | | { |
22 | | public: |
23 | | explicit VRProcessParent(); |
24 | | ~VRProcessParent(); |
25 | | |
26 | | bool Launch(); |
27 | | void Shutdown(); |
28 | | void DestroyProcess(); |
29 | 0 | bool CanShutdown() override { return true; } |
30 | | |
31 | | void OnChannelError() override; |
32 | | void OnChannelConnected(int32_t peer_pid) override; |
33 | | void OnChannelConnectedTask(); |
34 | | void OnChannelErrorTask(); |
35 | | void OnChannelClosed(); |
36 | | |
37 | | base::ProcessId OtherPid(); |
38 | 0 | VRChild* GetActor() const { |
39 | 0 | return mVRChild.get(); |
40 | 0 | } |
41 | | |
42 | | private: |
43 | | DISALLOW_COPY_AND_ASSIGN(VRProcessParent); |
44 | | |
45 | | void InitAfterConnect(bool aSucceeded); |
46 | | void KillHard(const char* aReason); |
47 | | |
48 | | UniquePtr<VRChild> mVRChild; |
49 | | mozilla::ipc::TaskFactory<VRProcessParent> mTaskFactory; |
50 | | nsCOMPtr<nsIThread> mLaunchThread; |
51 | | bool mChannelClosed; |
52 | | }; |
53 | | |
54 | | } // namespace gfx |
55 | | } // namespace mozilla |
56 | | |
57 | | #endif // ifndef GFX_VR_PROCESS_PARENT_H |