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

Unified Diff: ipc/mojo/ipc_message_pipe_reader.cc

Issue 929433005: WIP: A couple of more ChannelMojo speedup ideas (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build and test fix Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ipc/mojo/ipc_message_pipe_reader.h ('k') | third_party/mojo/src/mojo/edk/embedder/embedder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/mojo/ipc_message_pipe_reader.cc
diff --git a/ipc/mojo/ipc_message_pipe_reader.cc b/ipc/mojo/ipc_message_pipe_reader.cc
index 72e7ad7618f4c31b2587bd554f0f6ff381a73a2d..b4d473ea408caaa57454404ba8a67430ee29d772 100644
--- a/ipc/mojo/ipc_message_pipe_reader.cc
+++ b/ipc/mojo/ipc_message_pipe_reader.cc
@@ -9,7 +9,6 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/message_loop/message_loop_proxy.h"
-#include "ipc/mojo/async_handle_waiter.h"
#include "ipc/mojo/ipc_channel_mojo.h"
namespace IPC {
@@ -19,9 +18,8 @@ MessagePipeReader::MessagePipeReader(mojo::ScopedMessagePipeHandle handle,
MessagePipeReader::Delegate* delegate)
: pipe_(handle.Pass()),
delegate_(delegate),
- async_waiter_(
- new AsyncHandleWaiter(base::Bind(&MessagePipeReader::PipeIsReady,
- base::Unretained(this)))) {
+ async_waiter_(new AsyncHandleWaiter(this)) {
+ async_waiter_->SetMessageCallback(pipe_.get().value());
}
MessagePipeReader::~MessagePipeReader() {
@@ -29,6 +27,8 @@ MessagePipeReader::~MessagePipeReader() {
}
void MessagePipeReader::Close() {
+ if (async_waiter_)
+ async_waiter_->ClearMessageCallback(pipe_.get().value());
async_waiter_.reset();
pipe_.reset();
OnPipeClosed();
@@ -195,6 +195,13 @@ void MessagePipeReader::PipeIsReady(MojoResult wait_result) {
ReadMessagesThenWait();
}
+void MessagePipeReader::MessageWasArrived(const void* bytes,
+ uint32_t num_bytes) {
+ Message message(reinterpret_cast<const char*>(bytes),
+ static_cast<int>(num_bytes));
+ delegate_->OnMessageReceived(message);
+}
+
void MessagePipeReader::DelayedDeleter::operator()(
MessagePipeReader* ptr) const {
ptr->Close();
« no previous file with comments | « ipc/mojo/ipc_message_pipe_reader.h ('k') | third_party/mojo/src/mojo/edk/embedder/embedder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698