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

Unified Diff: mojo/system/channel.cc

Issue 265753006: Mojo: Factor MessageInTransit secondary buffer stuff out into a separate class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: oops Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/mojo.gyp ('k') | mojo/system/dispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/channel.cc
diff --git a/mojo/system/channel.cc b/mojo/system/channel.cc
index ca6528422f2eb47d624ca6ed271653bdd03faa71..7446cb93e3007ba7b20359dc3b5c783780ee031e 100644
--- a/mojo/system/channel.cc
+++ b/mojo/system/channel.cc
@@ -12,6 +12,7 @@
#include "base/logging.h"
#include "base/strings/stringprintf.h"
#include "mojo/system/message_pipe_endpoint.h"
+#include "mojo/system/transport_data.h"
namespace mojo {
namespace system {
@@ -347,10 +348,17 @@ void Channel::OnReadMessageForDownstream(
return;
}
- // We need to duplicate the message, because |EnqueueMessage()| will take
- // ownership of it.
+ // We need to duplicate the message (data), because |EnqueueMessage()| will
+ // take ownership of it.
scoped_ptr<MessageInTransit> message(new MessageInTransit(message_view));
- message->DeserializeDispatchers(this);
+ if (message_view.transport_data_buffer_size() > 0) {
+ DCHECK(message_view.transport_data_buffer());
+ message->SetDispatchers(
+ TransportData::DeserializeDispatchersFromBuffer(
+ message_view.transport_data_buffer(),
+ message_view.transport_data_buffer_size(),
+ this));
+ }
MojoResult result = endpoint_info.message_pipe->EnqueueMessage(
MessagePipe::GetPeerPort(endpoint_info.port), message.Pass());
if (result != MOJO_RESULT_OK) {
@@ -458,7 +466,7 @@ bool Channel::SendControlMessage(MessageInTransit::Subtype subtype,
DVLOG(2) << "Sending channel control message: subtype " << subtype
<< ", local ID " << local_id << ", remote ID " << remote_id;
scoped_ptr<MessageInTransit> message(new MessageInTransit(
- MessageInTransit::kTypeChannel, subtype, 0, 0, NULL));
+ MessageInTransit::kTypeChannel, subtype, 0, NULL));
message->set_source_id(local_id);
message->set_destination_id(remote_id);
return WriteMessage(message.Pass());
« no previous file with comments | « mojo/mojo.gyp ('k') | mojo/system/dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698