Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: mojo/edk/system/core.cc

Issue 1420533012: EDK: Make mojo::embedder::AsyncWait (etc.) take an std::function instead of a base::Callback. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/edk/system/core.h ('k') | mojo/edk/system/core_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « mojo/edk/system/core.h ('k') | mojo/edk/system/core_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698