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

Unified Diff: mojo/system/raw_channel.cc

Issue 223783006: Mojo: Make Channel take a RawChannel rather than creating it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: spurious space Created 6 years, 9 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/raw_channel.h ('k') | mojo/system/raw_channel_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/raw_channel.cc
diff --git a/mojo/system/raw_channel.cc b/mojo/system/raw_channel.cc
index cfdc131b23dd36e4b3dbaee681a68a1d3fd7b0da..d19e5f7507db5ec4df1649d138107dda5a478748 100644
--- a/mojo/system/raw_channel.cc
+++ b/mojo/system/raw_channel.cc
@@ -91,10 +91,9 @@ size_t RawChannel::WriteBuffer::GetTotalBytesToWrite() const {
return message->total_size() - offset_;
}
-RawChannel::RawChannel(Delegate* delegate,
- base::MessageLoopForIO* message_loop_for_io)
- : delegate_(delegate),
- message_loop_for_io_(message_loop_for_io),
+RawChannel::RawChannel()
+ : delegate_(NULL),
+ message_loop_for_io_(NULL),
read_stopped_(false),
write_stopped_(false),
weak_ptr_factory_(this) {
@@ -110,8 +109,16 @@ RawChannel::~RawChannel() {
DCHECK(!weak_ptr_factory_.HasWeakPtrs());
}
-bool RawChannel::Init() {
- DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io_);
+bool RawChannel::Init(Delegate* delegate) {
+ DCHECK(delegate);
+
+ DCHECK(!delegate_);
+ delegate_ = delegate;
+
+ CHECK_EQ(base::MessageLoop::current()->type(), base::MessageLoop::TYPE_IO);
+ DCHECK(!message_loop_for_io_);
+ message_loop_for_io_ =
+ static_cast<base::MessageLoopForIO*>(base::MessageLoop::current());
// No need to take the lock. No one should be using us yet.
DCHECK(!read_buffer_);
« no previous file with comments | « mojo/system/raw_channel.h ('k') | mojo/system/raw_channel_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698