Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1636)

Unified Diff: Source/modules/mediasource/SourceBuffer.cpp

Issue 754463008: MSE: Implement SourceBuffer.trackDefaults (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@Implement_TrackDefaultList_object
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/mediasource/SourceBuffer.cpp
diff --git a/Source/modules/mediasource/SourceBuffer.cpp b/Source/modules/mediasource/SourceBuffer.cpp
index ec9727e5d46cc6943af3caa095d8e6a7fbf6c6a7..073e55ed5f350a7c872eb75d44824efae15f7e4a 100644
--- a/Source/modules/mediasource/SourceBuffer.cpp
+++ b/Source/modules/mediasource/SourceBuffer.cpp
@@ -83,6 +83,7 @@ SourceBuffer::SourceBuffer(PassOwnPtr<WebSourceBuffer> webSourceBuffer, MediaSou
: ActiveDOMObject(source->executionContext())
, m_webSourceBuffer(webSourceBuffer)
, m_source(source)
+ , m_trackDefaults(TrackDefaultList::create(HeapVector<Member<TrackDefault>>(), ASSERT_NO_EXCEPTION))
haraken 2014/12/04 15:33:09 This looks unsafe to me. The HeapVector is created
philipj_slow 2014/12/04 16:17:53 Alternatively, change the spec to let trackDefault
wolenetz 2014/12/12 22:15:06 UAF/unsafety: TrackDefaultList::create passes thro
philipj_slow 2014/12/15 09:02:38 AFAICT, this is safe, the TrackDefaultList constru
wolenetz 2014/12/15 23:49:20 With patch set 3, this becomes academic: I'm still
, m_asyncEventQueue(asyncEventQueue)
, m_mode(segmentsKeyword())
, m_updating(false)
@@ -366,6 +367,22 @@ void SourceBuffer::remove(double start, double end, ExceptionState& exceptionSta
m_removeAsyncPartRunner.runAsync();
}
+void SourceBuffer::setTrackDefaults(TrackDefaultList* trackDefaults, ExceptionState& exceptionState)
+{
+ // Per 02 Dec 2014 Editor's Draft
+ // http://w3c.github.io/media-source/#widl-SourceBuffer-trackDefaults
+ // 1. If this object has been removed from the sourceBuffers attribute of
+ // the parent media source, then throw an InvalidStateError exception
+ // and abort these steps.
+ // 2. If the updating attribute equals true, then throw an InvalidStateError
+ // exception and abort these steps.
+ if (throwExceptionIfRemovedOrUpdating(isRemoved(), m_updating, exceptionState))
+ return;
+
+ // 3. Update the attribute to the new value.
+ m_trackDefaults = trackDefaults;
+}
+
void SourceBuffer::abortIfUpdating()
{
// Section 3.2 abort() method step 3 substeps.
@@ -746,6 +763,7 @@ void SourceBuffer::trace(Visitor* visitor)
{
visitor->trace(m_source);
visitor->trace(m_stream);
+ visitor->trace(m_trackDefaults);
EventTargetWithInlineData::trace(visitor);
}

Powered by Google App Engine
This is Rietveld 408576698