OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 IPC_IPC_MOJO_BOOTSTRAP_H_ | 5 #ifndef IPC_IPC_MOJO_BOOTSTRAP_H_ |
6 #define IPC_IPC_MOJO_BOOTSTRAP_H_ | 6 #define IPC_IPC_MOJO_BOOTSTRAP_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/process/process_handle.h" | 13 #include "base/process/process_handle.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "ipc/ipc.mojom.h" | 15 #include "ipc/ipc.mojom.h" |
16 #include "ipc/ipc_channel.h" | 16 #include "ipc/ipc_channel.h" |
17 #include "ipc/ipc_listener.h" | 17 #include "ipc/ipc_listener.h" |
| 18 #include "mojo/public/cpp/bindings/associated_group.h" |
18 #include "mojo/public/cpp/system/message_pipe.h" | 19 #include "mojo/public/cpp/system/message_pipe.h" |
19 | 20 |
20 namespace IPC { | 21 namespace IPC { |
21 | 22 |
22 // MojoBootstrap establishes a pair of associated interfaces between two | 23 // MojoBootstrap establishes a pair of associated interfaces between two |
23 // processes in Chrome. | 24 // processes in Chrome. |
24 // | 25 // |
25 // Clients should implement MojoBootstrap::Delegate to get the associated pipes | 26 // Clients should implement MojoBootstrap::Delegate to get the associated pipes |
26 // from MojoBootstrap object. | 27 // from MojoBootstrap object. |
27 // | 28 // |
(...skipping 16 matching lines...) Expand all Loading... |
44 mojo::ScopedMessagePipeHandle handle, | 45 mojo::ScopedMessagePipeHandle handle, |
45 Channel::Mode mode, | 46 Channel::Mode mode, |
46 Delegate* delegate); | 47 Delegate* delegate); |
47 | 48 |
48 MojoBootstrap(); | 49 MojoBootstrap(); |
49 virtual ~MojoBootstrap(); | 50 virtual ~MojoBootstrap(); |
50 | 51 |
51 // Start the handshake over the underlying message pipe. | 52 // Start the handshake over the underlying message pipe. |
52 virtual void Connect() = 0; | 53 virtual void Connect() = 0; |
53 | 54 |
| 55 virtual mojo::AssociatedGroup* GetAssociatedGroup() = 0; |
| 56 |
54 // GetSelfPID returns our PID. | 57 // GetSelfPID returns our PID. |
55 base::ProcessId GetSelfPID() const; | 58 base::ProcessId GetSelfPID() const; |
56 | 59 |
57 protected: | 60 protected: |
58 // On MojoServerBootstrap: INITIALIZED -> WAITING_ACK -> READY | 61 // On MojoServerBootstrap: INITIALIZED -> WAITING_ACK -> READY |
59 // On MojoClientBootstrap: INITIALIZED -> READY | 62 // On MojoClientBootstrap: INITIALIZED -> READY |
60 // STATE_ERROR is a catch-all state that captures any observed error. | 63 // STATE_ERROR is a catch-all state that captures any observed error. |
61 enum State { STATE_INITIALIZED, STATE_WAITING_ACK, STATE_READY, STATE_ERROR }; | 64 enum State { STATE_INITIALIZED, STATE_WAITING_ACK, STATE_READY, STATE_ERROR }; |
62 | 65 |
63 Delegate* delegate() const { return delegate_; } | 66 Delegate* delegate() const { return delegate_; } |
(...skipping 11 matching lines...) Expand all Loading... |
75 mojo::ScopedMessagePipeHandle handle_; | 78 mojo::ScopedMessagePipeHandle handle_; |
76 Delegate* delegate_; | 79 Delegate* delegate_; |
77 State state_; | 80 State state_; |
78 | 81 |
79 DISALLOW_COPY_AND_ASSIGN(MojoBootstrap); | 82 DISALLOW_COPY_AND_ASSIGN(MojoBootstrap); |
80 }; | 83 }; |
81 | 84 |
82 } // namespace IPC | 85 } // namespace IPC |
83 | 86 |
84 #endif // IPC_IPC_MOJO_BOOTSTRAP_H_ | 87 #endif // IPC_IPC_MOJO_BOOTSTRAP_H_ |
OLD | NEW |