Chromium Code Reviews| Index: third_party/WebKit/Source/core/mojo/MojoWatcher.h |
| diff --git a/third_party/WebKit/Source/core/mojo/MojoWatcher.h b/third_party/WebKit/Source/core/mojo/MojoWatcher.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5bd12593ff2736d7b995c5066e53b074498e3a61 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/mojo/MojoWatcher.h |
| @@ -0,0 +1,62 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MojoWatcher_h |
| +#define MojoWatcher_h |
| + |
| +#include "bindings/core/v8/ActiveScriptWrappable.h" |
| +#include "bindings/core/v8/ScriptWrappable.h" |
| +#include "bindings/core/v8/TraceWrapperMember.h" |
| +#include "core/dom/ContextLifecycleObserver.h" |
| +#include "mojo/public/cpp/system/handle.h" |
| + |
| +namespace blink { |
| + |
| +class ExecutionContext; |
| +class MojoWatchCallback; |
| +class MojoWatchOptions; |
| + |
| +class MojoWatcher final : public GarbageCollectedFinalized<MojoWatcher>, |
| + public ActiveScriptWrappable<MojoWatcher>, |
| + public ScriptWrappable, |
| + public ContextLifecycleObserver { |
| + DEFINE_WRAPPERTYPEINFO(); |
| + USING_GARBAGE_COLLECTED_MIXIN(MojoWatcher); |
| + |
| + public: |
| + static MojoWatcher* create(mojo::Handle, |
| + const MojoWatchOptions&, |
| + MojoWatchCallback*, |
| + ExecutionContext*); |
| + ~MojoWatcher(); |
| + |
| + MojoResult cancel(); |
| + |
| + DECLARE_TRACE(); |
| + DECLARE_TRACE_WRAPPERS(); |
| + |
| + // ScriptWrappable |
|
jbroman
2017/01/11 23:00:01
nit: ActiveScriptWrappable
alokp
2017/01/12 01:20:26
Done.
|
| + bool hasPendingActivity() const final; |
| + |
| + // ContextLifecycleObserver |
| + void contextDestroyed() final; |
| + |
| + private: |
| + friend class V8MojoWatcher; |
| + |
| + MojoWatcher(mojo::Handle, MojoWatchCallback*, ExecutionContext*); |
| + static void onHandleReady(uintptr_t context, |
| + MojoResult, |
| + MojoHandleSignalsState, |
| + MojoWatchNotificationFlags); |
| + void runReadyCallback(MojoResult); |
| + |
| + mojo::Handle m_handle; |
| + TraceWrapperMember<MojoWatchCallback> m_callback; |
| + RefPtr<WebTaskRunner> m_taskRunner; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // MojoWatcher_h |