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

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

Issue 852113002: Remove RawChannel::Init() and Channel::Init() failure cases. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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/edk/system/raw_channel.cc ('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_posix.cc
diff --git a/mojo/edk/system/raw_channel_posix.cc b/mojo/edk/system/raw_channel_posix.cc
index 71ec02f7489b42a474835ee8b21174262860e389..078f8cbfcdd39c4f4c65dbf3a2bddccbbd49b365 100644
--- a/mojo/edk/system/raw_channel_posix.cc
+++ b/mojo/edk/system/raw_channel_posix.cc
@@ -54,7 +54,7 @@ class RawChannelPosix : public RawChannel,
IOResult WriteNoLock(size_t* platform_handles_written,
size_t* bytes_written) override;
IOResult ScheduleWriteNoLock() override;
- bool OnInit() override;
+ void OnInit() override;
void OnShutdownNoLock(scoped_ptr<ReadBuffer> read_buffer,
scoped_ptr<WriteBuffer> write_buffer) override;
@@ -310,7 +310,7 @@ RawChannel::IOResult RawChannelPosix::ScheduleWriteNoLock() {
return IO_FAILED_UNKNOWN;
}
-bool RawChannelPosix::OnInit() {
+void RawChannelPosix::OnInit() {
DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io());
DCHECK(!read_watcher_);
@@ -318,18 +318,12 @@ bool RawChannelPosix::OnInit() {
DCHECK(!write_watcher_);
write_watcher_.reset(new base::MessageLoopForIO::FileDescriptorWatcher());
- if (!message_loop_for_io()->WatchFileDescriptor(
- fd_.get().fd, true, base::MessageLoopForIO::WATCH_READ,
- read_watcher_.get(), this)) {
- // TODO(vtl): I'm not sure |WatchFileDescriptor()| actually fails cleanly
- // (in the sense of returning the message loop's state to what it was before
- // it was called).
- read_watcher_.reset();
- write_watcher_.reset();
- return false;
- }
-
- return true;
+ // I don't know how this can fail (unless |fd_| is bad, in which case it's a
+ // bug in our code). I also don't know if |WatchFileDescriptor()| actually
+ // fails cleanly.
+ CHECK(message_loop_for_io()->WatchFileDescriptor(
+ fd_.get().fd, true, base::MessageLoopForIO::WATCH_READ,
+ read_watcher_.get(), this));
}
void RawChannelPosix::OnShutdownNoLock(
« no previous file with comments | « mojo/edk/system/raw_channel.cc ('k') | mojo/edk/system/raw_channel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698