Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / mojo / public / cpp / bindings / lib / connector.cc
index 6665ff9..207429e 100644 (file)
@@ -63,7 +63,7 @@ bool Connector::WaitForIncomingMessage() {
 }
 
 bool Connector::Accept(Message* message) {
-  MOJO_DCHECK(message_pipe_.is_valid());
+  MOJO_CHECK(message_pipe_.is_valid());
 
   if (error_)
     return false;
@@ -122,7 +122,7 @@ void Connector::CallOnHandleReady(void* closure, MojoResult result) {
 }
 
 void Connector::OnHandleReady(MojoResult result) {
-  MOJO_DCHECK(async_wait_id_ != 0);
+  MOJO_CHECK(async_wait_id_ != 0);
   async_wait_id_ = 0;
   if (result != MOJO_RESULT_OK) {
     NotifyError();
@@ -133,7 +133,7 @@ void Connector::OnHandleReady(MojoResult result) {
 }
 
 void Connector::WaitToReadMore() {
-  MOJO_DCHECK(!async_wait_id_);
+  MOJO_CHECK(!async_wait_id_);
   async_wait_id_ = waiter_->AsyncWait(message_pipe_.get().value(),
                                       MOJO_HANDLE_SIGNAL_READABLE,
                                       MOJO_DEADLINE_INDEFINITE,
@@ -198,11 +198,7 @@ void Connector::CancelWait() {
 
 void Connector::NotifyError() {
   error_ = true;
-  // The error handler might destroyed |this|. Also, after an error, all method
-  // should end early.
-  if (destroyed_flag_) {
-    *destroyed_flag_ = true;  // Propagate flag.
-  }
+  CancelWait();
   if (error_handler_)
     error_handler_->OnConnectionError();
 }