Index: Source/modules/webmidi/MIDIAccess.h |
diff --git a/Source/modules/webmidi/MIDIAccess.h b/Source/modules/webmidi/MIDIAccess.h |
index 9f6aaaf0c853e22c63c7242311dbb0c1e48aa189..1bdde313fd90d6cb8da62f0e26c931ecdaa50006 100644 |
--- a/Source/modules/webmidi/MIDIAccess.h |
+++ b/Source/modules/webmidi/MIDIAccess.h |
@@ -31,12 +31,16 @@ |
#ifndef MIDIAccess_h |
#define MIDIAccess_h |
+#include "bindings/v8/DOMRequestState.h" |
+#include "bindings/v8/ScriptPromise.h" |
+#include "bindings/v8/ScriptPromiseResolver.h" |
#include "bindings/v8/ScriptWrappable.h" |
#include "core/dom/ActiveDOMObject.h" |
#include "core/events/EventTarget.h" |
#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 "wtf/RefCounted.h" |
#include "wtf/RefPtr.h" |
@@ -45,13 +49,13 @@ |
namespace WebCore { |
class ExecutionContext; |
-class MIDIAccessPromise; |
+class NavigatorWebMIDI; |
class MIDIAccess : public RefCounted<MIDIAccess>, public ScriptWrappable, public ActiveDOMObject, public EventTargetWithInlineData, public MIDIAccessorClient { |
REFCOUNTED_EVENT_TARGET(MIDIAccess); |
public: |
virtual ~MIDIAccess(); |
- static PassRefPtr<MIDIAccess> create(ExecutionContext*, MIDIAccessPromise*); |
+ static PassRefPtr<MIDIAccess> create(const MIDIOptions&, ExecutionContext*, NavigatorWebMIDI*); |
MIDIInputVector inputs() const { return m_inputs; } |
MIDIOutputVector outputs() const { return m_outputs; } |
@@ -78,17 +82,31 @@ public: |
// |timeStampInMilliseconds| is in the same time coordinate system as performance.now(). |
void sendMIDIData(unsigned portIndex, const unsigned char* data, size_t length, double timeStampInMilliseconds); |
+ ScriptPromise startRequest(); |
+ |
private: |
- MIDIAccess(ExecutionContext*, MIDIAccessPromise*); |
+ MIDIAccess(const MIDIOptions&, ExecutionContext*, NavigatorWebMIDI*); |
- void startRequest(); |
virtual void permissionDenied(); |
+ // This method can delete |this| object. |
+ void resolve(); |
+ // This method can delete |this| object. |
+ void reject(PassRefPtr<DOMError>); |
+ |
+ // A NavigatorWebMIDI holds this MIDIAccess object as long as it is |
+ // a PENDING state. Once the request succeeds or fails this object |
+ // deregister itself from the navigator object. |
+ // the navigator will call |stop| method when it goes invalid |
+ // and then |m_navigator| will be cleard. |
+ NavigatorWebMIDI* m_navigator; |
MIDIInputVector m_inputs; |
MIDIOutputVector m_outputs; |
- MIDIAccessPromise* m_promise; |
OwnPtr<MIDIAccessor> m_accessor; |
+ DOMRequestState m_requestState; |
abarth-chromium
2013/12/04 06:05:14
DOMRequestState isn't designed to be held in the h
yhirano
2013/12/05 08:19:12
Done.
MIDIAccessor now stores a DOMWrapperWorld.
|
+ RefPtr<ScriptPromiseResolver> m_resolver; |
+ MIDIOptions m_options; |
bool m_hasAccess; |
bool m_sysExEnabled; |
bool m_requesting; |