Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MIDIAccessInitializer_h | 5 #ifndef MIDIAccessInitializer_h |
| 6 #define MIDIAccessInitializer_h | 6 #define MIDIAccessInitializer_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "modules/webmidi/MIDIAccessor.h" | 10 #include "modules/webmidi/MIDIAccessor.h" |
| 11 #include "modules/webmidi/MIDIAccessorClient.h" | 11 #include "modules/webmidi/MIDIAccessorClient.h" |
| 12 #include "modules/webmidi/MIDIPort.h" | 12 #include "modules/webmidi/MIDIPort.h" |
| 13 #include "wtf/OwnPtr.h" | 13 #include "wtf/OwnPtr.h" |
| 14 #include "wtf/Vector.h" | 14 #include "wtf/Vector.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 class MIDIOptions; | 18 class MIDIOptions; |
| 19 class ScriptState; | 19 class ScriptState; |
| 20 | 20 |
| 21 class MIDIAccessInitializer : public ScriptPromiseResolver, public MIDIAccessorC lient { | 21 class MIDIAccessInitializer : public ScriptPromiseResolver, public MIDIAccessorC lient { |
| 22 #if ENABLE(OILPAN) | |
| 23 USING_PRE_FINALIZER(MIDIAccessInitializer, dispose); | |
|
haraken
2014/12/19 03:47:16
Just to confirm: The reason we cannot use WeakMemb
| |
| 24 #endif | |
| 22 public: | 25 public: |
| 23 struct PortDescriptor { | 26 struct PortDescriptor { |
| 24 String id; | 27 String id; |
| 25 String manufacturer; | 28 String manufacturer; |
| 26 String name; | 29 String name; |
| 27 MIDIPort::MIDIPortTypeCode type; | 30 MIDIPort::MIDIPortTypeCode type; |
| 28 String version; | 31 String version; |
| 29 bool isActive; | 32 bool isActive; |
| 30 | 33 |
| 31 PortDescriptor(const String& id, const String& manufacturer, const Strin g& name, MIDIPort::MIDIPortTypeCode type, const String& version, bool isActive) | 34 PortDescriptor(const String& id, const String& manufacturer, const Strin g& name, MIDIPort::MIDIPortTypeCode type, const String& version, bool isActive) |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 52 virtual void didAddOutputPort(const String& id, const String& manufacturer, const String& name, const String& version, bool isActive) override; | 55 virtual void didAddOutputPort(const String& id, const String& manufacturer, const String& name, const String& version, bool isActive) override; |
| 53 virtual void didSetInputPortState(unsigned portIndex, bool isActive) overrid e; | 56 virtual void didSetInputPortState(unsigned portIndex, bool isActive) overrid e; |
| 54 virtual void didSetOutputPortState(unsigned portIndex, bool isActive) overri de; | 57 virtual void didSetOutputPortState(unsigned portIndex, bool isActive) overri de; |
| 55 virtual void didStartSession(bool success, const String& error, const String & message) override; | 58 virtual void didStartSession(bool success, const String& error, const String & message) override; |
| 56 virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* dat a, size_t length, double timeStamp) override { } | 59 virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* dat a, size_t length, double timeStamp) override { } |
| 57 | 60 |
| 58 void resolveSysexPermission(bool allowed); | 61 void resolveSysexPermission(bool allowed); |
| 59 SecurityOrigin* securityOrigin() const; | 62 SecurityOrigin* securityOrigin() const; |
| 60 | 63 |
| 61 private: | 64 private: |
| 62 ScriptPromise start(); | |
| 63 | |
| 64 MIDIAccessInitializer(ScriptState*, const MIDIOptions&); | 65 MIDIAccessInitializer(ScriptState*, const MIDIOptions&); |
| 65 | 66 |
| 66 ExecutionContext* executionContext() const; | 67 ExecutionContext* executionContext() const; |
| 68 ScriptPromise start(); | |
| 69 void dispose(); | |
| 67 | 70 |
| 68 OwnPtr<MIDIAccessor> m_accessor; | 71 OwnPtr<MIDIAccessor> m_accessor; |
| 72 Vector<PortDescriptor> m_portDescriptors; | |
| 69 bool m_requestSysex; | 73 bool m_requestSysex; |
| 70 Vector<PortDescriptor> m_portDescriptors; | |
| 71 }; | 74 }; |
| 72 | 75 |
| 73 } // namespace blink | 76 } // namespace blink |
| 74 | 77 |
| 75 | 78 |
| 76 #endif // MIDIAccessInitializer_h | 79 #endif // MIDIAccessInitializer_h |
| OLD | NEW |