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