Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1243)

Unified Diff: third_party/WebKit/Source/core/mojo/MojoWatcher.h

Issue 2405093003: [WIP] Mojo native bindings interface.
Patch Set: cleanup 2 Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..2a76cff557ed0cb02919f63339cce3a6f92b03a2
--- /dev/null
+++ b/third_party/WebKit/Source/core/mojo/MojoWatcher.h
@@ -0,0 +1,53 @@
+// 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/ScriptWrappable.h"
+#include "mojo/public/cpp/system/handle.h"
+
+namespace blink {
+
+class MojoWatchCallback;
+class ScriptState;
+class WebTaskRunner;
+
+class MojoWatcher final : public GarbageCollectedFinalized<MojoWatcher>,
+ public ScriptWrappable {
+ DEFINE_WRAPPERTYPEINFO();
+
+ public:
+ static MojoWatcher* create(mojo::Handle,
+ MojoHandleSignals,
+ ScriptState*,
+ MojoWatchCallback*);
+ virtual ~MojoWatcher();
+
+ MojoResult cancel();
+
+ DECLARE_TRACE();
+
+ private:
+ class RunReadyCallbackTask;
+
+ MojoWatcher(mojo::Handle,
+ ScriptState*,
+ MojoWatchCallback*,
+ std::unique_ptr<WebTaskRunner>);
+ static void onHandleReady(uintptr_t,
+ MojoResult,
+ MojoHandleSignalsState,
+ MojoWatchNotificationFlags);
+ void runReadyCallback(MojoResult);
+
+ mojo::Handle m_handle;
+ RefPtr<ScriptState> m_scriptState;
+ Member<MojoWatchCallback> m_callback;
+ std::unique_ptr<WebTaskRunner> m_taskRunner;
+};
+
+} // namespace blink
+
+#endif // MojoWatcher_h

Powered by Google App Engine
This is Rietveld 408576698