Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / modules / mediasource / SourceBuffer.cpp
index 7eed238..26b12a1 100644 (file)
@@ -53,9 +53,11 @@ using blink::WebSourceBuffer;
 
 namespace WebCore {
 
-PassRefPtr<SourceBuffer> SourceBuffer::create(PassOwnPtr<WebSourceBuffer> webSourceBuffer, MediaSource* source, GenericEventQueue* asyncEventQueue)
+DEFINE_GC_INFO(SourceBuffer);
+
+PassRefPtrWillBeRawPtr<SourceBuffer> SourceBuffer::create(PassOwnPtr<WebSourceBuffer> webSourceBuffer, MediaSource* source, GenericEventQueue* asyncEventQueue)
 {
-    RefPtr<SourceBuffer> sourceBuffer(adoptRef(new SourceBuffer(webSourceBuffer, source, asyncEventQueue)));
+    RefPtrWillBeRawPtr<SourceBuffer> sourceBuffer(adoptRefCountedWillBeRefCountedGarbageCollected(new SourceBuffer(webSourceBuffer, source, asyncEventQueue)));
     sourceBuffer->suspendIfNeeded();
     return sourceBuffer.release();
 }
@@ -108,11 +110,8 @@ void SourceBuffer::setMode(const AtomicString& newMode, ExceptionState& exceptio
     // 1. Let new mode equal the new value being assigned to this attribute.
     // 2. If new mode does not equal "segments" or "sequence", then throw an INVALID_ACCESS_ERR exception and abort
     //    these steps.
-    if (newMode != segmentsKeyword() && newMode != sequenceKeyword()) {
-        exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessError);
-        return;
-    }
-
+    //    Step 2 is unnecessary: IDL enforcement prevents this case and should just return immediately to script
+    //    without calling this method in this case.
     // 3. If this object has been removed from the sourceBuffers attribute of the parent media source, then throw
     //    an INVALID_STATE_ERR exception and abort these steps.
     // 4. If the updating attribute equals true, then throw an INVALID_STATE_ERR exception and abort these steps.
@@ -688,4 +687,9 @@ void SourceBuffer::didFail(FileError::ErrorCode errorCode)
     appendStreamDone(false);
 }
 
+void SourceBuffer::trace(Visitor* visitor)
+{
+    visitor->trace(m_source);
+}
+
 } // namespace WebCore