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/memory/ref_counted.h" |
13 #include "base/process/process_handle.h" | 14 #include "base/process/process_handle.h" |
| 15 #include "base/single_thread_task_runner.h" |
14 #include "build/build_config.h" | 16 #include "build/build_config.h" |
15 #include "ipc/ipc.mojom.h" | 17 #include "ipc/ipc.mojom.h" |
16 #include "ipc/ipc_channel.h" | 18 #include "ipc/ipc_channel.h" |
17 #include "ipc/ipc_listener.h" | 19 #include "ipc/ipc_listener.h" |
18 #include "mojo/public/cpp/bindings/associated_group.h" | 20 #include "mojo/public/cpp/bindings/associated_group.h" |
19 #include "mojo/public/cpp/system/message_pipe.h" | 21 #include "mojo/public/cpp/system/message_pipe.h" |
20 | 22 |
21 namespace IPC { | 23 namespace IPC { |
22 | 24 |
23 // MojoBootstrap establishes a pair of associated interfaces between two | 25 // MojoBootstrap establishes a pair of associated interfaces between two |
(...skipping 23 matching lines...) Expand all Loading... |
47 Delegate* delegate); | 49 Delegate* delegate); |
48 | 50 |
49 MojoBootstrap(); | 51 MojoBootstrap(); |
50 virtual ~MojoBootstrap(); | 52 virtual ~MojoBootstrap(); |
51 | 53 |
52 // Start the handshake over the underlying message pipe. | 54 // Start the handshake over the underlying message pipe. |
53 virtual void Connect() = 0; | 55 virtual void Connect() = 0; |
54 | 56 |
55 virtual mojo::AssociatedGroup* GetAssociatedGroup() = 0; | 57 virtual mojo::AssociatedGroup* GetAssociatedGroup() = 0; |
56 | 58 |
| 59 virtual void SetProxyTaskRunner( |
| 60 scoped_refptr<base::SingleThreadTaskRunner> task_runner) = 0; |
| 61 |
57 // GetSelfPID returns our PID. | 62 // GetSelfPID returns our PID. |
58 base::ProcessId GetSelfPID() const; | 63 base::ProcessId GetSelfPID() const; |
59 | 64 |
60 protected: | 65 protected: |
61 // On MojoServerBootstrap: INITIALIZED -> WAITING_ACK -> READY | 66 // On MojoServerBootstrap: INITIALIZED -> WAITING_ACK -> READY |
62 // On MojoClientBootstrap: INITIALIZED -> READY | 67 // On MojoClientBootstrap: INITIALIZED -> READY |
63 // STATE_ERROR is a catch-all state that captures any observed error. | 68 // STATE_ERROR is a catch-all state that captures any observed error. |
64 enum State { STATE_INITIALIZED, STATE_WAITING_ACK, STATE_READY, STATE_ERROR }; | 69 enum State { STATE_INITIALIZED, STATE_WAITING_ACK, STATE_READY, STATE_ERROR }; |
65 | 70 |
66 Delegate* delegate() const { return delegate_; } | 71 Delegate* delegate() const { return delegate_; } |
(...skipping 11 matching lines...) Expand all Loading... |
78 mojo::ScopedMessagePipeHandle handle_; | 83 mojo::ScopedMessagePipeHandle handle_; |
79 Delegate* delegate_; | 84 Delegate* delegate_; |
80 State state_; | 85 State state_; |
81 | 86 |
82 DISALLOW_COPY_AND_ASSIGN(MojoBootstrap); | 87 DISALLOW_COPY_AND_ASSIGN(MojoBootstrap); |
83 }; | 88 }; |
84 | 89 |
85 } // namespace IPC | 90 } // namespace IPC |
86 | 91 |
87 #endif // IPC_IPC_MOJO_BOOTSTRAP_H_ | 92 #endif // IPC_IPC_MOJO_BOOTSTRAP_H_ |
OLD | NEW |