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

Unified Diff: Source/bindings/v8/MIDIAccessResolver.h

Issue 77773003: Make WebMIDI use blink Promise. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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
« no previous file with comments | « Source/bindings/bindings.gypi ('k') | Source/bindings/v8/MIDIAccessResolver.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/MIDIAccessResolver.h
diff --git a/Source/bindings/v8/MIDIAccessResolver.h b/Source/bindings/v8/MIDIAccessResolver.h
new file mode 100644
index 0000000000000000000000000000000000000000..cfceb23920db8dd692a8fbb817a0cc16da2ce5c6
--- /dev/null
+++ b/Source/bindings/v8/MIDIAccessResolver.h
@@ -0,0 +1,42 @@
+// Copyright 2014 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 MIDIAccessResolver_h
+#define MIDIAccessResolver_h
+
+#include "bindings/v8/ScriptPromiseResolver.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/RefCounted.h"
+
+namespace WebCore {
+
+class DOMError;
+class DOMWrapperWorld;
+class ExecutionContext;
+class MIDIAccess;
+
+class MIDIAccessResolver {
+ WTF_MAKE_NONCOPYABLE(MIDIAccessResolver);
+public:
+ static PassOwnPtr<MIDIAccessResolver> create(PassRefPtr<ScriptPromiseResolver> resolver, v8::Isolate* isolate)
+ {
+ return adoptPtr(new MIDIAccessResolver(resolver, isolate));
+ }
+ ~MIDIAccessResolver();
+
+ ScriptPromise promise() { return m_resolver->promise(); }
+
+ void resolve(MIDIAccess*, ExecutionContext*);
+ void reject(DOMError*, ExecutionContext*);
+
+private:
+ MIDIAccessResolver(PassRefPtr<ScriptPromiseResolver>, v8::Isolate*);
+
+ RefPtr<ScriptPromiseResolver> m_resolver;
+ RefPtr<DOMWrapperWorld> m_world;
+};
+
+} // namespace WebCore
+
+#endif // #ifndef MIDIAccessResolver_h
« no previous file with comments | « Source/bindings/bindings.gypi ('k') | Source/bindings/v8/MIDIAccessResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698