#ifndef MIDIAccessResolver_h
#define MIDIAccessResolver_h
#include "bindings/v8/ScriptPromiseResolver.h"
#include "wtf/OwnPtr.h"
#include "wtf/RefCounted.h"
namespace WebCore {
class DOMError;
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<NewScriptState> m_scriptState;
};
}
#endif