| 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 "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // Note: The IDs generated by this should be checked for existence before use. | 194 // Note: The IDs generated by this should be checked for existence before use. |
| 195 LocalChannelEndpointIdGenerator local_id_generator_; | 195 LocalChannelEndpointIdGenerator local_id_generator_; |
| 196 | 196 |
| 197 typedef base::hash_map<ChannelEndpointId, scoped_refptr<MessagePipe>> | 197 typedef base::hash_map<ChannelEndpointId, scoped_refptr<MessagePipe>> |
| 198 IdToMessagePipeMap; | 198 IdToMessagePipeMap; |
| 199 // Map from local IDs to pending/incoming message pipes (i.e., those which do | 199 // Map from local IDs to pending/incoming message pipes (i.e., those which do |
| 200 // not yet have a dispatcher attached). | 200 // not yet have a dispatcher attached). |
| 201 // TODO(vtl): This is a layering violation, since |Channel| shouldn't know | 201 // TODO(vtl): This is a layering violation, since |Channel| shouldn't know |
| 202 // about |MessagePipe|. However, we can't just hang on to |ChannelEndpoint|s | 202 // about |MessagePipe|. However, we can't just hang on to |ChannelEndpoint|s |
| 203 // (even if they have a reference to the |MessagePipe|) since their lifetimes | 203 // (even if they have a reference to the |MessagePipe|) since their lifetimes |
| 204 // are tied to the "remote" side. When |ChannelEndpoint::OnDisconnect()| | 204 // are tied to the "remote" side. When |ChannelEndpoint::DetachFromChannel()| |
| 205 // (eventually) results in |ChannelEndpoint::DetachFromMessagePipe()| being | 205 // (eventually) results in |ChannelEndpoint::DetachFromClient()| being called. |
| 206 // called. We really need to hang on to the "local" side of the message pipe, | 206 // We really need to hang on to the "local" side of the message pipe, to which |
| 207 // to which dispatchers will be "attached". | 207 // dispatchers will be "attached". |
| 208 IdToMessagePipeMap incoming_message_pipes_; | 208 IdToMessagePipeMap incoming_message_pipes_; |
| 209 // TODO(vtl): We need to keep track of remote IDs (so that we don't collide | 209 // TODO(vtl): We need to keep track of remote IDs (so that we don't collide |
| 210 // if/when we wrap). | 210 // if/when we wrap). |
| 211 RemoteChannelEndpointIdGenerator remote_id_generator_; | 211 RemoteChannelEndpointIdGenerator remote_id_generator_; |
| 212 | 212 |
| 213 DISALLOW_COPY_AND_ASSIGN(Channel); | 213 DISALLOW_COPY_AND_ASSIGN(Channel); |
| 214 }; | 214 }; |
| 215 | 215 |
| 216 } // namespace system | 216 } // namespace system |
| 217 } // namespace mojo | 217 } // namespace mojo |
| 218 | 218 |
| 219 #endif // MOJO_EDK_SYSTEM_CHANNEL_H_ | 219 #endif // MOJO_EDK_SYSTEM_CHANNEL_H_ |
| OLD | NEW |