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

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

Issue 172953003: Mojo: Make MessageInTransit more opaque. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 6 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | mojo/system/message_in_transit.h » ('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/system/channel.h" 5 #include "mojo/system/channel.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 // tested (TODO(vtl)). 186 // tested (TODO(vtl)).
187 DLOG(ERROR) << "This should not happen under normal operation."; 187 DLOG(ERROR) << "This should not happen under normal operation.";
188 return; 188 return;
189 } 189 }
190 endpoint_info = it->second; 190 endpoint_info = it->second;
191 } 191 }
192 192
193 // We need to duplicate the message, because |EnqueueMessage()| will take 193 // We need to duplicate the message, because |EnqueueMessage()| will take
194 // ownership of it. 194 // ownership of it.
195 // TODO(vtl): Need to enforce limits on message size and handle count. 195 // TODO(vtl): Need to enforce limits on message size and handle count.
196 MessageInTransit* own_message = MessageInTransit::Create( 196 MessageInTransit* own_message = message.Clone();
197 message.type(), message.subtype(), message.bytes(), message.num_bytes(),
198 message.num_handles());
199 std::vector<DispatcherTransport> transports(message.num_handles()); 197 std::vector<DispatcherTransport> transports(message.num_handles());
200 // TODO(vtl): Create dispatchers for handles. 198 // TODO(vtl): Create dispatchers for handles.
201 // TODO(vtl): It's bad that the current API will create equivalent dispatchers 199 // TODO(vtl): It's bad that the current API will create equivalent dispatchers
202 // for the freshly-created ones, which is totally redundant. Make a version of 200 // for the freshly-created ones, which is totally redundant. Make a version of
203 // |EnqueueMessage()| that passes ownership. 201 // |EnqueueMessage()| that passes ownership.
204 if (endpoint_info.message_pipe->EnqueueMessage( 202 if (endpoint_info.message_pipe->EnqueueMessage(
205 MessagePipe::GetPeerPort(endpoint_info.port), own_message, 203 MessagePipe::GetPeerPort(endpoint_info.port), own_message,
206 message.num_handles() ? &transports : NULL) != MOJO_RESULT_OK) { 204 message.num_handles() ? &transports : NULL) != MOJO_RESULT_OK) {
207 HandleLocalError(base::StringPrintf( 205 HandleLocalError(base::StringPrintf(
208 "Failed to enqueue message to local destination ID %u", 206 "Failed to enqueue message to local destination ID %u",
(...skipping 13 matching lines...) Expand all
222 LOG(WARNING) << error_message; 220 LOG(WARNING) << error_message;
223 } 221 }
224 222
225 void Channel::HandleLocalError(const base::StringPiece& error_message) { 223 void Channel::HandleLocalError(const base::StringPiece& error_message) {
226 // TODO(vtl): Is this how we really want to handle this? 224 // TODO(vtl): Is this how we really want to handle this?
227 LOG(FATAL) << error_message; 225 LOG(FATAL) << error_message;
228 } 226 }
229 227
230 } // namespace system 228 } // namespace system
231 } // namespace mojo 229 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/system/message_in_transit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698