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

Unified Diff: mojo/edk/system/raw_channel.cc

Issue 1526063003: EDK: Add TaskRunner and PlatformHandleWatcher to RawChannel. (Closed) Base URL: https://github.com/domokit/mojo.git@channel_watcher
Patch Set: Created 5 years 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/edk/system/raw_channel.h ('k') | mojo/edk/system/raw_channel_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/raw_channel.cc
diff --git a/mojo/edk/system/raw_channel.cc b/mojo/edk/system/raw_channel.cc
index 19005c856c4146492382c9d941d93dac8c56a55b..a801b71b0fa87118de3c5896327dd85b08ef2b20 100644
--- a/mojo/edk/system/raw_channel.cc
+++ b/mojo/edk/system/raw_channel.cc
@@ -17,8 +17,11 @@
#include "mojo/edk/system/transport_data.h"
using mojo::platform::PlatformHandle;
+using mojo::platform::PlatformHandleWatcher;
using mojo::platform::ScopedPlatformHandle;
+using mojo::platform::TaskRunner;
using mojo::util::MutexLocker;
+using mojo::util::RefPtr;
namespace mojo {
namespace system {
@@ -159,11 +162,11 @@ void RawChannel::WriteBuffer::GetBuffers(std::vector<Buffer>* buffers) const {
RawChannel::RawChannel()
: message_loop_for_io_(nullptr),
+ io_watcher_(nullptr),
delegate_(nullptr),
set_on_shutdown_(nullptr),
write_stopped_(false),
- weak_ptr_factory_(this) {
-}
+ weak_ptr_factory_(this) {}
RawChannel::~RawChannel() {
DCHECK(!read_buffer_);
@@ -175,11 +178,19 @@ RawChannel::~RawChannel() {
DCHECK(!weak_ptr_factory_.HasWeakPtrs());
}
-void RawChannel::Init(Delegate* delegate) {
+void RawChannel::Init(RefPtr<TaskRunner>&& io_task_runner,
+ PlatformHandleWatcher* io_watcher,
+ Delegate* delegate) {
+ DCHECK(io_task_runner);
+ DCHECK(io_watcher);
DCHECK(delegate);
DCHECK(!delegate_);
delegate_ = delegate;
+ DCHECK(!io_task_runner_);
+ io_task_runner_ = io_task_runner;
+ DCHECK(!io_watcher_);
+ io_watcher_ = io_watcher;
CHECK_EQ(base::MessageLoop::current()->type(), base::MessageLoop::TYPE_IO);
DCHECK(!message_loop_for_io_);
« no previous file with comments | « mojo/edk/system/raw_channel.h ('k') | mojo/edk/system/raw_channel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698