| 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/edk/system/core.h" | 5 #include "mojo/edk/system/core.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 RefPtr<Dispatcher>* dispatcher) { | 105 RefPtr<Dispatcher>* dispatcher) { |
| 106 if (handle == MOJO_HANDLE_INVALID) | 106 if (handle == MOJO_HANDLE_INVALID) |
| 107 return MOJO_RESULT_INVALID_ARGUMENT; | 107 return MOJO_RESULT_INVALID_ARGUMENT; |
| 108 | 108 |
| 109 MutexLocker locker(&handle_table_mutex_); | 109 MutexLocker locker(&handle_table_mutex_); |
| 110 return handle_table_.GetAndRemoveDispatcher(handle, dispatcher); | 110 return handle_table_.GetAndRemoveDispatcher(handle, dispatcher); |
| 111 } | 111 } |
| 112 | 112 |
| 113 MojoResult Core::AsyncWait(MojoHandle handle, | 113 MojoResult Core::AsyncWait(MojoHandle handle, |
| 114 MojoHandleSignals signals, | 114 MojoHandleSignals signals, |
| 115 const base::Callback<void(MojoResult)>& callback) { | 115 const std::function<void(MojoResult)>& callback) { |
| 116 RefPtr<Dispatcher> dispatcher(GetDispatcher(handle)); | 116 RefPtr<Dispatcher> dispatcher(GetDispatcher(handle)); |
| 117 DCHECK(dispatcher); | 117 DCHECK(dispatcher); |
| 118 | 118 |
| 119 std::unique_ptr<AsyncWaiter> waiter(new AsyncWaiter(callback)); | 119 std::unique_ptr<AsyncWaiter> waiter(new AsyncWaiter(callback)); |
| 120 MojoResult rv = dispatcher->AddAwakable(waiter.get(), signals, 0, nullptr); | 120 MojoResult rv = dispatcher->AddAwakable(waiter.get(), signals, 0, nullptr); |
| 121 if (rv == MOJO_RESULT_OK) | 121 if (rv == MOJO_RESULT_OK) |
| 122 ignore_result(waiter.release()); | 122 ignore_result(waiter.release()); |
| 123 return rv; | 123 return rv; |
| 124 } | 124 } |
| 125 | 125 |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 if (signals_states) { | 602 if (signals_states) { |
| 603 for (; i < num_handles; i++) | 603 for (; i < num_handles; i++) |
| 604 signals_states[i] = dispatchers[i]->GetHandleSignalsState(); | 604 signals_states[i] = dispatchers[i]->GetHandleSignalsState(); |
| 605 } | 605 } |
| 606 | 606 |
| 607 return rv; | 607 return rv; |
| 608 } | 608 } |
| 609 | 609 |
| 610 } // namespace system | 610 } // namespace system |
| 611 } // namespace mojo | 611 } // namespace mojo |
| OLD | NEW |