OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 MojoWatcher_h | 5 #ifndef MojoWatcher_h |
6 #define MojoWatcher_h | 6 #define MojoWatcher_h |
7 | 7 |
8 #include "bindings/core/v8/ActiveScriptWrappable.h" | 8 #include "bindings/core/v8/ActiveScriptWrappable.h" |
9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
10 #include "bindings/core/v8/TraceWrapperMember.h" | 10 #include "bindings/core/v8/TraceWrapperMember.h" |
11 #include "core/dom/ContextLifecycleObserver.h" | 11 #include "core/dom/ContextLifecycleObserver.h" |
12 #include "mojo/public/cpp/system/handle.h" | 12 #include "mojo/public/cpp/system/handle.h" |
| 13 #include "mojo/public/cpp/system/watcher.h" |
13 | 14 |
14 namespace blink { | 15 namespace blink { |
15 | 16 |
16 class ExecutionContext; | 17 class ExecutionContext; |
17 class MojoHandleSignals; | 18 class MojoHandleSignals; |
18 class MojoWatchCallback; | 19 class MojoWatchCallback; |
19 | 20 |
20 class MojoWatcher final : public GarbageCollectedFinalized<MojoWatcher>, | 21 class MojoWatcher final : public GarbageCollectedFinalized<MojoWatcher>, |
21 public ActiveScriptWrappable<MojoWatcher>, | 22 public ActiveScriptWrappable<MojoWatcher>, |
22 public ScriptWrappable, | 23 public ScriptWrappable, |
(...skipping 17 matching lines...) Expand all Loading... |
40 bool hasPendingActivity() const final; | 41 bool hasPendingActivity() const final; |
41 | 42 |
42 // ContextLifecycleObserver | 43 // ContextLifecycleObserver |
43 void contextDestroyed(ExecutionContext*) final; | 44 void contextDestroyed(ExecutionContext*) final; |
44 | 45 |
45 private: | 46 private: |
46 friend class V8MojoWatcher; | 47 friend class V8MojoWatcher; |
47 | 48 |
48 MojoWatcher(ExecutionContext*, MojoWatchCallback*); | 49 MojoWatcher(ExecutionContext*, MojoWatchCallback*); |
49 MojoResult watch(mojo::Handle, const MojoHandleSignals&); | 50 MojoResult watch(mojo::Handle, const MojoHandleSignals&); |
| 51 MojoResult arm(MojoResult* readyResult); |
50 | 52 |
51 static void onHandleReady(uintptr_t context, | 53 static void onHandleReady(uintptr_t context, |
52 MojoResult, | 54 MojoResult, |
53 MojoHandleSignalsState, | 55 MojoHandleSignalsState, |
54 MojoWatchNotificationFlags); | 56 MojoWatcherNotificationFlags); |
55 void runReadyCallback(MojoResult); | 57 void runReadyCallback(MojoResult); |
56 | 58 |
57 RefPtr<WebTaskRunner> m_taskRunner; | 59 RefPtr<WebTaskRunner> m_taskRunner; |
58 TraceWrapperMember<MojoWatchCallback> m_callback; | 60 TraceWrapperMember<MojoWatchCallback> m_callback; |
| 61 mojo::ScopedWatcherHandle m_watcherHandle; |
59 mojo::Handle m_handle; | 62 mojo::Handle m_handle; |
60 }; | 63 }; |
61 | 64 |
62 } // namespace blink | 65 } // namespace blink |
63 | 66 |
64 #endif // MojoWatcher_h | 67 #endif // MojoWatcher_h |
OLD | NEW |