OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_ARC_ARC_BRIDGE_BOOTSTRAP_H_ | 5 #ifndef COMPONENTS_ARC_ARC_BRIDGE_BOOTSTRAP_H_ |
6 #define COMPONENTS_ARC_ARC_BRIDGE_BOOTSTRAP_H_ | 6 #define COMPONENTS_ARC_ARC_BRIDGE_BOOTSTRAP_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/process/process_handle.h" |
10 #include "base/sequenced_task_runner.h" | 11 #include "base/sequenced_task_runner.h" |
11 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
12 #include "components/arc/common/arc_bridge.mojom.h" | 13 #include "components/arc/common/arc_bridge.mojom.h" |
13 | 14 |
14 namespace arc { | 15 namespace arc { |
15 | 16 |
| 17 // Child process may be created in the different namespace, thus we don't have |
| 18 // its real PID. Since Mojo in POSIX only uses the value as identifier for the |
| 19 // routing table, we can give it fake value as long as it is unique. |
| 20 // Chrome OS uses default pid_max of 32k, so we can safely shift the pid range |
| 21 // by kPidBase and don't conflict with legitimate process. |
| 22 base::ProcessHandle RemapChildPid(uint32_t pid); |
| 23 |
16 // Starts the ARC instance and bootstraps the bridge connection. | 24 // Starts the ARC instance and bootstraps the bridge connection. |
17 // Clients should implement the Delegate to be notified upon communications | 25 // Clients should implement the Delegate to be notified upon communications |
18 // being available. | 26 // being available. |
19 class ArcBridgeBootstrap { | 27 class ArcBridgeBootstrap { |
20 public: | 28 public: |
21 class Delegate { | 29 class Delegate { |
22 public: | 30 public: |
23 virtual void OnConnectionEstablished(ArcBridgeInstancePtr instance_ptr) = 0; | 31 virtual void OnConnectionEstablished(ArcBridgeInstancePtr instance_ptr) = 0; |
24 virtual void OnStopped() = 0; | 32 virtual void OnStopped() = 0; |
25 }; | 33 }; |
(...skipping 20 matching lines...) Expand all Loading... |
46 // Owned by the caller. | 54 // Owned by the caller. |
47 Delegate* delegate_ = nullptr; | 55 Delegate* delegate_ = nullptr; |
48 | 56 |
49 private: | 57 private: |
50 DISALLOW_COPY_AND_ASSIGN(ArcBridgeBootstrap); | 58 DISALLOW_COPY_AND_ASSIGN(ArcBridgeBootstrap); |
51 }; | 59 }; |
52 | 60 |
53 } // namespace arc | 61 } // namespace arc |
54 | 62 |
55 #endif // COMPONENTS_ARC_ARC_BRIDGE_BOOTSTRAP_H_ | 63 #endif // COMPONENTS_ARC_ARC_BRIDGE_BOOTSTRAP_H_ |
OLD | NEW |