Chromium Code Reviews| 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 854a80cd740c18568c93eaa6ac899e04fce4dd74..6843069c9b4aa023e3edffdc4d24ac0f716b5f04 100644 |
| --- a/mojo/public/cpp/bindings/lib/connector.cc |
| +++ b/mojo/public/cpp/bindings/lib/connector.cc |
| @@ -231,16 +231,26 @@ bool Connector::ReadSingleMessage(MojoResult* read_result) { |
| bool* previous_destroyed_flag = destroyed_flag_; |
| destroyed_flag_ = &was_destroyed_during_dispatch; |
| - MojoResult rv = ReadAndDispatchMessage( |
| - message_pipe_.get(), incoming_receiver_, &receiver_result); |
| - if (read_result) |
| - *read_result = rv; |
| + Message message; |
| + const MojoResult rv = ReadMessage(message_pipe_.get(), &message); |
| + *read_result = rv; |
| + |
| + if (rv == MOJO_RESULT_OK) { |
| + // Dispatching the message may spin in a nested message loop. To ensure we |
| + // continue dispatching messages when this happens start listening for |
| + // messagse now. |
| + if (!async_wait_id_) |
| + WaitToReadMore(); |
|
yzshen1
2016/01/09 00:26:30
Could you please add a TODO for evaluating the per
sky
2016/01/11 16:10:35
Done.
|
| + receiver_result = |
| + incoming_receiver_ && incoming_receiver_->Accept(&message); |
| + } |
| if (was_destroyed_during_dispatch) { |
| if (previous_destroyed_flag) |
| *previous_destroyed_flag = true; // Propagate flag. |
| return false; |
| } |
| + |
| destroyed_flag_ = previous_destroyed_flag; |
| if (rv == MOJO_RESULT_SHOULD_WAIT) |