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

Unified Diff: mojo/system/message_pipe.cc

Issue 68993005: Mojo: More plumbing to support sending handles over MessagePipes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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/system/message_pipe.h ('k') | mojo/system/message_pipe_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/message_pipe.cc
diff --git a/mojo/system/message_pipe.cc b/mojo/system/message_pipe.cc
index 7f95a908030b3f5ebf7f25050cbcaf5ec1ed044f..b9643524f77f49bf3f8a36d7561ec54fcac7f3b0 100644
--- a/mojo/system/message_pipe.cc
+++ b/mojo/system/message_pipe.cc
@@ -64,7 +64,7 @@ void MessagePipe::Close(unsigned port) {
MojoResult MessagePipe::WriteMessage(
unsigned port,
const void* bytes, uint32_t num_bytes,
- const std::vector<Dispatcher*>* /*dispatchers*/,
+ const std::vector<Dispatcher*>* dispatchers,
MojoWriteMessageFlags flags) {
DCHECK(port == 0 || port == 1);
return EnqueueMessage(
@@ -72,7 +72,8 @@ MojoResult MessagePipe::WriteMessage(
MessageInTransit::Create(
MessageInTransit::kTypeMessagePipeEndpoint,
MessageInTransit::kSubtypeMessagePipeEndpointData,
- bytes, num_bytes));
+ bytes, num_bytes),
+ dispatchers);
}
MojoResult MessagePipe::ReadMessage(
@@ -87,7 +88,7 @@ MojoResult MessagePipe::ReadMessage(
DCHECK(endpoints_[port].get());
return endpoints_[port]->ReadMessage(bytes, num_bytes,
- NULL, NULL,
+ max_num_dispatchers, dispatchers,
flags);
}
@@ -112,13 +113,17 @@ void MessagePipe::RemoveWaiter(unsigned port, Waiter* waiter) {
endpoints_[port]->RemoveWaiter(waiter);
}
-MojoResult MessagePipe::EnqueueMessage(unsigned port,
- MessageInTransit* message) {
+MojoResult MessagePipe::EnqueueMessage(
+ unsigned port,
+ MessageInTransit* message,
+ const std::vector<Dispatcher*>* dispatchers) {
DCHECK(port == 0 || port == 1);
DCHECK(message);
- if (message->type() == MessageInTransit::kTypeMessagePipe)
+ if (message->type() == MessageInTransit::kTypeMessagePipe) {
+ DCHECK(!dispatchers);
return HandleControlMessage(port, message);
+ }
DCHECK_EQ(message->type(), MessageInTransit::kTypeMessagePipeEndpoint);
@@ -131,7 +136,7 @@ MojoResult MessagePipe::EnqueueMessage(unsigned port,
return MOJO_RESULT_FAILED_PRECONDITION;
}
- return endpoints_[port]->EnqueueMessage(message);
+ return endpoints_[port]->EnqueueMessage(message, dispatchers);
}
void MessagePipe::Attach(unsigned port,
« no previous file with comments | « mojo/system/message_pipe.h ('k') | mojo/system/message_pipe_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698