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 17 matching lines...) Expand all Loading... |
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/events/EventTarget.h" | 36 #include "core/events/EventTarget.h" |
37 #include "core/fileapi/FileReaderLoaderClient.h" | 37 #include "core/fileapi/FileReaderLoaderClient.h" |
38 #include "core/platform/graphics/SourceBufferPrivate.h" | |
39 #include "platform/AsyncMethodRunner.h" | 38 #include "platform/AsyncMethodRunner.h" |
40 #include "weborigin/KURL.h" | 39 #include "weborigin/KURL.h" |
41 #include "wtf/OwnPtr.h" | 40 #include "wtf/OwnPtr.h" |
42 #include "wtf/PassOwnPtr.h" | 41 #include "wtf/PassOwnPtr.h" |
43 #include "wtf/PassRefPtr.h" | 42 #include "wtf/PassRefPtr.h" |
44 #include "wtf/RefCounted.h" | 43 #include "wtf/RefCounted.h" |
45 #include "wtf/RefPtr.h" | 44 #include "wtf/RefPtr.h" |
46 #include "wtf/text/WTFString.h" | 45 #include "wtf/text/WTFString.h" |
47 | 46 |
| 47 namespace blink { |
| 48 class WebSourceBuffer; |
| 49 } |
| 50 |
48 namespace WebCore { | 51 namespace WebCore { |
49 | 52 |
50 class ExceptionState; | 53 class ExceptionState; |
51 class FileReaderLoader; | 54 class FileReaderLoader; |
52 class GenericEventQueue; | 55 class GenericEventQueue; |
53 class MediaSource; | 56 class MediaSource; |
54 class Stream; | 57 class Stream; |
55 class TimeRanges; | 58 class TimeRanges; |
56 | 59 |
57 class SourceBuffer : public RefCounted<SourceBuffer>, public ActiveDOMObject, pu
blic EventTargetWithInlineData, public ScriptWrappable, public FileReaderLoaderC
lient { | 60 class SourceBuffer : public RefCounted<SourceBuffer>, public ActiveDOMObject, pu
blic EventTargetWithInlineData, public ScriptWrappable, public FileReaderLoaderC
lient { |
58 REFCOUNTED_EVENT_TARGET(SourceBuffer); | 61 REFCOUNTED_EVENT_TARGET(SourceBuffer); |
59 public: | 62 public: |
60 static PassRefPtr<SourceBuffer> create(PassOwnPtr<SourceBufferPrivate>, Medi
aSource*, GenericEventQueue*); | 63 static PassRefPtr<SourceBuffer> create(PassOwnPtr<blink::WebSourceBuffer>, M
ediaSource*, GenericEventQueue*); |
61 | 64 |
62 virtual ~SourceBuffer(); | 65 virtual ~SourceBuffer(); |
63 | 66 |
64 // SourceBuffer.idl methods | 67 // SourceBuffer.idl methods |
65 bool updating() const { return m_updating; } | 68 bool updating() const { return m_updating; } |
66 PassRefPtr<TimeRanges> buffered(ExceptionState&) const; | 69 PassRefPtr<TimeRanges> buffered(ExceptionState&) const; |
67 double timestampOffset() const; | 70 double timestampOffset() const; |
68 void setTimestampOffset(double, ExceptionState&); | 71 void setTimestampOffset(double, ExceptionState&); |
69 void appendBuffer(PassRefPtr<ArrayBuffer> data, ExceptionState&); | 72 void appendBuffer(PassRefPtr<ArrayBuffer> data, ExceptionState&); |
70 void appendBuffer(PassRefPtr<ArrayBufferView> data, ExceptionState&); | 73 void appendBuffer(PassRefPtr<ArrayBufferView> data, ExceptionState&); |
(...skipping 13 matching lines...) Expand all Loading... |
84 virtual bool hasPendingActivity() const OVERRIDE; | 87 virtual bool hasPendingActivity() const OVERRIDE; |
85 virtual void suspend() OVERRIDE; | 88 virtual void suspend() OVERRIDE; |
86 virtual void resume() OVERRIDE; | 89 virtual void resume() OVERRIDE; |
87 virtual void stop() OVERRIDE; | 90 virtual void stop() OVERRIDE; |
88 | 91 |
89 // EventTarget interface | 92 // EventTarget interface |
90 virtual ExecutionContext* executionContext() const OVERRIDE; | 93 virtual ExecutionContext* executionContext() const OVERRIDE; |
91 virtual const AtomicString& interfaceName() const OVERRIDE; | 94 virtual const AtomicString& interfaceName() const OVERRIDE; |
92 | 95 |
93 private: | 96 private: |
94 SourceBuffer(PassOwnPtr<SourceBufferPrivate>, MediaSource*, GenericEventQueu
e*); | 97 SourceBuffer(PassOwnPtr<blink::WebSourceBuffer>, MediaSource*, GenericEventQ
ueue*); |
95 | 98 |
96 bool isRemoved() const; | 99 bool isRemoved() const; |
97 void scheduleEvent(const AtomicString& eventName); | 100 void scheduleEvent(const AtomicString& eventName); |
98 | 101 |
99 void appendBufferInternal(const unsigned char*, unsigned, ExceptionState&); | 102 void appendBufferInternal(const unsigned char*, unsigned, ExceptionState&); |
100 void appendBufferAsyncPart(); | 103 void appendBufferAsyncPart(); |
101 | 104 |
102 void removeAsyncPart(); | 105 void removeAsyncPart(); |
103 | 106 |
104 void appendStreamInternal(PassRefPtr<Stream>, ExceptionState&); | 107 void appendStreamInternal(PassRefPtr<Stream>, ExceptionState&); |
105 void appendStreamAsyncPart(); | 108 void appendStreamAsyncPart(); |
106 void appendStreamDone(bool success); | 109 void appendStreamDone(bool success); |
107 void clearAppendStreamState(); | 110 void clearAppendStreamState(); |
108 | 111 |
109 // FileReaderLoaderClient interface | 112 // FileReaderLoaderClient interface |
110 virtual void didStartLoading() OVERRIDE; | 113 virtual void didStartLoading() OVERRIDE; |
111 virtual void didReceiveDataForClient(const char* data, unsigned dataLength)
OVERRIDE; | 114 virtual void didReceiveDataForClient(const char* data, unsigned dataLength)
OVERRIDE; |
112 virtual void didFinishLoading() OVERRIDE; | 115 virtual void didFinishLoading() OVERRIDE; |
113 virtual void didFail(FileError::ErrorCode) OVERRIDE; | 116 virtual void didFail(FileError::ErrorCode) OVERRIDE; |
114 | 117 |
115 OwnPtr<SourceBufferPrivate> m_private; | 118 OwnPtr<blink::WebSourceBuffer> m_webSourceBuffer; |
116 MediaSource* m_source; | 119 MediaSource* m_source; |
117 GenericEventQueue* m_asyncEventQueue; | 120 GenericEventQueue* m_asyncEventQueue; |
118 | 121 |
119 bool m_updating; | 122 bool m_updating; |
120 double m_timestampOffset; | 123 double m_timestampOffset; |
121 double m_appendWindowStart; | 124 double m_appendWindowStart; |
122 double m_appendWindowEnd; | 125 double m_appendWindowEnd; |
123 | 126 |
124 Vector<unsigned char> m_pendingAppendData; | 127 Vector<unsigned char> m_pendingAppendData; |
125 AsyncMethodRunner<SourceBuffer> m_appendBufferAsyncPartRunner; | 128 AsyncMethodRunner<SourceBuffer> m_appendBufferAsyncPartRunner; |
126 | 129 |
127 double m_pendingRemoveStart; | 130 double m_pendingRemoveStart; |
128 double m_pendingRemoveEnd; | 131 double m_pendingRemoveEnd; |
129 AsyncMethodRunner<SourceBuffer> m_removeAsyncPartRunner; | 132 AsyncMethodRunner<SourceBuffer> m_removeAsyncPartRunner; |
130 | 133 |
131 bool m_streamMaxSizeValid; | 134 bool m_streamMaxSizeValid; |
132 unsigned long long m_streamMaxSize; | 135 unsigned long long m_streamMaxSize; |
133 AsyncMethodRunner<SourceBuffer> m_appendStreamAsyncPartRunner; | 136 AsyncMethodRunner<SourceBuffer> m_appendStreamAsyncPartRunner; |
134 RefPtr<Stream> m_stream; | 137 RefPtr<Stream> m_stream; |
135 OwnPtr<FileReaderLoader> m_loader; | 138 OwnPtr<FileReaderLoader> m_loader; |
136 }; | 139 }; |
137 | 140 |
138 } // namespace WebCore | 141 } // namespace WebCore |
139 | 142 |
140 #endif | 143 #endif |
OLD | NEW |