1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MIDIAccessResolver_h
6 #define MIDIAccessResolver_h
8 #include "bindings/v8/ScriptPromiseResolver.h"
9 #include "wtf/OwnPtr.h"
10 #include "wtf/RefCounted.h"
15 class DOMWrapperWorld;
16 class ExecutionContext;
19 class MIDIAccessResolver {
20 WTF_MAKE_NONCOPYABLE(MIDIAccessResolver);
22 static PassOwnPtr<MIDIAccessResolver> create(PassRefPtr<ScriptPromiseResolver> resolver, v8::Isolate* isolate)
24 return adoptPtr(new MIDIAccessResolver(resolver, isolate));
26 ~MIDIAccessResolver();
28 ScriptPromise promise() { return m_resolver->promise(); }
30 void resolve(MIDIAccess*, ExecutionContext*);
31 void reject(DOMError*, ExecutionContext*);
34 MIDIAccessResolver(PassRefPtr<ScriptPromiseResolver>, v8::Isolate*);
36 RefPtr<ScriptPromiseResolver> m_resolver;
37 RefPtr<DOMWrapperWorld> m_world;
40 } // namespace WebCore
42 #endif // #ifndef MIDIAccessResolver_h