| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef MIDIAccess_h | 31 #ifndef MIDIAccess_h |
| 32 #define MIDIAccess_h | 32 #define MIDIAccess_h |
| 33 | 33 |
| 34 #include "bindings/core/v8/ActiveScriptWrappable.h" | 34 #include "bindings/core/v8/ActiveScriptWrappable.h" |
| 35 #include "bindings/core/v8/ScriptPromise.h" | 35 #include "bindings/core/v8/ScriptPromise.h" |
| 36 #include "core/dom/ActiveDOMObject.h" | 36 #include "core/dom/SuspendableObject.h" |
| 37 #include "media/midi/midi_service.mojom-blink.h" | 37 #include "media/midi/midi_service.mojom-blink.h" |
| 38 #include "modules/EventTargetModules.h" | 38 #include "modules/EventTargetModules.h" |
| 39 #include "modules/webmidi/MIDIAccessInitializer.h" | 39 #include "modules/webmidi/MIDIAccessInitializer.h" |
| 40 #include "modules/webmidi/MIDIAccessor.h" | 40 #include "modules/webmidi/MIDIAccessor.h" |
| 41 #include "modules/webmidi/MIDIAccessorClient.h" | 41 #include "modules/webmidi/MIDIAccessorClient.h" |
| 42 #include "platform/heap/Handle.h" | 42 #include "platform/heap/Handle.h" |
| 43 #include "wtf/Vector.h" | 43 #include "wtf/Vector.h" |
| 44 #include <memory> | 44 #include <memory> |
| 45 | 45 |
| 46 namespace blink { | 46 namespace blink { |
| 47 | 47 |
| 48 class ExecutionContext; | 48 class ExecutionContext; |
| 49 class MIDIInput; | 49 class MIDIInput; |
| 50 class MIDIInputMap; | 50 class MIDIInputMap; |
| 51 class MIDIOutput; | 51 class MIDIOutput; |
| 52 class MIDIOutputMap; | 52 class MIDIOutputMap; |
| 53 | 53 |
| 54 class MIDIAccess final : public EventTargetWithInlineData, | 54 class MIDIAccess final : public EventTargetWithInlineData, |
| 55 public ActiveScriptWrappable, | 55 public ActiveScriptWrappable, |
| 56 public ActiveDOMObject, | 56 public SuspendableObject, |
| 57 public MIDIAccessorClient { | 57 public MIDIAccessorClient { |
| 58 DEFINE_WRAPPERTYPEINFO(); | 58 DEFINE_WRAPPERTYPEINFO(); |
| 59 USING_GARBAGE_COLLECTED_MIXIN(MIDIAccess); | 59 USING_GARBAGE_COLLECTED_MIXIN(MIDIAccess); |
| 60 USING_PRE_FINALIZER(MIDIAccess, dispose); | 60 USING_PRE_FINALIZER(MIDIAccess, dispose); |
| 61 | 61 |
| 62 public: | 62 public: |
| 63 static MIDIAccess* create( | 63 static MIDIAccess* create( |
| 64 std::unique_ptr<MIDIAccessor> accessor, | 64 std::unique_ptr<MIDIAccessor> accessor, |
| 65 bool sysexEnabled, | 65 bool sysexEnabled, |
| 66 const Vector<MIDIAccessInitializer::PortDescriptor>& ports, | 66 const Vector<MIDIAccessInitializer::PortDescriptor>& ports, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 78 EventListener* onstatechange(); | 78 EventListener* onstatechange(); |
| 79 void setOnstatechange(EventListener*); | 79 void setOnstatechange(EventListener*); |
| 80 | 80 |
| 81 bool sysexEnabled() const { return m_sysexEnabled; } | 81 bool sysexEnabled() const { return m_sysexEnabled; } |
| 82 | 82 |
| 83 // EventTarget | 83 // EventTarget |
| 84 const AtomicString& interfaceName() const override { | 84 const AtomicString& interfaceName() const override { |
| 85 return EventTargetNames::MIDIAccess; | 85 return EventTargetNames::MIDIAccess; |
| 86 } | 86 } |
| 87 ExecutionContext* getExecutionContext() const override { | 87 ExecutionContext* getExecutionContext() const override { |
| 88 return ActiveDOMObject::getExecutionContext(); | 88 return SuspendableObject::getExecutionContext(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 // ScriptWrappable | 91 // ScriptWrappable |
| 92 bool hasPendingActivity() const final; | 92 bool hasPendingActivity() const final; |
| 93 | 93 |
| 94 // ActiveDOMObject | 94 // SuspendableObject |
| 95 void contextDestroyed() override; | 95 void contextDestroyed() override; |
| 96 | 96 |
| 97 // MIDIAccessorClient | 97 // MIDIAccessorClient |
| 98 void didAddInputPort(const String& id, | 98 void didAddInputPort(const String& id, |
| 99 const String& manufacturer, | 99 const String& manufacturer, |
| 100 const String& name, | 100 const String& name, |
| 101 const String& version, | 101 const String& version, |
| 102 midi::mojom::PortState) override; | 102 midi::mojom::PortState) override; |
| 103 void didAddOutputPort(const String& id, | 103 void didAddOutputPort(const String& id, |
| 104 const String& manufacturer, | 104 const String& manufacturer, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 std::unique_ptr<MIDIAccessor> m_accessor; | 141 std::unique_ptr<MIDIAccessor> m_accessor; |
| 142 bool m_sysexEnabled; | 142 bool m_sysexEnabled; |
| 143 bool m_hasPendingActivity; | 143 bool m_hasPendingActivity; |
| 144 HeapVector<Member<MIDIInput>> m_inputs; | 144 HeapVector<Member<MIDIInput>> m_inputs; |
| 145 HeapVector<Member<MIDIOutput>> m_outputs; | 145 HeapVector<Member<MIDIOutput>> m_outputs; |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 } // namespace blink | 148 } // namespace blink |
| 149 | 149 |
| 150 #endif // MIDIAccess_h | 150 #endif // MIDIAccess_h |
| OLD | NEW |