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

Side by Side Diff: mojo/public/cpp/environment/lib/async_waiter.cc

Issue 703273002: Update mojo sdk to rev 04a510fb37db10642e156957f9b2c11c2f6442ac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix content/child -> mojo/common linking Created 6 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/public/cpp/environment/async_waiter.h ('k') | mojo/public/cpp/environment/tests/BUILD.gn » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "device/serial/async_waiter.h" 5 #include "mojo/public/cpp/environment/async_waiter.h"
6 6
7 namespace device { 7 namespace mojo {
8 8
9 AsyncWaiter::AsyncWaiter(mojo::Handle handle, 9 AsyncWaiter::AsyncWaiter(Handle handle,
10 MojoHandleSignals signals, 10 MojoHandleSignals signals,
11 const Callback& callback) 11 const Callback& callback)
12 : waiter_(mojo::Environment::GetDefaultAsyncWaiter()), 12 : waiter_(Environment::GetDefaultAsyncWaiter()),
13 id_(0), 13 id_(0),
14 callback_(callback) { 14 callback_(callback) {
15 id_ = waiter_->AsyncWait(handle.value(), 15 id_ = waiter_->AsyncWait(handle.value(), signals, MOJO_DEADLINE_INDEFINITE,
16 signals, 16 &AsyncWaiter::WaitComplete, this);
17 MOJO_DEADLINE_INDEFINITE,
18 &AsyncWaiter::WaitComplete,
19 this);
20 } 17 }
21 18
22 AsyncWaiter::~AsyncWaiter() { 19 AsyncWaiter::~AsyncWaiter() {
23 if (id_) 20 if (id_)
24 waiter_->CancelWait(id_); 21 waiter_->CancelWait(id_);
25 } 22 }
26 23
27 // static 24 // static
28 void AsyncWaiter::WaitComplete(void* waiter, MojoResult result) { 25 void AsyncWaiter::WaitComplete(void* waiter, MojoResult result) {
29 static_cast<AsyncWaiter*>(waiter)->WaitCompleteInternal(result); 26 static_cast<AsyncWaiter*>(waiter)->WaitCompleteInternal(result);
30 } 27 }
31 28
32 void AsyncWaiter::WaitCompleteInternal(MojoResult result) { 29 void AsyncWaiter::WaitCompleteInternal(MojoResult result) {
33 id_ = 0; 30 id_ = 0;
34 callback_.Run(result); 31 callback_.Run(result);
35 } 32 }
36 33
37 } // namespace device 34 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/environment/async_waiter.h ('k') | mojo/public/cpp/environment/tests/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698