Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(581)

Side by Side Diff: mojo/edk/system/channel.cc

Issue 801093002: Delete Channel::SerializeEndpoint(). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/edk/system/channel.h ('k') | mojo/edk/system/remote_message_pipe_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "mojo/edk/system/channel.h" 5 #include "mojo/edk/system/channel.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 new ChannelEndpoint(relayer.get(), 0, message_queue)); 231 new ChannelEndpoint(relayer.get(), 0, message_queue));
232 relayer->Init(endpoint.get(), peer_endpoint.get()); 232 relayer->Init(endpoint.get(), peer_endpoint.get());
233 peer_endpoint->ReplaceClient(relayer.get(), 1); 233 peer_endpoint->ReplaceClient(relayer.get(), 1);
234 234
235 SerializedEndpoint* s = static_cast<SerializedEndpoint*>(destination); 235 SerializedEndpoint* s = static_cast<SerializedEndpoint*>(destination);
236 s->receiver_endpoint_id = AttachAndRunEndpoint(endpoint); 236 s->receiver_endpoint_id = AttachAndRunEndpoint(endpoint);
237 DVLOG(2) << "Serializing endpoint with remote peer (remote ID = " 237 DVLOG(2) << "Serializing endpoint with remote peer (remote ID = "
238 << s->receiver_endpoint_id << ")"; 238 << s->receiver_endpoint_id << ")";
239 } 239 }
240 240
241 void Channel::SerializeEndpoint(scoped_refptr<ChannelEndpoint> endpoint,
242 void* destination) {
243 SerializedEndpoint* s = static_cast<SerializedEndpoint*>(destination);
244 s->receiver_endpoint_id = AttachAndRunEndpoint(endpoint);
245 DVLOG(2) << "Serializing endpoint (remote ID = " << s->receiver_endpoint_id
246 << ")";
247 }
248
249 scoped_refptr<IncomingEndpoint> Channel::DeserializeEndpoint( 241 scoped_refptr<IncomingEndpoint> Channel::DeserializeEndpoint(
250 const void* source) { 242 const void* source) {
251 const SerializedEndpoint* s = static_cast<const SerializedEndpoint*>(source); 243 const SerializedEndpoint* s = static_cast<const SerializedEndpoint*>(source);
252 ChannelEndpointId local_id = s->receiver_endpoint_id; 244 ChannelEndpointId local_id = s->receiver_endpoint_id;
253 // No need to check the validity of |local_id| -- if it's not valid, it simply 245 // No need to check the validity of |local_id| -- if it's not valid, it simply
254 // won't be in |incoming_endpoints_|. 246 // won't be in |incoming_endpoints_|.
255 DVLOG_IF(2, !local_id.is_valid() || !local_id.is_remote()) 247 DVLOG_IF(2, !local_id.is_valid() || !local_id.is_remote())
256 << "Attempt to get incoming endpoint for invalid ID " << local_id; 248 << "Attempt to get incoming endpoint for invalid ID " << local_id;
257 249
258 base::AutoLock locker(lock_); 250 base::AutoLock locker(lock_);
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 << ", local ID " << local_id << ", remote ID " << remote_id; 601 << ", local ID " << local_id << ", remote ID " << remote_id;
610 scoped_ptr<MessageInTransit> message(new MessageInTransit( 602 scoped_ptr<MessageInTransit> message(new MessageInTransit(
611 MessageInTransit::kTypeChannel, subtype, 0, nullptr)); 603 MessageInTransit::kTypeChannel, subtype, 0, nullptr));
612 message->set_source_id(local_id); 604 message->set_source_id(local_id);
613 message->set_destination_id(remote_id); 605 message->set_destination_id(remote_id);
614 return WriteMessage(message.Pass()); 606 return WriteMessage(message.Pass());
615 } 607 }
616 608
617 } // namespace system 609 } // namespace system
618 } // namespace mojo 610 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/channel.h ('k') | mojo/edk/system/remote_message_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698