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

Unified Diff: mojo/edk/system/raw_channel.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.h ('k') | mojo/edk/system/raw_channel_posix.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 aa9c95f98f33b9168c19c0a53554acb9c2d6dedf..aff11103a9daba8c591742dd0dff41432c32759f 100644
--- a/mojo/edk/system/raw_channel.cc
+++ b/mojo/edk/system/raw_channel.cc
@@ -171,7 +171,7 @@ RawChannel::~RawChannel() {
DCHECK(!weak_ptr_factory_.HasWeakPtrs());
}
-bool RawChannel::Init(Delegate* delegate) {
+void RawChannel::Init(Delegate* delegate) {
DCHECK(delegate);
DCHECK(!delegate_);
@@ -188,13 +188,7 @@ bool RawChannel::Init(Delegate* delegate) {
DCHECK(!write_buffer_);
write_buffer_.reset(new WriteBuffer(GetSerializedPlatformHandleSize()));
- if (!OnInit()) {
- delegate_ = nullptr;
- message_loop_for_io_ = nullptr;
- read_buffer_.reset();
- write_buffer_.reset();
- return false;
- }
+ OnInit();
IOResult io_result = ScheduleRead();
if (io_result != IO_PENDING) {
@@ -204,10 +198,8 @@ bool RawChannel::Init(Delegate* delegate) {
FROM_HERE, base::Bind(&RawChannel::OnReadCompleted,
weak_ptr_factory_.GetWeakPtr(), io_result, 0));
}
-
- // ScheduleRead() failure is treated as a read failure (by notifying the
- // delegate), not as an init failure.
- return true;
+ // Note: |ScheduleRead()| failure is treated as a read failure (by notifying
+ // the delegate), not an initialization failure.
}
void RawChannel::Shutdown() {
« no previous file with comments | « mojo/edk/system/raw_channel.h ('k') | mojo/edk/system/raw_channel_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698