| 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 19 matching lines...) Expand all Loading... |
| 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/ScriptPromise.h" | 34 #include "bindings/core/v8/ScriptPromise.h" |
| 35 #include "core/dom/ActiveDOMObject.h" | 35 #include "core/dom/ActiveDOMObject.h" |
| 36 #include "modules/EventTargetModules.h" | 36 #include "modules/EventTargetModules.h" |
| 37 #include "modules/webmidi/MIDIAccessInitializer.h" | 37 #include "modules/webmidi/MIDIAccessInitializer.h" |
| 38 #include "modules/webmidi/MIDIAccessor.h" | 38 #include "modules/webmidi/MIDIAccessor.h" |
| 39 #include "modules/webmidi/MIDIAccessorClient.h" | 39 #include "modules/webmidi/MIDIAccessorClient.h" |
| 40 #include "modules/webmidi/MIDIInput.h" | |
| 41 #include "modules/webmidi/MIDIOutput.h" | |
| 42 #include "platform/heap/Handle.h" | 40 #include "platform/heap/Handle.h" |
| 43 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
| 44 | 42 |
| 45 namespace blink { | 43 namespace blink { |
| 46 | 44 |
| 47 class ExecutionContext; | 45 class ExecutionContext; |
| 46 class MIDIInputMap; |
| 47 class MIDIOutputMap; |
| 48 struct MIDIOptions; | 48 struct MIDIOptions; |
| 49 | 49 |
| 50 class MIDIAccess FINAL : public RefCountedGarbageCollectedWillBeGarbageCollected
Finalized<MIDIAccess>, public ActiveDOMObject, public EventTargetWithInlineData,
public MIDIAccessorClient { | 50 class MIDIAccess FINAL : public RefCountedGarbageCollectedWillBeGarbageCollected
Finalized<MIDIAccess>, public ActiveDOMObject, public EventTargetWithInlineData,
public MIDIAccessorClient { |
| 51 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<M
IDIAccess>); | 51 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<M
IDIAccess>); |
| 52 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MIDIAccess); | 52 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MIDIAccess); |
| 53 public: | 53 public: |
| 54 static MIDIAccess* create(PassOwnPtr<MIDIAccessor> accessor, bool sysexEnabl
ed, const Vector<MIDIAccessInitializer::PortDescriptor>& ports, ExecutionContext
* executionContext) | 54 static MIDIAccess* create(PassOwnPtr<MIDIAccessor> accessor, bool sysexEnabl
ed, const Vector<MIDIAccessInitializer::PortDescriptor>& ports, ExecutionContext
* executionContext) |
| 55 { | 55 { |
| 56 MIDIAccess* access = new MIDIAccess(accessor, sysexEnabled, ports, execu
tionContext); | 56 MIDIAccess* access = new MIDIAccess(accessor, sysexEnabled, ports, execu
tionContext); |
| 57 access->suspendIfNeeded(); | 57 access->suspendIfNeeded(); |
| 58 return access; | 58 return access; |
| 59 } | 59 } |
| 60 virtual ~MIDIAccess(); | 60 virtual ~MIDIAccess(); |
| 61 | 61 |
| 62 MIDIInputVector inputs() const { return m_inputs; } | 62 MIDIInputMap* inputs() const { return m_inputs; } |
| 63 MIDIOutputVector outputs() const { return m_outputs; } | 63 MIDIOutputMap* outputs() const { return m_outputs; } |
| 64 | 64 |
| 65 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); | 65 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); |
| 66 DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect); | 66 DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect); |
| 67 | 67 |
| 68 bool sysexEnabled() const { return m_sysexEnabled; } | 68 bool sysexEnabled() const { return m_sysexEnabled; } |
| 69 | 69 |
| 70 // EventTarget | 70 // EventTarget |
| 71 virtual const AtomicString& interfaceName() const OVERRIDE { return EventTar
getNames::MIDIAccess; } | 71 virtual const AtomicString& interfaceName() const OVERRIDE { return EventTar
getNames::MIDIAccess; } |
| 72 virtual ExecutionContext* executionContext() const OVERRIDE { return ActiveD
OMObject::executionContext(); } | 72 virtual ExecutionContext* executionContext() const OVERRIDE { return ActiveD
OMObject::executionContext(); } |
| 73 | 73 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 88 // |timeStampInMilliseconds| is in the same time coordinate system as perfor
mance.now(). | 88 // |timeStampInMilliseconds| is in the same time coordinate system as perfor
mance.now(). |
| 89 void sendMIDIData(unsigned portIndex, const unsigned char* data, size_t leng
th, double timeStampInMilliseconds); | 89 void sendMIDIData(unsigned portIndex, const unsigned char* data, size_t leng
th, double timeStampInMilliseconds); |
| 90 | 90 |
| 91 virtual void trace(Visitor*) OVERRIDE; | 91 virtual void trace(Visitor*) OVERRIDE; |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 MIDIAccess(PassOwnPtr<MIDIAccessor>, bool sysexEnabled, const Vector<MIDIAcc
essInitializer::PortDescriptor>&, ExecutionContext*); | 94 MIDIAccess(PassOwnPtr<MIDIAccessor>, bool sysexEnabled, const Vector<MIDIAcc
essInitializer::PortDescriptor>&, ExecutionContext*); |
| 95 | 95 |
| 96 OwnPtr<MIDIAccessor> m_accessor; | 96 OwnPtr<MIDIAccessor> m_accessor; |
| 97 bool m_sysexEnabled; | 97 bool m_sysexEnabled; |
| 98 MIDIInputVector m_inputs; | 98 Vector<String> m_inputKeys; |
| 99 MIDIOutputVector m_outputs; | 99 Member<MIDIInputMap> m_inputs; |
| 100 Member<MIDIOutputMap> m_outputs; |
| 100 }; | 101 }; |
| 101 | 102 |
| 102 } // namespace blink | 103 } // namespace blink |
| 103 | 104 |
| 104 #endif // MIDIAccess_h | 105 #endif // MIDIAccess_h |
| OLD | NEW |