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/common/message_pump_mojo.h" | 5 #include "mojo/common/message_pump_mojo.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 if (result == MOJO_RESULT_INVALID_ARGUMENT || | 189 if (result == MOJO_RESULT_INVALID_ARGUMENT || |
190 result == MOJO_RESULT_FAILED_PRECONDITION) { | 190 result == MOJO_RESULT_FAILED_PRECONDITION) { |
191 // Remove the handle first, this way if OnHandleError() tries to remove | 191 // Remove the handle first, this way if OnHandleError() tries to remove |
192 // the handle our iterator isn't invalidated. | 192 // the handle our iterator isn't invalidated. |
193 DCHECK(handlers_.find(wait_state.handles[i]) != handlers_.end()); | 193 DCHECK(handlers_.find(wait_state.handles[i]) != handlers_.end()); |
194 MessagePumpMojoHandler* handler = | 194 MessagePumpMojoHandler* handler = |
195 handlers_[wait_state.handles[i]].handler; | 195 handlers_[wait_state.handles[i]].handler; |
196 handlers_.erase(wait_state.handles[i]); | 196 handlers_.erase(wait_state.handles[i]); |
197 handler->OnHandleError(wait_state.handles[i], result); | 197 handler->OnHandleError(wait_state.handles[i], result); |
198 return; | 198 return; |
199 } else { | |
200 DCHECK_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, result); | |
201 } | 199 } |
202 } | 200 } |
203 } | 201 } |
204 | 202 |
205 void MessagePumpMojo::SignalControlPipe(const RunState& run_state) { | 203 void MessagePumpMojo::SignalControlPipe(const RunState& run_state) { |
206 // TODO(sky): deal with error? | 204 // TODO(sky): deal with error? |
207 WriteMessageRaw(run_state.write_handle.get(), NULL, 0, NULL, 0, | 205 WriteMessageRaw(run_state.write_handle.get(), NULL, 0, NULL, 0, |
208 MOJO_WRITE_MESSAGE_FLAG_NONE); | 206 MOJO_WRITE_MESSAGE_FLAG_NONE); |
209 } | 207 } |
210 | 208 |
(...skipping 20 matching lines...) Expand all Loading... |
231 min_time = i->second.deadline; | 229 min_time = i->second.deadline; |
232 } | 230 } |
233 return min_time.is_null() ? MOJO_DEADLINE_INDEFINITE : | 231 return min_time.is_null() ? MOJO_DEADLINE_INDEFINITE : |
234 std::max(static_cast<MojoDeadline>(0), | 232 std::max(static_cast<MojoDeadline>(0), |
235 static_cast<MojoDeadline>( | 233 static_cast<MojoDeadline>( |
236 (min_time - internal::NowTicks()).InMicroseconds())); | 234 (min_time - internal::NowTicks()).InMicroseconds())); |
237 } | 235 } |
238 | 236 |
239 } // namespace common | 237 } // namespace common |
240 } // namespace mojo | 238 } // namespace mojo |
OLD | NEW |