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