Chromium Code Reviews| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 class ExecutionContext; | 46 class ExecutionContext; |
| 47 class MIDIInput; | 47 class MIDIInput; |
| 48 class MIDIInputMap; | 48 class MIDIInputMap; |
| 49 class MIDIOutput; | 49 class MIDIOutput; |
| 50 class MIDIOutputMap; | 50 class MIDIOutputMap; |
| 51 | 51 |
| 52 class MIDIAccess final : public RefCountedGarbageCollectedEventTargetWithInlineD ata<MIDIAccess>, public ActiveScriptWrappable, public ActiveDOMObject, public MI DIAccessorClient { | 52 class MIDIAccess final : public RefCountedGarbageCollectedEventTargetWithInlineD ata<MIDIAccess>, public ActiveScriptWrappable, public ActiveDOMObject, public MI DIAccessorClient { |
| 53 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(MIDIAccess); | 53 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(MIDIAccess); |
| 54 DEFINE_WRAPPERTYPEINFO(); | 54 DEFINE_WRAPPERTYPEINFO(); |
| 55 USING_GARBAGE_COLLECTED_MIXIN(MIDIAccess); | 55 USING_GARBAGE_COLLECTED_MIXIN(MIDIAccess); |
| 56 USING_PRE_FINALIZER(MIDIAccess, dispose); | |
| 56 public: | 57 public: |
| 57 static MIDIAccess* create(PassOwnPtr<MIDIAccessor> accessor, bool sysexEnabl ed, const Vector<MIDIAccessInitializer::PortDescriptor>& ports, ExecutionContext * executionContext) | 58 static MIDIAccess* create(PassOwnPtr<MIDIAccessor> accessor, bool sysexEnabl ed, const Vector<MIDIAccessInitializer::PortDescriptor>& ports, ExecutionContext * executionContext) |
| 58 { | 59 { |
| 59 MIDIAccess* access = new MIDIAccess(accessor, sysexEnabled, ports, execu tionContext); | 60 MIDIAccess* access = new MIDIAccess(accessor, sysexEnabled, ports, execu tionContext); |
| 60 access->suspendIfNeeded(); | 61 access->suspendIfNeeded(); |
| 61 return access; | 62 return access; |
| 62 } | 63 } |
| 63 ~MIDIAccess() override; | 64 ~MIDIAccess() override; |
| 64 | 65 |
| 65 MIDIInputMap* inputs() const; | 66 MIDIInputMap* inputs() const; |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 89 { | 90 { |
| 90 // This method is for MIDIAccess initialization: MIDIAccessInitializer | 91 // This method is for MIDIAccess initialization: MIDIAccessInitializer |
| 91 // has the implementation. | 92 // has the implementation. |
| 92 ASSERT_NOT_REACHED(); | 93 ASSERT_NOT_REACHED(); |
| 93 } | 94 } |
| 94 void didReceiveMIDIData(unsigned portIndex, const unsigned char* data, size_ t length, double timeStamp) override; | 95 void didReceiveMIDIData(unsigned portIndex, const unsigned char* data, size_ t length, double timeStamp) override; |
| 95 | 96 |
| 96 // |timeStampInMilliseconds| is in the same time coordinate system as perfor mance.now(). | 97 // |timeStampInMilliseconds| is in the same time coordinate system as perfor mance.now(). |
| 97 void sendMIDIData(unsigned portIndex, const unsigned char* data, size_t leng th, double timeStampInMilliseconds); | 98 void sendMIDIData(unsigned portIndex, const unsigned char* data, size_t leng th, double timeStampInMilliseconds); |
| 98 | 99 |
| 99 // Eager finalization needed to promptly release m_accessor. Otherwise | 100 // Eager finalization needed to promptly release m_accessor. Otherwise |
|
sof
2016/04/11 06:23:32
Move this comment down next to dispose() also?
| |
| 100 // its client back reference could end up being unsafely used during | 101 // its client back reference could end up being unsafely used during |
| 101 // the lazy sweeping phase. | 102 // the lazy sweeping phase. |
| 102 EAGERLY_FINALIZE(); | |
| 103 DECLARE_VIRTUAL_TRACE(); | 103 DECLARE_VIRTUAL_TRACE(); |
| 104 | 104 |
| 105 private: | 105 private: |
| 106 MIDIAccess(PassOwnPtr<MIDIAccessor>, bool sysexEnabled, const Vector<MIDIAcc essInitializer::PortDescriptor>&, ExecutionContext*); | 106 MIDIAccess(PassOwnPtr<MIDIAccessor>, bool sysexEnabled, const Vector<MIDIAcc essInitializer::PortDescriptor>&, ExecutionContext*); |
| 107 void dispose(); | |
| 107 | 108 |
| 108 OwnPtr<MIDIAccessor> m_accessor; | 109 OwnPtr<MIDIAccessor> m_accessor; |
| 109 bool m_sysexEnabled; | 110 bool m_sysexEnabled; |
| 110 bool m_hasPendingActivity; | 111 bool m_hasPendingActivity; |
| 111 HeapVector<Member<MIDIInput>> m_inputs; | 112 HeapVector<Member<MIDIInput>> m_inputs; |
| 112 HeapVector<Member<MIDIOutput>> m_outputs; | 113 HeapVector<Member<MIDIOutput>> m_outputs; |
| 113 }; | 114 }; |
| 114 | 115 |
| 115 } // namespace blink | 116 } // namespace blink |
| 116 | 117 |
| 117 #endif // MIDIAccess_h | 118 #endif // MIDIAccess_h |
| OLD | NEW |