| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CHANNEL_PROXY_H_ | 5 #ifndef IPC_IPC_CHANNEL_PROXY_H_ |
| 6 #define IPC_IPC_CHANNEL_PROXY_H_ | 6 #define IPC_IPC_CHANNEL_PROXY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 const IPC::ChannelHandle& channel_handle, | 90 const IPC::ChannelHandle& channel_handle, |
| 91 Channel::Mode mode, | 91 Channel::Mode mode, |
| 92 Listener* listener, | 92 Listener* listener, |
| 93 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner); | 93 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner); |
| 94 | 94 |
| 95 static std::unique_ptr<ChannelProxy> Create( | 95 static std::unique_ptr<ChannelProxy> Create( |
| 96 std::unique_ptr<ChannelFactory> factory, | 96 std::unique_ptr<ChannelFactory> factory, |
| 97 Listener* listener, | 97 Listener* listener, |
| 98 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner); | 98 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner); |
| 99 | 99 |
| 100 // Constructs a ChannelProxy without initializing it. |
| 101 ChannelProxy( |
| 102 Listener* listener, |
| 103 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner); |
| 104 |
| 100 ~ChannelProxy() override; | 105 ~ChannelProxy() override; |
| 101 | 106 |
| 102 // Initializes the channel proxy. Only call this once to initialize a channel | 107 // Initializes the channel proxy. Only call this once to initialize a channel |
| 103 // proxy that was not initialized in its constructor. If create_pipe_now is | 108 // proxy that was not initialized in its constructor. If create_pipe_now is |
| 104 // true, the pipe is created synchronously. Otherwise it's created on the IO | 109 // true, the pipe is created synchronously. Otherwise it's created on the IO |
| 105 // thread. | 110 // thread. |
| 106 void Init(const IPC::ChannelHandle& channel_handle, | 111 void Init(const IPC::ChannelHandle& channel_handle, |
| 107 Channel::Mode mode, | 112 Channel::Mode mode, |
| 108 bool create_pipe_now); | 113 bool create_pipe_now); |
| 109 void Init(std::unique_ptr<ChannelFactory> factory, bool create_pipe_now); | 114 void Init(std::unique_ptr<ChannelFactory> factory, bool create_pipe_now); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 int GetClientFileDescriptor(); | 157 int GetClientFileDescriptor(); |
| 153 base::ScopedFD TakeClientFileDescriptor(); | 158 base::ScopedFD TakeClientFileDescriptor(); |
| 154 #endif | 159 #endif |
| 155 | 160 |
| 156 protected: | 161 protected: |
| 157 class Context; | 162 class Context; |
| 158 // A subclass uses this constructor if it needs to add more information | 163 // A subclass uses this constructor if it needs to add more information |
| 159 // to the internal state. | 164 // to the internal state. |
| 160 ChannelProxy(Context* context); | 165 ChannelProxy(Context* context); |
| 161 | 166 |
| 162 ChannelProxy( | |
| 163 Listener* listener, | |
| 164 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner); | |
| 165 | 167 |
| 166 // Used internally to hold state that is referenced on the IPC thread. | 168 // Used internally to hold state that is referenced on the IPC thread. |
| 167 class Context : public base::RefCountedThreadSafe<Context>, | 169 class Context : public base::RefCountedThreadSafe<Context>, |
| 168 public Listener { | 170 public Listener { |
| 169 public: | 171 public: |
| 170 Context(Listener* listener, | 172 Context(Listener* listener, |
| 171 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_thread); | 173 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_thread); |
| 172 void ClearIPCTaskRunner(); | 174 void ClearIPCTaskRunner(); |
| 173 base::SingleThreadTaskRunner* ipc_task_runner() const { | 175 base::SingleThreadTaskRunner* ipc_task_runner() const { |
| 174 return ipc_task_runner_.get(); | 176 return ipc_task_runner_.get(); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 bool did_init_; | 305 bool did_init_; |
| 304 | 306 |
| 305 #if defined(ENABLE_IPC_FUZZER) | 307 #if defined(ENABLE_IPC_FUZZER) |
| 306 OutgoingMessageFilter* outgoing_message_filter_; | 308 OutgoingMessageFilter* outgoing_message_filter_; |
| 307 #endif | 309 #endif |
| 308 }; | 310 }; |
| 309 | 311 |
| 310 } // namespace IPC | 312 } // namespace IPC |
| 311 | 313 |
| 312 #endif // IPC_IPC_CHANNEL_PROXY_H_ | 314 #endif // IPC_IPC_CHANNEL_PROXY_H_ |
| OLD | NEW |