OLD | NEW |
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 "mojo/public/cpp/environment/lib/default_async_waiter.h" | 5 #include "mojo/public/cpp/environment/lib/default_async_waiter.h" |
6 | 6 |
7 #include <assert.h> | 7 #include <assert.h> |
8 | 8 |
9 #include "mojo/public/c/environment/async_waiter.h" | 9 #include "mojo/public/c/environment/async_waiter.h" |
10 #include "mojo/public/cpp/utility/run_loop.h" | 10 #include "mojo/public/cpp/utility/run_loop.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 : handle_(handle), | 26 : handle_(handle), |
27 callback_(callback), | 27 callback_(callback), |
28 closure_(closure) { | 28 closure_(closure) { |
29 } | 29 } |
30 | 30 |
31 virtual ~RunLoopHandlerImpl() { | 31 virtual ~RunLoopHandlerImpl() { |
32 RunLoop::current()->RemoveHandler(handle_); | 32 RunLoop::current()->RemoveHandler(handle_); |
33 } | 33 } |
34 | 34 |
35 // RunLoopHandler: | 35 // RunLoopHandler: |
36 virtual void OnHandleReady(const Handle& handle) MOJO_OVERRIDE { | 36 virtual void OnHandleReady(const Handle& handle) override { |
37 NotifyCallback(MOJO_RESULT_OK); | 37 NotifyCallback(MOJO_RESULT_OK); |
38 } | 38 } |
39 | 39 |
40 virtual void OnHandleError(const Handle& handle, | 40 virtual void OnHandleError(const Handle& handle, MojoResult result) override { |
41 MojoResult result) MOJO_OVERRIDE { | |
42 NotifyCallback(result); | 41 NotifyCallback(result); |
43 } | 42 } |
44 | 43 |
45 private: | 44 private: |
46 void NotifyCallback(MojoResult result) { | 45 void NotifyCallback(MojoResult result) { |
47 // Delete this to unregister the handle. That way if the callback | 46 // Delete this to unregister the handle. That way if the callback |
48 // reregisters everything is ok. | 47 // reregisters everything is ok. |
49 MojoAsyncWaitCallback callback = callback_; | 48 MojoAsyncWaitCallback callback = callback_; |
50 void* closure = closure_; | 49 void* closure = closure_; |
51 delete this; | 50 delete this; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 namespace internal { | 84 namespace internal { |
86 | 85 |
87 const MojoAsyncWaiter kDefaultAsyncWaiter = { | 86 const MojoAsyncWaiter kDefaultAsyncWaiter = { |
88 AsyncWait, | 87 AsyncWait, |
89 CancelWait | 88 CancelWait |
90 }; | 89 }; |
91 | 90 |
92 } // namespace internal | 91 } // namespace internal |
93 | 92 |
94 } // namespace mojo | 93 } // namespace mojo |
OLD | NEW |