| 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 18 matching lines...) Expand all Loading... |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef SourceBuffer_h | 31 #ifndef SourceBuffer_h |
| 32 #define SourceBuffer_h | 32 #define SourceBuffer_h |
| 33 | 33 |
| 34 #include "core/dom/ActiveDOMObject.h" | 34 #include "core/dom/ActiveDOMObject.h" |
| 35 #include "core/fileapi/FileReaderLoaderClient.h" | 35 #include "core/fileapi/FileReaderLoaderClient.h" |
| 36 #include "modules/EventTargetModules.h" | 36 #include "modules/EventTargetModules.h" |
| 37 #include "platform/AsyncMethodRunner.h" | 37 #include "platform/AsyncMethodRunner.h" |
| 38 #include "platform/weborigin/KURL.h" | 38 #include "platform/weborigin/KURL.h" |
| 39 #include "public/platform/WebSourceBufferClient.h" |
| 39 #include "wtf/Forward.h" | 40 #include "wtf/Forward.h" |
| 40 #include "wtf/RefCounted.h" | 41 #include "wtf/RefCounted.h" |
| 41 #include "wtf/text/WTFString.h" | 42 #include "wtf/text/WTFString.h" |
| 42 | 43 |
| 43 namespace blink { | 44 namespace blink { |
| 44 | 45 |
| 45 class ExceptionState; | 46 class ExceptionState; |
| 46 class FileReaderLoader; | 47 class FileReaderLoader; |
| 47 class GenericEventQueue; | 48 class GenericEventQueue; |
| 48 class MediaSource; | 49 class MediaSource; |
| 49 class Stream; | 50 class Stream; |
| 50 class TimeRanges; | 51 class TimeRanges; |
| 51 class WebSourceBuffer; | 52 class WebSourceBuffer; |
| 52 | 53 |
| 53 class SourceBuffer FINAL : public RefCountedGarbageCollectedWillBeGarbageCollect
edFinalized<SourceBuffer>, public ActiveDOMObject, public EventTargetWithInlineD
ata, public FileReaderLoaderClient { | 54 class SourceBuffer FINAL : public RefCountedGarbageCollectedWillBeGarbageCollect
edFinalized<SourceBuffer>, public ActiveDOMObject, public EventTargetWithInlineD
ata, public FileReaderLoaderClient, public WebSourceBufferClient { |
| 54 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<S
ourceBuffer>); | 55 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<S
ourceBuffer>); |
| 55 DEFINE_WRAPPERTYPEINFO(); | 56 DEFINE_WRAPPERTYPEINFO(); |
| 56 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SourceBuffer); | 57 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SourceBuffer); |
| 57 public: | 58 public: |
| 58 static SourceBuffer* create(PassOwnPtr<WebSourceBuffer>, MediaSource*, Gener
icEventQueue*); | 59 static SourceBuffer* create(PassOwnPtr<WebSourceBuffer>, MediaSource*, Gener
icEventQueue*); |
| 59 static const AtomicString& segmentsKeyword(); | 60 static const AtomicString& segmentsKeyword(); |
| 60 static const AtomicString& sequenceKeyword(); | 61 static const AtomicString& sequenceKeyword(); |
| 61 | 62 |
| 62 virtual ~SourceBuffer(); | 63 virtual ~SourceBuffer(); |
| 63 | 64 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 85 // ActiveDOMObject interface | 86 // ActiveDOMObject interface |
| 86 virtual bool hasPendingActivity() const OVERRIDE; | 87 virtual bool hasPendingActivity() const OVERRIDE; |
| 87 virtual void suspend() OVERRIDE; | 88 virtual void suspend() OVERRIDE; |
| 88 virtual void resume() OVERRIDE; | 89 virtual void resume() OVERRIDE; |
| 89 virtual void stop() OVERRIDE; | 90 virtual void stop() OVERRIDE; |
| 90 | 91 |
| 91 // EventTarget interface | 92 // EventTarget interface |
| 92 virtual ExecutionContext* executionContext() const OVERRIDE; | 93 virtual ExecutionContext* executionContext() const OVERRIDE; |
| 93 virtual const AtomicString& interfaceName() const OVERRIDE; | 94 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 94 | 95 |
| 96 // WebSourceBufferClient interface |
| 97 virtual void initializationSegmentReceived() OVERRIDE; |
| 98 |
| 95 virtual void trace(Visitor*) OVERRIDE; | 99 virtual void trace(Visitor*) OVERRIDE; |
| 96 | 100 |
| 97 private: | 101 private: |
| 98 SourceBuffer(PassOwnPtr<WebSourceBuffer>, MediaSource*, GenericEventQueue*); | 102 SourceBuffer(PassOwnPtr<WebSourceBuffer>, MediaSource*, GenericEventQueue*); |
| 99 | 103 |
| 100 bool isRemoved() const; | 104 bool isRemoved() const; |
| 101 void scheduleEvent(const AtomicString& eventName); | 105 void scheduleEvent(const AtomicString& eventName); |
| 102 | 106 |
| 103 void appendBufferInternal(const unsigned char*, unsigned, ExceptionState&); | 107 void appendBufferInternal(const unsigned char*, unsigned, ExceptionState&); |
| 104 void appendBufferAsyncPart(); | 108 void appendBufferAsyncPart(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 119 OwnPtr<WebSourceBuffer> m_webSourceBuffer; | 123 OwnPtr<WebSourceBuffer> m_webSourceBuffer; |
| 120 Member<MediaSource> m_source; | 124 Member<MediaSource> m_source; |
| 121 GenericEventQueue* m_asyncEventQueue; | 125 GenericEventQueue* m_asyncEventQueue; |
| 122 | 126 |
| 123 AtomicString m_mode; | 127 AtomicString m_mode; |
| 124 bool m_updating; | 128 bool m_updating; |
| 125 double m_timestampOffset; | 129 double m_timestampOffset; |
| 126 double m_appendWindowStart; | 130 double m_appendWindowStart; |
| 127 double m_appendWindowEnd; | 131 double m_appendWindowEnd; |
| 128 | 132 |
| 133 // Tracks whether the first initialization segment has been received. |
| 134 bool m_firstInitializationSegment; |
| 135 |
| 129 Vector<unsigned char> m_pendingAppendData; | 136 Vector<unsigned char> m_pendingAppendData; |
| 130 size_t m_pendingAppendDataOffset; | 137 size_t m_pendingAppendDataOffset; |
| 131 AsyncMethodRunner<SourceBuffer> m_appendBufferAsyncPartRunner; | 138 AsyncMethodRunner<SourceBuffer> m_appendBufferAsyncPartRunner; |
| 132 | 139 |
| 133 double m_pendingRemoveStart; | 140 double m_pendingRemoveStart; |
| 134 double m_pendingRemoveEnd; | 141 double m_pendingRemoveEnd; |
| 135 AsyncMethodRunner<SourceBuffer> m_removeAsyncPartRunner; | 142 AsyncMethodRunner<SourceBuffer> m_removeAsyncPartRunner; |
| 136 | 143 |
| 137 bool m_streamMaxSizeValid; | 144 bool m_streamMaxSizeValid; |
| 138 unsigned long long m_streamMaxSize; | 145 unsigned long long m_streamMaxSize; |
| 139 AsyncMethodRunner<SourceBuffer> m_appendStreamAsyncPartRunner; | 146 AsyncMethodRunner<SourceBuffer> m_appendStreamAsyncPartRunner; |
| 140 RefPtrWillBeMember<Stream> m_stream; | 147 RefPtrWillBeMember<Stream> m_stream; |
| 141 OwnPtr<FileReaderLoader> m_loader; | 148 OwnPtr<FileReaderLoader> m_loader; |
| 142 }; | 149 }; |
| 143 | 150 |
| 144 } // namespace blink | 151 } // namespace blink |
| 145 | 152 |
| 146 #endif // SourceBuffer_h | 153 #endif // SourceBuffer_h |
| OLD | NEW |