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 #ifndef MOJO_EDK_JS_WAITING_CALLBACK_H_ | 5 #ifndef MOJO_EDK_JS_WAITING_CALLBACK_H_ |
6 #define MOJO_EDK_JS_WAITING_CALLBACK_H_ | 6 #define MOJO_EDK_JS_WAITING_CALLBACK_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "gin/handle.h" | 10 #include "gin/handle.h" |
11 #include "gin/runner.h" | 11 #include "gin/runner.h" |
12 #include "gin/wrappable.h" | 12 #include "gin/wrappable.h" |
13 #include "mojo/edk/js/handle.h" | 13 #include "mojo/edk/js/handle.h" |
14 #include "mojo/public/cpp/system/core.h" | 14 #include "mojo/public/cpp/system/core.h" |
15 #include "mojo/public/cpp/system/watcher.h" | 15 #include "mojo/public/cpp/system/simple_watcher.h" |
16 | 16 |
17 namespace mojo { | 17 namespace mojo { |
18 namespace edk { | 18 namespace edk { |
19 namespace js { | 19 namespace js { |
20 | 20 |
21 class WaitingCallback : public gin::Wrappable<WaitingCallback> { | 21 class WaitingCallback : public gin::Wrappable<WaitingCallback> { |
22 public: | 22 public: |
23 static gin::WrapperInfo kWrapperInfo; | 23 static gin::WrapperInfo kWrapperInfo; |
24 | 24 |
25 // Creates a new WaitingCallback. | 25 // Creates a new WaitingCallback. |
(...skipping 21 matching lines...) Expand all Loading... |
47 | 47 |
48 // Callback from the Watcher. | 48 // Callback from the Watcher. |
49 void OnHandleReady(MojoResult result); | 49 void OnHandleReady(MojoResult result); |
50 | 50 |
51 // Indicates whether this is a one-shot callback or not. If so, it uses the | 51 // Indicates whether this is a one-shot callback or not. If so, it uses the |
52 // deprecated HandleWatcher to wait for signals; otherwise it uses the new | 52 // deprecated HandleWatcher to wait for signals; otherwise it uses the new |
53 // system Watcher API. | 53 // system Watcher API. |
54 const bool one_shot_; | 54 const bool one_shot_; |
55 | 55 |
56 base::WeakPtr<gin::Runner> runner_; | 56 base::WeakPtr<gin::Runner> runner_; |
57 Watcher watcher_; | 57 SimpleWatcher watcher_; |
58 base::WeakPtrFactory<WaitingCallback> weak_factory_; | 58 base::WeakPtrFactory<WaitingCallback> weak_factory_; |
59 | 59 |
60 DISALLOW_COPY_AND_ASSIGN(WaitingCallback); | 60 DISALLOW_COPY_AND_ASSIGN(WaitingCallback); |
61 }; | 61 }; |
62 | 62 |
63 } // namespace js | 63 } // namespace js |
64 } // namespace edk | 64 } // namespace edk |
65 } // namespace mojo | 65 } // namespace mojo |
66 | 66 |
67 #endif // MOJO_EDK_JS_WAITING_CALLBACK_H_ | 67 #endif // MOJO_EDK_JS_WAITING_CALLBACK_H_ |
OLD | NEW |