| 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 16 matching lines...) Expand all Loading... |
| 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 SourceBuffer_h | 31 #ifndef SourceBuffer_h |
| 32 #define SourceBuffer_h | 32 #define SourceBuffer_h |
| 33 | 33 |
| 34 #include "bindings/v8/ScriptWrappable.h" | 34 #include "bindings/v8/ScriptWrappable.h" |
| 35 #include "core/dom/ActiveDOMObject.h" | 35 #include "core/dom/ActiveDOMObject.h" |
| 36 #include "core/dom/EventTarget.h" | 36 #include "core/dom/EventTarget.h" |
| 37 #include "core/dom/ExceptionCode.h" |
| 37 #include "core/platform/Timer.h" | 38 #include "core/platform/Timer.h" |
| 38 #include "wtf/PassRefPtr.h" | 39 #include "wtf/PassRefPtr.h" |
| 39 #include "wtf/RefCounted.h" | 40 #include "wtf/RefCounted.h" |
| 40 #include "wtf/text/WTFString.h" | 41 #include "wtf/text/WTFString.h" |
| 41 | 42 |
| 42 namespace WebCore { | 43 namespace WebCore { |
| 43 | |
| 44 class ExceptionState; | |
| 45 class GenericEventQueue; | 44 class GenericEventQueue; |
| 46 class MediaSource; | 45 class MediaSource; |
| 47 class SourceBufferPrivate; | 46 class SourceBufferPrivate; |
| 48 class TimeRanges; | 47 class TimeRanges; |
| 49 | 48 |
| 50 class SourceBuffer : public RefCounted<SourceBuffer>, public ActiveDOMObject, pu
blic EventTarget, public ScriptWrappable { | 49 class SourceBuffer : public RefCounted<SourceBuffer>, public ActiveDOMObject, pu
blic EventTarget, public ScriptWrappable { |
| 51 public: | 50 public: |
| 52 static PassRefPtr<SourceBuffer> create(PassOwnPtr<SourceBufferPrivate>, Medi
aSource*, GenericEventQueue*); | 51 static PassRefPtr<SourceBuffer> create(PassOwnPtr<SourceBufferPrivate>, Medi
aSource*, GenericEventQueue*); |
| 53 | 52 |
| 54 virtual ~SourceBuffer(); | 53 virtual ~SourceBuffer(); |
| 55 | 54 |
| 56 // SourceBuffer.idl methods | 55 // SourceBuffer.idl methods |
| 57 bool updating() const { return m_updating; } | 56 bool updating() const { return m_updating; } |
| 58 PassRefPtr<TimeRanges> buffered(ExceptionState&) const; | 57 PassRefPtr<TimeRanges> buffered(ExceptionCode&) const; |
| 59 double timestampOffset() const; | 58 double timestampOffset() const; |
| 60 void setTimestampOffset(double, ExceptionState&); | 59 void setTimestampOffset(double, ExceptionCode&); |
| 61 void appendBuffer(PassRefPtr<ArrayBuffer> data, ExceptionState&); | 60 void appendBuffer(PassRefPtr<ArrayBuffer> data, ExceptionCode&); |
| 62 void appendBuffer(PassRefPtr<ArrayBufferView> data, ExceptionState&); | 61 void appendBuffer(PassRefPtr<ArrayBufferView> data, ExceptionCode&); |
| 63 void abort(ExceptionState&); | 62 void abort(ExceptionCode&); |
| 64 | 63 |
| 65 void abortIfUpdating(); | 64 void abortIfUpdating(); |
| 66 void removedFromMediaSource(); | 65 void removedFromMediaSource(); |
| 67 | 66 |
| 68 // ActiveDOMObject interface | 67 // ActiveDOMObject interface |
| 69 virtual bool hasPendingActivity() const OVERRIDE; | 68 virtual bool hasPendingActivity() const OVERRIDE; |
| 70 virtual void stop() OVERRIDE; | 69 virtual void stop() OVERRIDE; |
| 71 | 70 |
| 72 // EventTarget interface | 71 // EventTarget interface |
| 73 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE; | 72 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE; |
| 74 virtual const AtomicString& interfaceName() const OVERRIDE; | 73 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 75 | 74 |
| 76 using RefCounted<SourceBuffer>::ref; | 75 using RefCounted<SourceBuffer>::ref; |
| 77 using RefCounted<SourceBuffer>::deref; | 76 using RefCounted<SourceBuffer>::deref; |
| 78 | 77 |
| 79 protected: | 78 protected: |
| 80 // EventTarget interface | 79 // EventTarget interface |
| 81 virtual EventTargetData* eventTargetData() OVERRIDE; | 80 virtual EventTargetData* eventTargetData() OVERRIDE; |
| 82 virtual EventTargetData* ensureEventTargetData() OVERRIDE; | 81 virtual EventTargetData* ensureEventTargetData() OVERRIDE; |
| 83 virtual void refEventTarget() OVERRIDE { ref(); } | 82 virtual void refEventTarget() OVERRIDE { ref(); } |
| 84 virtual void derefEventTarget() OVERRIDE { deref(); } | 83 virtual void derefEventTarget() OVERRIDE { deref(); } |
| 85 | 84 |
| 86 private: | 85 private: |
| 87 SourceBuffer(PassOwnPtr<SourceBufferPrivate>, MediaSource*, GenericEventQueu
e*); | 86 SourceBuffer(PassOwnPtr<SourceBufferPrivate>, MediaSource*, GenericEventQueu
e*); |
| 88 | 87 |
| 89 bool isRemoved() const; | 88 bool isRemoved() const; |
| 90 void scheduleEvent(const AtomicString& eventName); | 89 void scheduleEvent(const AtomicString& eventName); |
| 91 | 90 |
| 92 void appendBufferInternal(unsigned char*, unsigned, ExceptionState&); | 91 void appendBufferInternal(unsigned char*, unsigned, ExceptionCode&); |
| 93 void appendBufferTimerFired(Timer<SourceBuffer>*); | 92 void appendBufferTimerFired(Timer<SourceBuffer>*); |
| 94 | 93 |
| 95 OwnPtr<SourceBufferPrivate> m_private; | 94 OwnPtr<SourceBufferPrivate> m_private; |
| 96 MediaSource* m_source; | 95 MediaSource* m_source; |
| 97 GenericEventQueue* m_asyncEventQueue; | 96 GenericEventQueue* m_asyncEventQueue; |
| 98 EventTargetData m_eventTargetData; | 97 EventTargetData m_eventTargetData; |
| 99 | 98 |
| 100 bool m_updating; | 99 bool m_updating; |
| 101 double m_timestampOffset; | 100 double m_timestampOffset; |
| 102 | 101 |
| 103 Vector<unsigned char> m_pendingAppendData; | 102 Vector<unsigned char> m_pendingAppendData; |
| 104 Timer<SourceBuffer> m_appendBufferTimer; | 103 Timer<SourceBuffer> m_appendBufferTimer; |
| 105 }; | 104 }; |
| 106 | 105 |
| 107 } // namespace WebCore | 106 } // namespace WebCore |
| 108 | 107 |
| 109 #endif | 108 #endif |
| OLD | NEW |