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