| 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 30 matching lines...) Expand all Loading... |
| 41 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
| 42 | 42 |
| 43 namespace blink { | 43 namespace blink { |
| 44 | 44 |
| 45 class ExecutionContext; | 45 class ExecutionContext; |
| 46 class MIDIInput; | 46 class MIDIInput; |
| 47 class MIDIInputMap; | 47 class MIDIInputMap; |
| 48 class MIDIOutput; | 48 class MIDIOutput; |
| 49 class MIDIOutputMap; | 49 class MIDIOutputMap; |
| 50 | 50 |
| 51 class MIDIAccess FINAL : public RefCountedGarbageCollectedWillBeGarbageCollected
Finalized<MIDIAccess>, public ActiveDOMObject, public EventTargetWithInlineData,
public MIDIAccessorClient { | 51 class MIDIAccess final : public RefCountedGarbageCollectedWillBeGarbageCollected
Finalized<MIDIAccess>, public ActiveDOMObject, public EventTargetWithInlineData,
public MIDIAccessorClient { |
| 52 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<M
IDIAccess>); | 52 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<M
IDIAccess>); |
| 53 DEFINE_WRAPPERTYPEINFO(); | 53 DEFINE_WRAPPERTYPEINFO(); |
| 54 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MIDIAccess); | 54 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MIDIAccess); |
| 55 public: | 55 public: |
| 56 static MIDIAccess* create(PassOwnPtr<MIDIAccessor> accessor, bool sysexEnabl
ed, const Vector<MIDIAccessInitializer::PortDescriptor>& ports, ExecutionContext
* executionContext) | 56 static MIDIAccess* create(PassOwnPtr<MIDIAccessor> accessor, bool sysexEnabl
ed, const Vector<MIDIAccessInitializer::PortDescriptor>& ports, ExecutionContext
* executionContext) |
| 57 { | 57 { |
| 58 MIDIAccess* access = adoptRefCountedGarbageCollectedWillBeNoop(new MIDIA
ccess(accessor, sysexEnabled, ports, executionContext)); | 58 MIDIAccess* access = adoptRefCountedGarbageCollectedWillBeNoop(new MIDIA
ccess(accessor, sysexEnabled, ports, executionContext)); |
| 59 access->suspendIfNeeded(); | 59 access->suspendIfNeeded(); |
| 60 return access; | 60 return access; |
| 61 } | 61 } |
| 62 virtual ~MIDIAccess(); | 62 virtual ~MIDIAccess(); |
| 63 | 63 |
| 64 MIDIInputMap* inputs() const; | 64 MIDIInputMap* inputs() const; |
| 65 MIDIOutputMap* outputs() const; | 65 MIDIOutputMap* outputs() const; |
| 66 | 66 |
| 67 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); | 67 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); |
| 68 DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect); | 68 DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect); |
| 69 | 69 |
| 70 bool sysexEnabled() const { return m_sysexEnabled; } | 70 bool sysexEnabled() const { return m_sysexEnabled; } |
| 71 | 71 |
| 72 // EventTarget | 72 // EventTarget |
| 73 virtual const AtomicString& interfaceName() const OVERRIDE { return EventTar
getNames::MIDIAccess; } | 73 virtual const AtomicString& interfaceName() const override { return EventTar
getNames::MIDIAccess; } |
| 74 virtual ExecutionContext* executionContext() const OVERRIDE { return ActiveD
OMObject::executionContext(); } | 74 virtual ExecutionContext* executionContext() const override { return ActiveD
OMObject::executionContext(); } |
| 75 | 75 |
| 76 // ActiveDOMObject | 76 // ActiveDOMObject |
| 77 virtual void stop() OVERRIDE; | 77 virtual void stop() override; |
| 78 | 78 |
| 79 // MIDIAccessorClient | 79 // MIDIAccessorClient |
| 80 virtual void didAddInputPort(const String& id, const String& manufacturer, c
onst String& name, const String& version) OVERRIDE; | 80 virtual void didAddInputPort(const String& id, const String& manufacturer, c
onst String& name, const String& version) override; |
| 81 virtual void didAddOutputPort(const String& id, const String& manufacturer,
const String& name, const String& version) OVERRIDE; | 81 virtual void didAddOutputPort(const String& id, const String& manufacturer,
const String& name, const String& version) override; |
| 82 virtual void didStartSession(bool success, const String& error, const String
& message) OVERRIDE | 82 virtual void didStartSession(bool success, const String& error, const String
& message) override |
| 83 { | 83 { |
| 84 // This method is for MIDIAccess initialization: MIDIAccessInitializer | 84 // This method is for MIDIAccess initialization: MIDIAccessInitializer |
| 85 // has the implementation. | 85 // has the implementation. |
| 86 ASSERT_NOT_REACHED(); | 86 ASSERT_NOT_REACHED(); |
| 87 } | 87 } |
| 88 virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* dat
a, size_t length, double timeStamp) OVERRIDE; | 88 virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* dat
a, size_t length, double timeStamp) override; |
| 89 | 89 |
| 90 // |timeStampInMilliseconds| is in the same time coordinate system as perfor
mance.now(). | 90 // |timeStampInMilliseconds| is in the same time coordinate system as perfor
mance.now(). |
| 91 void sendMIDIData(unsigned portIndex, const unsigned char* data, size_t leng
th, double timeStampInMilliseconds); | 91 void sendMIDIData(unsigned portIndex, const unsigned char* data, size_t leng
th, double timeStampInMilliseconds); |
| 92 | 92 |
| 93 virtual void trace(Visitor*) OVERRIDE; | 93 virtual void trace(Visitor*) override; |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 MIDIAccess(PassOwnPtr<MIDIAccessor>, bool sysexEnabled, const Vector<MIDIAcc
essInitializer::PortDescriptor>&, ExecutionContext*); | 96 MIDIAccess(PassOwnPtr<MIDIAccessor>, bool sysexEnabled, const Vector<MIDIAcc
essInitializer::PortDescriptor>&, ExecutionContext*); |
| 97 | 97 |
| 98 OwnPtr<MIDIAccessor> m_accessor; | 98 OwnPtr<MIDIAccessor> m_accessor; |
| 99 bool m_sysexEnabled; | 99 bool m_sysexEnabled; |
| 100 HeapVector<Member<MIDIInput> > m_inputs; | 100 HeapVector<Member<MIDIInput> > m_inputs; |
| 101 HeapVector<Member<MIDIOutput> > m_outputs; | 101 HeapVector<Member<MIDIOutput> > m_outputs; |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 } // namespace blink | 104 } // namespace blink |
| 105 | 105 |
| 106 #endif // MIDIAccess_h | 106 #endif // MIDIAccess_h |
| OLD | NEW |