| Index: Source/modules/webmidi/MIDIAccess.h
|
| diff --git a/Source/modules/webmidi/MIDIAccess.h b/Source/modules/webmidi/MIDIAccess.h
|
| index df3f7c1021e7a73d683a778a9196a1a926435270..a683b042b0839a19bd7010bf426a8e1455fe88f7 100644
|
| --- a/Source/modules/webmidi/MIDIAccess.h
|
| +++ b/Source/modules/webmidi/MIDIAccess.h
|
| @@ -31,8 +31,6 @@
|
| #ifndef MIDIAccess_h
|
| #define MIDIAccess_h
|
|
|
| -#include "bindings/v8/MIDIAccessResolver.h"
|
| -#include "bindings/v8/ScriptPromise.h"
|
| #include "bindings/v8/ScriptWrappable.h"
|
| #include "core/dom/ActiveDOMObject.h"
|
| #include "core/events/EventTarget.h"
|
| @@ -40,23 +38,21 @@
|
| #include "modules/webmidi/MIDIAccessor.h"
|
| #include "modules/webmidi/MIDIAccessorClient.h"
|
| #include "modules/webmidi/MIDIInput.h"
|
| -#include "modules/webmidi/MIDIOptions.h"
|
| #include "modules/webmidi/MIDIOutput.h"
|
| -#include "platform/AsyncMethodRunner.h"
|
| #include "wtf/RefCounted.h"
|
| #include "wtf/RefPtr.h"
|
| -#include "wtf/WeakPtr.h"
|
| +#include "wtf/Vector.h"
|
|
|
| namespace WebCore {
|
|
|
| class ExecutionContext;
|
| +class MIDIAccessPromise;
|
|
|
| class MIDIAccess FINAL : public RefCountedWillBeRefCountedGarbageCollected<MIDIAccess>, public ScriptWrappable, public ActiveDOMObject, public EventTargetWithInlineData, public MIDIAccessorClient {
|
| DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<MIDIAccess>);
|
| public:
|
| virtual ~MIDIAccess();
|
| - // Returns a promise object that will be resolved with this MIDIAccess.
|
| - static ScriptPromise request(const MIDIOptions&, ExecutionContext*);
|
| + static PassRefPtrWillBeRawPtr<MIDIAccess> create(ExecutionContext*, MIDIAccessPromise*);
|
|
|
| MIDIInputVector inputs() const { return m_inputs; }
|
| MIDIOutputVector outputs() const { return m_outputs; }
|
| @@ -72,10 +68,7 @@
|
| virtual ExecutionContext* executionContext() const OVERRIDE { return ActiveDOMObject::executionContext(); }
|
|
|
| // ActiveDOMObject
|
| - virtual void suspend() OVERRIDE;
|
| - virtual void resume() OVERRIDE;
|
| virtual void stop() OVERRIDE;
|
| - virtual bool hasPendingActivity() const OVERRIDE;
|
|
|
| // MIDIAccessorClient
|
| virtual void didAddInputPort(const String& id, const String& manufacturer, const String& name, const String& version) OVERRIDE;
|
| @@ -89,36 +82,19 @@
|
| void trace(Visitor*);
|
|
|
| private:
|
| - class PostAction;
|
| - enum State {
|
| - Requesting,
|
| - Resolved,
|
| - Stopped,
|
| - };
|
| + MIDIAccess(ExecutionContext*, MIDIAccessPromise*);
|
|
|
| - MIDIAccess(const MIDIOptions&, ExecutionContext*);
|
| - ScriptPromise startRequest();
|
| -
|
| + void startRequest();
|
| void permissionDenied();
|
|
|
| - void resolve();
|
| - void reject(PassRefPtr<DOMError>);
|
| - void resolveNow();
|
| - void rejectNow();
|
| - // Called when the promise is resolved or rejected.
|
| - void doPostAction(State);
|
| -
|
| - State m_state;
|
| - WeakPtrFactory<MIDIAccess> m_weakPtrFactory;
|
| MIDIInputVector m_inputs;
|
| MIDIOutputVector m_outputs;
|
| + RawPtrWillBeMember<MIDIAccessPromise> m_promise;
|
| +
|
| OwnPtr<MIDIAccessor> m_accessor;
|
| - OwnPtr<MIDIAccessResolver> m_resolver;
|
| - MIDIOptions m_options;
|
| + bool m_hasAccess;
|
| bool m_sysExEnabled;
|
| - AsyncMethodRunner<MIDIAccess> m_asyncResolveRunner;
|
| - AsyncMethodRunner<MIDIAccess> m_asyncRejectRunner;
|
| - RefPtr<DOMError> m_error;
|
| + bool m_requesting;
|
| };
|
|
|
| } // namespace WebCore
|
|
|