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

Unified Diff: mojo/system/message_pipe.cc

Issue 147983009: Mojo: Refactor some message pipe stuff. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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/system/message_pipe.h ('k') | mojo/system/message_pipe_endpoint.h » ('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 3a757ef42813ce496b29f60b4ac06923a7d3977c..f71a52738eccd8f3820380b5831694440d2a6025 100644
--- a/mojo/system/message_pipe.cc
+++ b/mojo/system/message_pipe.cc
@@ -114,6 +114,7 @@ MojoResult MessagePipe::EnqueueMessage(
const std::vector<Dispatcher*>* dispatchers) {
DCHECK(port == 0 || port == 1);
DCHECK(message);
+ DCHECK(!dispatchers || !dispatchers->empty());
if (message->type() == MessageInTransit::kTypeMessagePipe) {
DCHECK(!dispatchers);
@@ -131,27 +132,7 @@ MojoResult MessagePipe::EnqueueMessage(
return MOJO_RESULT_FAILED_PRECONDITION;
}
- MojoResult result = endpoints_[port]->CanEnqueueMessage(message, dispatchers);
- if (result != MOJO_RESULT_OK) {
- message->Destroy();
- return result;
- }
-
- if (dispatchers) {
- DCHECK(!dispatchers->empty());
-
- std::vector<scoped_refptr<Dispatcher> > replacement_dispatchers;
- for (size_t i = 0; i < dispatchers->size(); i++) {
- replacement_dispatchers.push_back(
- (*dispatchers)[i]->CreateEquivalentDispatcherAndCloseNoLock());
- }
-
- endpoints_[port]->EnqueueMessage(message, &replacement_dispatchers);
- } else {
- endpoints_[port]->EnqueueMessage(message, NULL);
- }
-
- return MOJO_RESULT_OK;
+ 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_endpoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698