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_CHANNEL_MOJO_H_ | 5 #ifndef IPC_IPC_CHANNEL_MOJO_H_ |
6 #define IPC_IPC_CHANNEL_MOJO_H_ | 6 #define IPC_IPC_CHANNEL_MOJO_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 void OnPipeClosed(internal::MessagePipeReader* reader); | 98 void OnPipeClosed(internal::MessagePipeReader* reader); |
99 void OnPipeError(internal::MessagePipeReader* reader); | 99 void OnPipeError(internal::MessagePipeReader* reader); |
100 void set_peer_pid(base::ProcessId pid) { peer_pid_ = pid; } | 100 void set_peer_pid(base::ProcessId pid) { peer_pid_ = pid; } |
101 | 101 |
102 protected: | 102 protected: |
103 ChannelMojo(const ChannelHandle& channel_handle, | 103 ChannelMojo(const ChannelHandle& channel_handle, |
104 Mode mode, | 104 Mode mode, |
105 Listener* listener, | 105 Listener* listener, |
106 scoped_refptr<base::TaskRunner> io_thread_task_runner); | 106 scoped_refptr<base::TaskRunner> io_thread_task_runner); |
107 | 107 |
| 108 // Be virtual for testing. |
| 109 virtual scoped_ptr<internal::MessageReader> CreateMessageReader( |
| 110 mojo::ScopedMessagePipeHandle pipe); |
| 111 |
108 private: | 112 private: |
109 struct ChannelInfoDeleter { | 113 struct ChannelInfoDeleter { |
110 void operator()(mojo::embedder::ChannelInfo* ptr) const; | 114 void operator()(mojo::embedder::ChannelInfo* ptr) const; |
111 }; | 115 }; |
112 | 116 |
113 // ChannelMojo needs to kill its MessagePipeReader in delayed manner | 117 // ChannelMojo needs to kill its MessagePipeReader in delayed manner |
114 // because the channel wants to kill these readers during the | 118 // because the channel wants to kill these readers during the |
115 // notifications invoked by them. | 119 // notifications invoked by them. |
116 typedef internal::MessagePipeReader::DelayedDeleter ReaderDeleter; | 120 typedef internal::MessagePipeReader::DelayedDeleter ReaderDeleter; |
117 | 121 |
(...skipping 11 matching lines...) Expand all Loading... |
129 ScopedVector<Message> pending_messages_; | 133 ScopedVector<Message> pending_messages_; |
130 | 134 |
131 base::WeakPtrFactory<ChannelMojo> weak_factory_; | 135 base::WeakPtrFactory<ChannelMojo> weak_factory_; |
132 | 136 |
133 DISALLOW_COPY_AND_ASSIGN(ChannelMojo); | 137 DISALLOW_COPY_AND_ASSIGN(ChannelMojo); |
134 }; | 138 }; |
135 | 139 |
136 } // namespace IPC | 140 } // namespace IPC |
137 | 141 |
138 #endif // IPC_IPC_CHANNEL_MOJO_H_ | 142 #endif // IPC_IPC_CHANNEL_MOJO_H_ |
OLD | NEW |