OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 MOJO_EDK_SYSTEM_CHANNEL_H_ | 5 #ifndef MOJO_EDK_SYSTEM_CHANNEL_H_ |
6 #define MOJO_EDK_SYSTEM_CHANNEL_H_ | 6 #define MOJO_EDK_SYSTEM_CHANNEL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <unordered_map> | 11 #include <unordered_map> |
12 | 12 |
13 #include "mojo/edk/embedder/scoped_platform_handle.h" | 13 #include "mojo/edk/platform/scoped_platform_handle.h" |
14 #include "mojo/edk/system/channel_endpoint.h" | 14 #include "mojo/edk/system/channel_endpoint.h" |
15 #include "mojo/edk/system/channel_endpoint_id.h" | 15 #include "mojo/edk/system/channel_endpoint_id.h" |
16 #include "mojo/edk/system/incoming_endpoint.h" | 16 #include "mojo/edk/system/incoming_endpoint.h" |
17 #include "mojo/edk/system/message_in_transit.h" | 17 #include "mojo/edk/system/message_in_transit.h" |
18 #include "mojo/edk/system/raw_channel.h" | 18 #include "mojo/edk/system/raw_channel.h" |
19 #include "mojo/edk/util/mutex.h" | 19 #include "mojo/edk/util/mutex.h" |
20 #include "mojo/edk/util/ref_counted.h" | 20 #include "mojo/edk/util/ref_counted.h" |
21 #include "mojo/edk/util/ref_ptr.h" | 21 #include "mojo/edk/util/ref_ptr.h" |
22 #include "mojo/edk/util/thread_annotations.h" | 22 #include "mojo/edk/util/thread_annotations.h" |
23 #include "mojo/edk/util/thread_checker.h" | 23 #include "mojo/edk/util/thread_checker.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 ~Channel() override; | 184 ~Channel() override; |
185 | 185 |
186 // Helper for |DetachEndpoint()| (returns true if a "remove" should be sent). | 186 // Helper for |DetachEndpoint()| (returns true if a "remove" should be sent). |
187 bool DetachEndpointInternal(ChannelEndpoint* endpoint, | 187 bool DetachEndpointInternal(ChannelEndpoint* endpoint, |
188 ChannelEndpointId local_id, | 188 ChannelEndpointId local_id, |
189 ChannelEndpointId remote_id); | 189 ChannelEndpointId remote_id); |
190 | 190 |
191 // |RawChannel::Delegate| implementation (only called on the creation thread): | 191 // |RawChannel::Delegate| implementation (only called on the creation thread): |
192 void OnReadMessage( | 192 void OnReadMessage( |
193 const MessageInTransit::View& message_view, | 193 const MessageInTransit::View& message_view, |
194 std::unique_ptr<std::vector<embedder::ScopedPlatformHandle>> | 194 std::unique_ptr<std::vector<platform::ScopedPlatformHandle>> |
195 platform_handles) override; | 195 platform_handles) override; |
196 void OnError(Error error) override; | 196 void OnError(Error error) override; |
197 | 197 |
198 // Helpers for |OnReadMessage| (only called on the creation thread): | 198 // Helpers for |OnReadMessage| (only called on the creation thread): |
199 void OnReadMessageForEndpoint( | 199 void OnReadMessageForEndpoint( |
200 const MessageInTransit::View& message_view, | 200 const MessageInTransit::View& message_view, |
201 std::unique_ptr<std::vector<embedder::ScopedPlatformHandle>> | 201 std::unique_ptr<std::vector<platform::ScopedPlatformHandle>> |
202 platform_handles); | 202 platform_handles); |
203 void OnReadMessageForChannel( | 203 void OnReadMessageForChannel( |
204 const MessageInTransit::View& message_view, | 204 const MessageInTransit::View& message_view, |
205 std::unique_ptr<std::vector<embedder::ScopedPlatformHandle>> | 205 std::unique_ptr<std::vector<platform::ScopedPlatformHandle>> |
206 platform_handles); | 206 platform_handles); |
207 | 207 |
208 // Handles "attach and run endpoint" messages. | 208 // Handles "attach and run endpoint" messages. |
209 bool OnAttachAndRunEndpoint(ChannelEndpointId local_id, | 209 bool OnAttachAndRunEndpoint(ChannelEndpointId local_id, |
210 ChannelEndpointId remote_id); | 210 ChannelEndpointId remote_id); |
211 // Handles "remove endpoint" messages. | 211 // Handles "remove endpoint" messages. |
212 bool OnRemoveEndpoint(ChannelEndpointId local_id, | 212 bool OnRemoveEndpoint(ChannelEndpointId local_id, |
213 ChannelEndpointId remote_id); | 213 ChannelEndpointId remote_id); |
214 // Handles "remove endpoint ack" messages. | 214 // Handles "remove endpoint ack" messages. |
215 bool OnRemoveEndpointAck(ChannelEndpointId local_id); | 215 bool OnRemoveEndpointAck(ChannelEndpointId local_id); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 // if/when we wrap). | 281 // if/when we wrap). |
282 RemoteChannelEndpointIdGenerator remote_id_generator_ MOJO_GUARDED_BY(mutex_); | 282 RemoteChannelEndpointIdGenerator remote_id_generator_ MOJO_GUARDED_BY(mutex_); |
283 | 283 |
284 MOJO_DISALLOW_COPY_AND_ASSIGN(Channel); | 284 MOJO_DISALLOW_COPY_AND_ASSIGN(Channel); |
285 }; | 285 }; |
286 | 286 |
287 } // namespace system | 287 } // namespace system |
288 } // namespace mojo | 288 } // namespace mojo |
289 | 289 |
290 #endif // MOJO_EDK_SYSTEM_CHANNEL_H_ | 290 #endif // MOJO_EDK_SYSTEM_CHANNEL_H_ |
OLD | NEW |