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

Unified Diff: mojo/system/message_pipe_dispatcher.cc

Issue 66963005: Mojo: Implement local passing of MessagePipes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 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_dispatcher.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_dispatcher.cc
diff --git a/mojo/system/message_pipe_dispatcher.cc b/mojo/system/message_pipe_dispatcher.cc
index e0270f8b30177e32e7b86b7a2ce491715bc3ca7e..0c60f48b88170e68e7a50af65fc24f06dc8302c2 100644
--- a/mojo/system/message_pipe_dispatcher.cc
+++ b/mojo/system/message_pipe_dispatcher.cc
@@ -12,7 +12,10 @@
namespace mojo {
namespace system {
-MessagePipeDispatcher::MessagePipeDispatcher() {
+const unsigned kInvalidPort = static_cast<unsigned>(-1);
+
+MessagePipeDispatcher::MessagePipeDispatcher()
+ : port_(kInvalidPort) {
}
void MessagePipeDispatcher::Init(scoped_refptr<MessagePipe> message_pipe,
@@ -38,6 +41,7 @@ MojoResult MessagePipeDispatcher::CloseImplNoLock() {
lock().AssertAcquired();
message_pipe_->Close(port_);
message_pipe_ = NULL;
+ port_ = kInvalidPort;
return MOJO_RESULT_OK;
}
@@ -63,8 +67,8 @@ MojoResult MessagePipeDispatcher::WriteMessageImplNoLock(
MojoResult MessagePipeDispatcher::ReadMessageImplNoLock(
void* bytes, uint32_t* num_bytes,
- uint32_t max_num_dispatchers,
std::vector<scoped_refptr<Dispatcher> >* dispatchers,
+ uint32_t* num_dispatchers,
MojoReadMessageFlags flags) {
lock().AssertAcquired();
@@ -77,7 +81,7 @@ MojoResult MessagePipeDispatcher::ReadMessageImplNoLock(
return message_pipe_->ReadMessage(port_,
bytes, num_bytes,
- max_num_dispatchers, dispatchers,
+ dispatchers, num_dispatchers,
flags);
}
@@ -93,5 +97,16 @@ void MessagePipeDispatcher::RemoveWaiterImplNoLock(Waiter* waiter) {
message_pipe_->RemoveWaiter(port_, waiter);
}
+scoped_refptr<Dispatcher>
+MessagePipeDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() {
+ lock().AssertAcquired();
+
+ scoped_refptr<MessagePipeDispatcher> rv = new MessagePipeDispatcher;
+ rv->Init(message_pipe_, port_);
+ message_pipe_ = NULL;
+ port_ = kInvalidPort;
+ return scoped_refptr<Dispatcher>(rv.get());
+}
+
} // namespace system
} // namespace mojo
« no previous file with comments | « mojo/system/message_pipe_dispatcher.h ('k') | mojo/system/message_pipe_endpoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698