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 23 matching lines...) Expand all Loading... |
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 "wtf/Forward.h" | 39 #include "wtf/Forward.h" |
40 #include "wtf/RefCounted.h" | 40 #include "wtf/RefCounted.h" |
41 #include "wtf/text/WTFString.h" | 41 #include "wtf/text/WTFString.h" |
42 | 42 |
43 namespace blink { | 43 namespace blink { |
44 class WebSourceBuffer; | |
45 } | |
46 | |
47 namespace blink { | |
48 | 44 |
49 class ExceptionState; | 45 class ExceptionState; |
50 class FileReaderLoader; | 46 class FileReaderLoader; |
51 class GenericEventQueue; | 47 class GenericEventQueue; |
52 class MediaSource; | 48 class MediaSource; |
53 class Stream; | 49 class Stream; |
54 class TimeRanges; | 50 class TimeRanges; |
| 51 class WebSourceBuffer; |
55 | 52 |
56 class SourceBuffer FINAL : public RefCountedGarbageCollectedWillBeGarbageCollect
edFinalized<SourceBuffer>, public ActiveDOMObject, public EventTargetWithInlineD
ata, public FileReaderLoaderClient { | 53 class SourceBuffer FINAL : public RefCountedGarbageCollectedWillBeGarbageCollect
edFinalized<SourceBuffer>, public ActiveDOMObject, public EventTargetWithInlineD
ata, public FileReaderLoaderClient { |
57 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<S
ourceBuffer>); | 54 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<S
ourceBuffer>); |
58 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SourceBuffer); | 55 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(SourceBuffer); |
59 public: | 56 public: |
60 static SourceBuffer* create(PassOwnPtr<blink::WebSourceBuffer>, MediaSource*
, GenericEventQueue*); | 57 static SourceBuffer* create(PassOwnPtr<WebSourceBuffer>, MediaSource*, Gener
icEventQueue*); |
61 static const AtomicString& segmentsKeyword(); | 58 static const AtomicString& segmentsKeyword(); |
62 static const AtomicString& sequenceKeyword(); | 59 static const AtomicString& sequenceKeyword(); |
63 | 60 |
64 virtual ~SourceBuffer(); | 61 virtual ~SourceBuffer(); |
65 | 62 |
66 // SourceBuffer.idl methods | 63 // SourceBuffer.idl methods |
67 const AtomicString& mode() const { return m_mode; } | 64 const AtomicString& mode() const { return m_mode; } |
68 void setMode(const AtomicString&, ExceptionState&); | 65 void setMode(const AtomicString&, ExceptionState&); |
69 bool updating() const { return m_updating; } | 66 bool updating() const { return m_updating; } |
70 PassRefPtrWillBeRawPtr<TimeRanges> buffered(ExceptionState&) const; | 67 PassRefPtrWillBeRawPtr<TimeRanges> buffered(ExceptionState&) const; |
(...skipping 19 matching lines...) Expand all Loading... |
90 virtual void resume() OVERRIDE; | 87 virtual void resume() OVERRIDE; |
91 virtual void stop() OVERRIDE; | 88 virtual void stop() OVERRIDE; |
92 | 89 |
93 // EventTarget interface | 90 // EventTarget interface |
94 virtual ExecutionContext* executionContext() const OVERRIDE; | 91 virtual ExecutionContext* executionContext() const OVERRIDE; |
95 virtual const AtomicString& interfaceName() const OVERRIDE; | 92 virtual const AtomicString& interfaceName() const OVERRIDE; |
96 | 93 |
97 virtual void trace(Visitor*) OVERRIDE; | 94 virtual void trace(Visitor*) OVERRIDE; |
98 | 95 |
99 private: | 96 private: |
100 SourceBuffer(PassOwnPtr<blink::WebSourceBuffer>, MediaSource*, GenericEventQ
ueue*); | 97 SourceBuffer(PassOwnPtr<WebSourceBuffer>, MediaSource*, GenericEventQueue*); |
101 | 98 |
102 bool isRemoved() const; | 99 bool isRemoved() const; |
103 void scheduleEvent(const AtomicString& eventName); | 100 void scheduleEvent(const AtomicString& eventName); |
104 | 101 |
105 void appendBufferInternal(const unsigned char*, unsigned, ExceptionState&); | 102 void appendBufferInternal(const unsigned char*, unsigned, ExceptionState&); |
106 void appendBufferAsyncPart(); | 103 void appendBufferAsyncPart(); |
107 | 104 |
108 void removeAsyncPart(); | 105 void removeAsyncPart(); |
109 | 106 |
110 void appendStreamInternal(PassRefPtrWillBeRawPtr<Stream>, ExceptionState&); | 107 void appendStreamInternal(PassRefPtrWillBeRawPtr<Stream>, ExceptionState&); |
111 void appendStreamAsyncPart(); | 108 void appendStreamAsyncPart(); |
112 void appendStreamDone(bool success); | 109 void appendStreamDone(bool success); |
113 void clearAppendStreamState(); | 110 void clearAppendStreamState(); |
114 | 111 |
115 // FileReaderLoaderClient interface | 112 // FileReaderLoaderClient interface |
116 virtual void didStartLoading() OVERRIDE; | 113 virtual void didStartLoading() OVERRIDE; |
117 virtual void didReceiveDataForClient(const char* data, unsigned dataLength)
OVERRIDE; | 114 virtual void didReceiveDataForClient(const char* data, unsigned dataLength)
OVERRIDE; |
118 virtual void didFinishLoading() OVERRIDE; | 115 virtual void didFinishLoading() OVERRIDE; |
119 virtual void didFail(FileError::ErrorCode) OVERRIDE; | 116 virtual void didFail(FileError::ErrorCode) OVERRIDE; |
120 | 117 |
121 OwnPtr<blink::WebSourceBuffer> m_webSourceBuffer; | 118 OwnPtr<WebSourceBuffer> m_webSourceBuffer; |
122 Member<MediaSource> m_source; | 119 Member<MediaSource> m_source; |
123 GenericEventQueue* m_asyncEventQueue; | 120 GenericEventQueue* m_asyncEventQueue; |
124 | 121 |
125 AtomicString m_mode; | 122 AtomicString m_mode; |
126 bool m_updating; | 123 bool m_updating; |
127 double m_timestampOffset; | 124 double m_timestampOffset; |
128 double m_appendWindowStart; | 125 double m_appendWindowStart; |
129 double m_appendWindowEnd; | 126 double m_appendWindowEnd; |
130 | 127 |
131 Vector<unsigned char> m_pendingAppendData; | 128 Vector<unsigned char> m_pendingAppendData; |
132 size_t m_pendingAppendDataOffset; | 129 size_t m_pendingAppendDataOffset; |
133 AsyncMethodRunner<SourceBuffer> m_appendBufferAsyncPartRunner; | 130 AsyncMethodRunner<SourceBuffer> m_appendBufferAsyncPartRunner; |
134 | 131 |
135 double m_pendingRemoveStart; | 132 double m_pendingRemoveStart; |
136 double m_pendingRemoveEnd; | 133 double m_pendingRemoveEnd; |
137 AsyncMethodRunner<SourceBuffer> m_removeAsyncPartRunner; | 134 AsyncMethodRunner<SourceBuffer> m_removeAsyncPartRunner; |
138 | 135 |
139 bool m_streamMaxSizeValid; | 136 bool m_streamMaxSizeValid; |
140 unsigned long long m_streamMaxSize; | 137 unsigned long long m_streamMaxSize; |
141 AsyncMethodRunner<SourceBuffer> m_appendStreamAsyncPartRunner; | 138 AsyncMethodRunner<SourceBuffer> m_appendStreamAsyncPartRunner; |
142 RefPtrWillBeMember<Stream> m_stream; | 139 RefPtrWillBeMember<Stream> m_stream; |
143 OwnPtr<FileReaderLoader> m_loader; | 140 OwnPtr<FileReaderLoader> m_loader; |
144 }; | 141 }; |
145 | 142 |
146 } // namespace blink | 143 } // namespace blink |
147 | 144 |
148 #endif | 145 #endif |
OLD | NEW |