OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "mojo/public/cpp/bindings/lib/connector.h" | 5 #include "mojo/public/cpp/bindings/lib/connector.h" |
6 | 6 |
7 #include "mojo/public/cpp/bindings/error_handler.h" | 7 #include "mojo/public/cpp/bindings/error_handler.h" |
8 #include "mojo/public/cpp/environment/logging.h" | 8 #include "mojo/public/cpp/environment/logging.h" |
9 | 9 |
10 namespace mojo { | 10 namespace mojo { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 CancelWait(); | 44 CancelWait(); |
45 return message_pipe_.Pass(); | 45 return message_pipe_.Pass(); |
46 } | 46 } |
47 | 47 |
48 bool Connector::WaitForIncomingMessage() { | 48 bool Connector::WaitForIncomingMessage() { |
49 if (error_) | 49 if (error_) |
50 return false; | 50 return false; |
51 | 51 |
52 MojoResult rv = Wait(message_pipe_.get(), | 52 MojoResult rv = Wait(message_pipe_.get(), |
53 MOJO_HANDLE_SIGNAL_READABLE, | 53 MOJO_HANDLE_SIGNAL_READABLE, |
54 MOJO_DEADLINE_INDEFINITE); | 54 MOJO_DEADLINE_INDEFINITE, |
| 55 nullptr); |
55 if (rv != MOJO_RESULT_OK) { | 56 if (rv != MOJO_RESULT_OK) { |
56 NotifyError(); | 57 NotifyError(); |
57 return false; | 58 return false; |
58 } | 59 } |
59 mojo_ignore_result(ReadSingleMessage(&rv)); | 60 mojo_ignore_result(ReadSingleMessage(&rv)); |
60 return (rv == MOJO_RESULT_OK); | 61 return (rv == MOJO_RESULT_OK); |
61 } | 62 } |
62 | 63 |
63 bool Connector::Accept(Message* message) { | 64 bool Connector::Accept(Message* message) { |
64 MOJO_CHECK(message_pipe_.is_valid()); | 65 MOJO_CHECK(message_pipe_.is_valid()); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 198 |
198 void Connector::NotifyError() { | 199 void Connector::NotifyError() { |
199 error_ = true; | 200 error_ = true; |
200 CancelWait(); | 201 CancelWait(); |
201 if (error_handler_) | 202 if (error_handler_) |
202 error_handler_->OnConnectionError(); | 203 error_handler_->OnConnectionError(); |
203 } | 204 } |
204 | 205 |
205 } // namespace internal | 206 } // namespace internal |
206 } // namespace mojo | 207 } // namespace mojo |
OLD | NEW |