| Index: mojo/public/cpp/bindings/lib/connector.cc
|
| diff --git a/mojo/public/cpp/bindings/lib/connector.cc b/mojo/public/cpp/bindings/lib/connector.cc
|
| index 170c4d71aa30296ecef64b3efe2af494f3506955..6665ff9442a1d078d3554358215ff5a4c424cb4f 100644
|
| --- a/mojo/public/cpp/bindings/lib/connector.cc
|
| +++ b/mojo/public/cpp/bindings/lib/connector.cc
|
| @@ -34,19 +34,16 @@ Connector::~Connector() {
|
| if (destroyed_flag_)
|
| *destroyed_flag_ = true;
|
|
|
| - if (async_wait_id_)
|
| - waiter_->CancelWait(async_wait_id_);
|
| + CancelWait();
|
| }
|
|
|
| void Connector::CloseMessagePipe() {
|
| + CancelWait();
|
| Close(message_pipe_.Pass());
|
| }
|
|
|
| ScopedMessagePipeHandle Connector::PassMessagePipe() {
|
| - if (async_wait_id_) {
|
| - waiter_->CancelWait(async_wait_id_);
|
| - async_wait_id_ = 0;
|
| - }
|
| + CancelWait();
|
| return message_pipe_.Pass();
|
| }
|
|
|
| @@ -136,6 +133,7 @@ void Connector::OnHandleReady(MojoResult result) {
|
| }
|
|
|
| void Connector::WaitToReadMore() {
|
| + MOJO_DCHECK(!async_wait_id_);
|
| async_wait_id_ = waiter_->AsyncWait(message_pipe_.get().value(),
|
| MOJO_HANDLE_SIGNAL_READABLE,
|
| MOJO_DEADLINE_INDEFINITE,
|
| @@ -190,6 +188,14 @@ void Connector::ReadAllAvailableMessages() {
|
| }
|
| }
|
|
|
| +void Connector::CancelWait() {
|
| + if (!async_wait_id_)
|
| + return;
|
| +
|
| + waiter_->CancelWait(async_wait_id_);
|
| + async_wait_id_ = 0;
|
| +}
|
| +
|
| void Connector::NotifyError() {
|
| error_ = true;
|
| // The error handler might destroyed |this|. Also, after an error, all method
|
|
|