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

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

Issue 61603006: Remove MediaSourcePrivate/SourceBufferPrivate (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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 3552d4d2fcc1662acf03cc17227226c5e287bfc9..a935bc05f8c825b3b297954002bfae27997625b2 100644
--- a/Source/modules/mediasource/SourceBuffer.cpp
+++ b/Source/modules/mediasource/SourceBuffer.cpp
@@ -39,28 +39,32 @@
#include "core/fileapi/FileReaderLoader.h"
#include "core/fileapi/Stream.h"
#include "core/html/TimeRanges.h"
-#include "core/platform/graphics/SourceBufferPrivate.h"
#include "modules/mediasource/MediaSource.h"
#include "platform/Logging.h"
#include "platform/TraceEvent.h"
+#include "public/platform/WebSourceBuffer.h"
+#include "public/platform/WebTimeRange.h"
#include "wtf/ArrayBuffer.h"
#include "wtf/ArrayBufferView.h"
#include "wtf/MathExtras.h"
#include <limits>
+using blink::WebSourceBuffer;
+using blink::WebTimeRanges;
+
namespace WebCore {
-PassRefPtr<SourceBuffer> SourceBuffer::create(PassOwnPtr<SourceBufferPrivate> sourceBufferPrivate, MediaSource* source, GenericEventQueue* asyncEventQueue)
+PassRefPtr<SourceBuffer> SourceBuffer::create(PassOwnPtr<WebSourceBuffer> webSourceBuffer, MediaSource* source, GenericEventQueue* asyncEventQueue)
{
- RefPtr<SourceBuffer> sourceBuffer(adoptRef(new SourceBuffer(sourceBufferPrivate, source, asyncEventQueue)));
+ RefPtr<SourceBuffer> sourceBuffer(adoptRef(new SourceBuffer(webSourceBuffer, source, asyncEventQueue)));
sourceBuffer->suspendIfNeeded();
return sourceBuffer.release();
}
-SourceBuffer::SourceBuffer(PassOwnPtr<SourceBufferPrivate> sourceBufferPrivate, MediaSource* source, GenericEventQueue* asyncEventQueue)
+SourceBuffer::SourceBuffer(PassOwnPtr<WebSourceBuffer> webSourceBuffer, MediaSource* source, GenericEventQueue* asyncEventQueue)
: ActiveDOMObject(source->executionContext())
- , m_private(sourceBufferPrivate)
+ , m_webSourceBuffer(webSourceBuffer)
, m_source(source)
, m_asyncEventQueue(asyncEventQueue)
, m_updating(false)
@@ -75,7 +79,7 @@ SourceBuffer::SourceBuffer(PassOwnPtr<SourceBufferPrivate> sourceBufferPrivate,
, m_streamMaxSize(0)
, m_appendStreamAsyncPartRunner(this, &SourceBuffer::appendStreamAsyncPart)
{
- ASSERT(m_private);
+ ASSERT(m_webSourceBuffer);
ASSERT(m_source);
ScriptWrappable::init(this);
}
@@ -98,7 +102,11 @@ PassRefPtr<TimeRanges> SourceBuffer::buffered(ExceptionState& es) const
}
// 2. Return a new static normalized TimeRanges object for the media segments buffered.
- return m_private->buffered();
+ WebTimeRanges webRanges = m_webSourceBuffer->buffered();
+ RefPtr<TimeRanges> ranges = TimeRanges::create();
+ for (size_t i = 0; i < webRanges.size(); ++i)
+ ranges->add(webRanges[i].start, webRanges[i].end);
+ return ranges.release();
}
double SourceBuffer::timestampOffset() const
@@ -127,7 +135,7 @@ void SourceBuffer::setTimestampOffset(double offset, ExceptionState& es)
// and abort these steps.
//
// FIXME: Add step 6 text when mode attribute is implemented.
- if (!m_private->setTimestampOffset(offset)) {
+ if (!m_webSourceBuffer->setTimestampOffset(offset)) {
es.throwUninformativeAndGenericDOMException(InvalidStateError);
return;
}
@@ -167,7 +175,7 @@ void SourceBuffer::setAppendWindowStart(double start, ExceptionState& es)
return;
}
- m_private->setAppendWindowStart(start);
+ m_webSourceBuffer->setAppendWindowStart(start);
// 4. Update the attribute to the new value.
m_appendWindowStart = start;
@@ -197,7 +205,7 @@ void SourceBuffer::setAppendWindowEnd(double end, ExceptionState& es)
return;
}
- m_private->setAppendWindowEnd(end);
+ m_webSourceBuffer->setAppendWindowEnd(end);
// 5. Update the attribute to the new value.
m_appendWindowEnd = end;
@@ -260,7 +268,7 @@ void SourceBuffer::abort(ExceptionState& es)
abortIfUpdating();
// 4. Run the reset parser state algorithm.
- m_private->abort();
+ m_webSourceBuffer->abort();
// 5. Set appendWindowStart to 0.
setAppendWindowStart(0, es);
@@ -355,7 +363,7 @@ void SourceBuffer::removedFromMediaSource()
abortIfUpdating();
- m_private->removedFromMediaSource();
+ m_webSourceBuffer->removedFromMediaSource();
acolwell GONE FROM CHROMIUM 2013/11/11 18:06:55 I believe you can & should clear m_webSourceBuffer
philipj_slow 2013/11/12 09:43:51 I noticed the .clear() in the code that I removed,
m_source = 0;
m_asyncEventQueue = 0;
}
@@ -460,11 +468,11 @@ void SourceBuffer::appendBufferAsyncPart()
size_t appendSize = m_pendingAppendData.size();
if (!appendSize) {
// Resize buffer for 0 byte appends so we always have a valid pointer.
- // We need to convey all appends, even 0 byte ones to |m_private| so
- // that it can clear its end of stream state if necessary.
+ // We need to convey all appends, even 0 byte ones to |m_webSourceBuffer|
+ // so that it can clear its end of stream state if necessary.
m_pendingAppendData.resize(1);
}
- m_private->append(m_pendingAppendData.data(), appendSize);
+ m_webSourceBuffer->append(m_pendingAppendData.data(), appendSize);
// 3. Set the updating attribute to false.
m_updating = false;
@@ -488,7 +496,7 @@ void SourceBuffer::removeAsyncPart()
// https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-SourceBuffer-remove-void-double-start-double-end
// 9. Run the coded frame removal algorithm with start and end as the start and end of the removal range.
- m_private->remove(m_pendingRemoveStart, m_pendingRemoveEnd);
+ m_webSourceBuffer->remove(m_pendingRemoveStart, m_pendingRemoveEnd);
// 10. Set the updating attribute to false.
m_updating = false;
@@ -527,7 +535,7 @@ void SourceBuffer::appendStreamInternal(PassRefPtr<Stream> stream, ExceptionStat
// 3. If the readyState attribute of the parent media source is in the "ended" state then run the following steps: ...
m_source->openIfInEndedState();
- // Steps 4-5 of the prepare append algorithm are handled by m_private.
+ // Steps 4-5 of the prepare append algorithm are handled by m_webSourceBuffer.
// 3. Set the updating attribute to true.
m_updating = true;
@@ -590,7 +598,7 @@ void SourceBuffer::appendStreamDone(bool success)
}
// Section 3.5.6 Stream Append Loop
- // Steps 1-11 are handled by appendStreamAsyncPart(), |m_loader|, and |m_private|.
+ // Steps 1-11 are handled by appendStreamAsyncPart(), |m_loader|, and |m_webSourceBuffer|.
// 12. Loop Done: Set the updating attribute to false.
m_updating = false;
@@ -621,7 +629,7 @@ void SourceBuffer::didReceiveDataForClient(const char* data, unsigned dataLength
ASSERT(m_updating);
ASSERT(m_loader);
- m_private->append(reinterpret_cast<const unsigned char*>(data), dataLength);
+ m_webSourceBuffer->append(reinterpret_cast<const unsigned char*>(data), dataLength);
}
void SourceBuffer::didFinishLoading()

Powered by Google App Engine
This is Rietveld 408576698