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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 DEFINE_STATIC_LOCAL(const AtomicString, closed, ("closed", AtomicString::Con structFromLiteral)); | 80 DEFINE_STATIC_LOCAL(const AtomicString, closed, ("closed", AtomicString::Con structFromLiteral)); |
81 return closed; | 81 return closed; |
82 } | 82 } |
83 | 83 |
84 const AtomicString& MediaSource::endedKeyword() | 84 const AtomicString& MediaSource::endedKeyword() |
85 { | 85 { |
86 DEFINE_STATIC_LOCAL(const AtomicString, ended, ("ended", AtomicString::Const ructFromLiteral)); | 86 DEFINE_STATIC_LOCAL(const AtomicString, ended, ("ended", AtomicString::Const ructFromLiteral)); |
87 return ended; | 87 return ended; |
88 } | 88 } |
89 | 89 |
90 PassRefPtrWillBeRawPtr<MediaSource> MediaSource::create(ExecutionContext* contex t) | 90 MediaSource* MediaSource::create(ExecutionContext* context) |
91 { | 91 { |
92 RefPtrWillBeRawPtr<MediaSource> mediaSource(adoptRefWillBeRefCountedGarbageC ollected(new MediaSource(context))); | 92 MediaSource* mediaSource(adoptRefCountedGarbageCollected(new MediaSource(con text))); |
93 mediaSource->suspendIfNeeded(); | 93 mediaSource->suspendIfNeeded(); |
94 return mediaSource.release(); | 94 return mediaSource; |
95 } | 95 } |
96 | 96 |
97 MediaSource::MediaSource(ExecutionContext* context) | 97 MediaSource::MediaSource(ExecutionContext* context) |
98 : ActiveDOMObject(context) | 98 : ActiveDOMObject(context) |
99 , m_readyState(closedKeyword()) | 99 , m_readyState(closedKeyword()) |
100 , m_asyncEventQueue(GenericEventQueue::create(this)) | 100 , m_asyncEventQueue(GenericEventQueue::create(this)) |
101 , m_attachedElement(0) | 101 , m_attachedElement(0) |
102 , m_sourceBuffers(SourceBufferList::create(executionContext(), m_asyncEventQ ueue.get())) | 102 , m_sourceBuffers(SourceBufferList::create(executionContext(), m_asyncEventQ ueue.get())) |
103 , m_activeSourceBuffers(SourceBufferList::create(executionContext(), m_async EventQueue.get())) | 103 , m_activeSourceBuffers(SourceBufferList::create(executionContext(), m_async EventQueue.get())) |
104 { | 104 { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 Vector<String> codecs = contentType.codecs(); | 143 Vector<String> codecs = contentType.codecs(); |
144 OwnPtr<WebSourceBuffer> webSourceBuffer = createWebSourceBuffer(contentType. type(), codecs, exceptionState); | 144 OwnPtr<WebSourceBuffer> webSourceBuffer = createWebSourceBuffer(contentType. type(), codecs, exceptionState); |
145 | 145 |
146 if (!webSourceBuffer) { | 146 if (!webSourceBuffer) { |
147 ASSERT(exceptionState.code() == NotSupportedError || exceptionState.code () == QuotaExceededError); | 147 ASSERT(exceptionState.code() == NotSupportedError || exceptionState.code () == QuotaExceededError); |
148 // 2. If type contains a MIME type that is not supported ..., then throw a NotSupportedError exception and abort these steps. | 148 // 2. If type contains a MIME type that is not supported ..., then throw a NotSupportedError exception and abort these steps. |
149 // 3. If the user agent can't handle any more SourceBuffer objects then throw a QuotaExceededError exception and abort these steps | 149 // 3. If the user agent can't handle any more SourceBuffer objects then throw a QuotaExceededError exception and abort these steps |
150 return 0; | 150 return 0; |
151 } | 151 } |
152 | 152 |
153 RefPtrWillBeRawPtr<SourceBuffer> buffer = SourceBuffer::create(webSourceBuff er.release(), this, m_asyncEventQueue.get()); | 153 SourceBuffer* buffer = SourceBuffer::create(webSourceBuffer.release(), this, m_asyncEventQueue.get()); |
154 // 6. Add the new object to sourceBuffers and fire a addsourcebuffer on that object. | 154 // 6. Add the new object to sourceBuffers and fire a addsourcebuffer on that object. |
155 m_sourceBuffers->add(buffer); | 155 m_sourceBuffers->add(buffer); |
156 m_activeSourceBuffers->add(buffer); | 156 m_activeSourceBuffers->add(buffer); |
157 // 7. Return the new object to the caller. | 157 // 7. Return the new object to the caller. |
158 return buffer.get(); | 158 return buffer; |
159 } | 159 } |
160 | 160 |
161 void MediaSource::removeSourceBuffer(SourceBuffer* buffer, ExceptionState& excep tionState) | 161 void MediaSource::removeSourceBuffer(SourceBuffer* buffer, ExceptionState& excep tionState) |
162 { | 162 { |
163 WTF_LOG(Media, "MediaSource::removeSourceBuffer() %p", this); | 163 WTF_LOG(Media, "MediaSource::removeSourceBuffer() %p", this); |
164 RefPtr<SourceBuffer> protect(buffer); | |
165 | 164 |
166 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media -source.html#widl-MediaSource-removeSourceBuffer-void-SourceBuffer-sourceBuffer | 165 // 2.2 https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media -source.html#widl-MediaSource-removeSourceBuffer-void-SourceBuffer-sourceBuffer |
167 | 166 |
168 // 1. If sourceBuffer specifies an object that is not in sourceBuffers then | 167 // 1. If sourceBuffer specifies an object that is not in sourceBuffers then |
169 // throw a NotFoundError exception and abort these steps. | 168 // throw a NotFoundError exception and abort these steps. |
170 if (!m_sourceBuffers->length() || !m_sourceBuffers->contains(buffer)) { | 169 if (!m_sourceBuffers->length() || !m_sourceBuffers->contains(buffer)) { |
171 exceptionState.throwDOMException(NotFoundError, "The SourceBuffer provid ed is not contained in this MediaSource."); | 170 exceptionState.throwDOMException(NotFoundError, "The SourceBuffer provid ed is not contained in this MediaSource."); |
172 return; | 171 return; |
173 } | 172 } |
174 | 173 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
253 return EventTargetNames::MediaSource; | 252 return EventTargetNames::MediaSource; |
254 } | 253 } |
255 | 254 |
256 ExecutionContext* MediaSource::executionContext() const | 255 ExecutionContext* MediaSource::executionContext() const |
257 { | 256 { |
258 return ActiveDOMObject::executionContext(); | 257 return ActiveDOMObject::executionContext(); |
259 } | 258 } |
260 | 259 |
261 void MediaSource::trace(Visitor* visitor) | 260 void MediaSource::trace(Visitor* visitor) |
262 { | 261 { |
263 visitor->trace(m_asyncEventQueue); | 262 visitor->trace(m_asyncEventQueue); |
tkent
2014/06/29 23:30:42
This is causing crashes in Debug build. We can't t
| |
264 visitor->trace(m_sourceBuffers); | 263 visitor->trace(m_sourceBuffers); |
265 visitor->trace(m_activeSourceBuffers); | 264 visitor->trace(m_activeSourceBuffers); |
266 EventTargetWithInlineData::trace(visitor); | 265 EventTargetWithInlineData::trace(visitor); |
267 } | 266 } |
268 | 267 |
269 void MediaSource::setWebMediaSourceAndOpen(PassOwnPtr<WebMediaSource> webMediaSo urce) | 268 void MediaSource::setWebMediaSourceAndOpen(PassOwnPtr<WebMediaSource> webMediaSo urce) |
270 { | 269 { |
271 TRACE_EVENT_ASYNC_END0("media", "MediaSource::attachToElement", this); | 270 TRACE_EVENT_ASYNC_END0("media", "MediaSource::attachToElement", this); |
272 ASSERT(webMediaSource); | 271 ASSERT(webMediaSource); |
273 ASSERT(!m_webMediaSource); | 272 ASSERT(!m_webMediaSource); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
539 | 538 |
540 m_asyncEventQueue->enqueueEvent(event.release()); | 539 m_asyncEventQueue->enqueueEvent(event.release()); |
541 } | 540 } |
542 | 541 |
543 URLRegistry& MediaSource::registry() const | 542 URLRegistry& MediaSource::registry() const |
544 { | 543 { |
545 return MediaSourceRegistry::registry(); | 544 return MediaSourceRegistry::registry(); |
546 } | 545 } |
547 | 546 |
548 } // namespace WebCore | 547 } // namespace WebCore |
OLD | NEW |