Commit acd75163 authored by sigbjornf@opera.com's avatar sigbjornf@opera.com

Keep auxilliary media objects on the heap always.

Fully transition MediaError, MediaKeyError and TimeRanges to Oilpan.

R=haraken
BUG=340522

Review URL: https://codereview.chromium.org/1306613002

git-svn-id: svn://svn.chromium.org/blink/trunk@200962 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent afadc21a
...@@ -653,7 +653,7 @@ void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*) ...@@ -653,7 +653,7 @@ void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*)
m_pendingActionFlags = 0; m_pendingActionFlags = 0;
} }
PassRefPtrWillBeRawPtr<MediaError> HTMLMediaElement::error() const MediaError* HTMLMediaElement::error() const
{ {
return m_error; return m_error;
} }
...@@ -1286,7 +1286,7 @@ void HTMLMediaElement::noneSupported() ...@@ -1286,7 +1286,7 @@ void HTMLMediaElement::noneSupported()
layoutObject()->updateFromElement(); layoutObject()->updateFromElement();
} }
void HTMLMediaElement::mediaEngineError(PassRefPtrWillBeRawPtr<MediaError> err) void HTMLMediaElement::mediaEngineError(MediaError* err)
{ {
ASSERT(m_readyState >= HAVE_METADATA); ASSERT(m_readyState >= HAVE_METADATA);
WTF_LOG(Media, "HTMLMediaElement::mediaEngineError(%p, %d)", this, static_cast<int>(err->code())); WTF_LOG(Media, "HTMLMediaElement::mediaEngineError(%p, %d)", this, static_cast<int>(err->code()));
...@@ -1672,7 +1672,7 @@ void HTMLMediaElement::seek(double time) ...@@ -1672,7 +1672,7 @@ void HTMLMediaElement::seek(double time)
// seekable attribute, then let it be the position in one of the ranges given in the seekable attribute // seekable attribute, then let it be the position in one of the ranges given in the seekable attribute
// that is the nearest to the new playback position. ... If there are no ranges given in the seekable // that is the nearest to the new playback position. ... If there are no ranges given in the seekable
// attribute then set the seeking IDL attribute to false and abort these steps. // attribute then set the seeking IDL attribute to false and abort these steps.
RefPtrWillBeRawPtr<TimeRanges> seekableRanges = seekable(); TimeRanges* seekableRanges = seekable();
if (!seekableRanges->length()) { if (!seekableRanges->length()) {
m_seeking = false; m_seeking = false;
...@@ -2865,7 +2865,7 @@ void HTMLMediaElement::sizeChanged() ...@@ -2865,7 +2865,7 @@ void HTMLMediaElement::sizeChanged()
layoutObject()->updateFromElement(); layoutObject()->updateFromElement();
} }
PassRefPtrWillBeRawPtr<TimeRanges> HTMLMediaElement::buffered() const TimeRanges* HTMLMediaElement::buffered() const
{ {
if (m_mediaSource) if (m_mediaSource)
return m_mediaSource->buffered(); return m_mediaSource->buffered();
...@@ -2876,7 +2876,7 @@ PassRefPtrWillBeRawPtr<TimeRanges> HTMLMediaElement::buffered() const ...@@ -2876,7 +2876,7 @@ PassRefPtrWillBeRawPtr<TimeRanges> HTMLMediaElement::buffered() const
return TimeRanges::create(webMediaPlayer()->buffered()); return TimeRanges::create(webMediaPlayer()->buffered());
} }
PassRefPtrWillBeRawPtr<TimeRanges> HTMLMediaElement::played() TimeRanges* HTMLMediaElement::played()
{ {
if (m_playing) { if (m_playing) {
double time = currentTime(); double time = currentTime();
...@@ -2890,7 +2890,7 @@ PassRefPtrWillBeRawPtr<TimeRanges> HTMLMediaElement::played() ...@@ -2890,7 +2890,7 @@ PassRefPtrWillBeRawPtr<TimeRanges> HTMLMediaElement::played()
return m_playedTimeRanges->copy(); return m_playedTimeRanges->copy();
} }
PassRefPtrWillBeRawPtr<TimeRanges> HTMLMediaElement::seekable() const TimeRanges* HTMLMediaElement::seekable() const
{ {
if (!webMediaPlayer()) if (!webMediaPlayer())
return TimeRanges::create(); return TimeRanges::create();
...@@ -2944,7 +2944,7 @@ bool HTMLMediaElement::endedPlayback(LoopCondition loopCondition) const ...@@ -2944,7 +2944,7 @@ bool HTMLMediaElement::endedPlayback(LoopCondition loopCondition) const
bool HTMLMediaElement::stoppedDueToErrors() const bool HTMLMediaElement::stoppedDueToErrors() const
{ {
if (m_readyState >= HAVE_METADATA && m_error) { if (m_readyState >= HAVE_METADATA && m_error) {
RefPtrWillBeRawPtr<TimeRanges> seekableRanges = seekable(); TimeRanges* seekableRanges = seekable();
if (!seekableRanges->contain(currentTime())) if (!seekableRanges->contain(currentTime()))
return true; return true;
} }
......
...@@ -103,7 +103,7 @@ public: ...@@ -103,7 +103,7 @@ public:
bool isPlayingRemotely() const { return m_playingRemotely; } bool isPlayingRemotely() const { return m_playingRemotely; }
// error state // error state
PassRefPtrWillBeRawPtr<MediaError> error() const; MediaError* error() const;
// network state // network state
void setSrc(const AtomicString&); void setSrc(const AtomicString&);
...@@ -117,7 +117,7 @@ public: ...@@ -117,7 +117,7 @@ public:
WebMediaPlayer::Preload preloadType() const; WebMediaPlayer::Preload preloadType() const;
WebMediaPlayer::Preload effectivePreloadType() const; WebMediaPlayer::Preload effectivePreloadType() const;
PassRefPtrWillBeRawPtr<TimeRanges> buffered() const; TimeRanges* buffered() const;
void load(); void load();
String canPlayType(const String& mimeType, const String& keySystem = String()) const; String canPlayType(const String& mimeType, const String& keySystem = String()) const;
...@@ -136,8 +136,8 @@ public: ...@@ -136,8 +136,8 @@ public:
double playbackRate() const; double playbackRate() const;
void setPlaybackRate(double); void setPlaybackRate(double);
void updatePlaybackRate(); void updatePlaybackRate();
PassRefPtrWillBeRawPtr<TimeRanges> played(); TimeRanges* played();
PassRefPtrWillBeRawPtr<TimeRanges> seekable() const; TimeRanges* seekable() const;
bool ended() const; bool ended() const;
bool autoplay() const; bool autoplay() const;
bool loop() const; bool loop() const;
...@@ -364,7 +364,7 @@ private: ...@@ -364,7 +364,7 @@ private:
void clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); void clearMediaPlayerAndAudioSourceProviderClientWithoutLocking();
bool havePotentialSourceChild(); bool havePotentialSourceChild();
void noneSupported(); void noneSupported();
void mediaEngineError(PassRefPtrWillBeRawPtr<MediaError>); void mediaEngineError(MediaError*);
void cancelPendingEventsAndCallbacks(); void cancelPendingEventsAndCallbacks();
void waitForSourceChange(); void waitForSourceChange();
void prepareToPlay(); void prepareToPlay();
...@@ -451,7 +451,7 @@ private: ...@@ -451,7 +451,7 @@ private:
Timer<HTMLMediaElement> m_progressEventTimer; Timer<HTMLMediaElement> m_progressEventTimer;
Timer<HTMLMediaElement> m_playbackProgressTimer; Timer<HTMLMediaElement> m_playbackProgressTimer;
Timer<HTMLMediaElement> m_audioTracksTimer; Timer<HTMLMediaElement> m_audioTracksTimer;
RefPtrWillBeMember<TimeRanges> m_playedTimeRanges; PersistentWillBeMember<TimeRanges> m_playedTimeRanges;
OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue;
double m_playbackRate; double m_playbackRate;
...@@ -461,7 +461,7 @@ private: ...@@ -461,7 +461,7 @@ private:
ReadyState m_readyStateMaximum; ReadyState m_readyStateMaximum;
KURL m_currentSrc; KURL m_currentSrc;
RefPtrWillBeMember<MediaError> m_error; PersistentWillBeMember<MediaError> m_error;
double m_volume; double m_volume;
double m_lastSeekTime; double m_lastSeekTime;
......
...@@ -64,8 +64,8 @@ public: ...@@ -64,8 +64,8 @@ public:
virtual void close() = 0; virtual void close() = 0;
virtual bool isClosed() const = 0; virtual bool isClosed() const = 0;
virtual double duration() const = 0; virtual double duration() const = 0;
virtual PassRefPtrWillBeRawPtr<TimeRanges> buffered() const = 0; virtual TimeRanges* buffered() const = 0;
virtual PassRefPtrWillBeRawPtr<TimeRanges> seekable() const = 0; virtual TimeRanges* seekable() const = 0;
#if !ENABLE(OILPAN) #if !ENABLE(OILPAN)
virtual void refHTMLMediaSource() = 0; virtual void refHTMLMediaSource() = 0;
virtual void derefHTMLMediaSource() = 0; virtual void derefHTMLMediaSource() = 0;
......
...@@ -84,7 +84,7 @@ void MediaController::removeMediaElement(HTMLMediaElement* element) ...@@ -84,7 +84,7 @@ void MediaController::removeMediaElement(HTMLMediaElement* element)
m_mediaElements.remove(m_mediaElements.find(element)); m_mediaElements.remove(m_mediaElements.find(element));
} }
PassRefPtrWillBeRawPtr<TimeRanges> MediaController::buffered() const TimeRanges* MediaController::buffered() const
{ {
if (m_mediaElements.isEmpty()) if (m_mediaElements.isEmpty())
return TimeRanges::create(); return TimeRanges::create();
...@@ -93,13 +93,13 @@ PassRefPtrWillBeRawPtr<TimeRanges> MediaController::buffered() const ...@@ -93,13 +93,13 @@ PassRefPtrWillBeRawPtr<TimeRanges> MediaController::buffered() const
// the intersection of the ranges of the media resources of the slaved media elements that the // the intersection of the ranges of the media resources of the slaved media elements that the
// user agent has buffered, at the time the attribute is evaluated. // user agent has buffered, at the time the attribute is evaluated.
MediaElementSequence::const_iterator it = m_mediaElements.begin(); MediaElementSequence::const_iterator it = m_mediaElements.begin();
RefPtrWillBeRawPtr<TimeRanges> bufferedRanges = (*it)->buffered(); TimeRanges* bufferedRanges = (*it)->buffered();
for (++it; it != m_mediaElements.end(); ++it) for (++it; it != m_mediaElements.end(); ++it)
bufferedRanges->intersectWith((*it)->buffered().get()); bufferedRanges->intersectWith((*it)->buffered());
return bufferedRanges; return bufferedRanges;
} }
PassRefPtrWillBeRawPtr<TimeRanges> MediaController::seekable() const TimeRanges* MediaController::seekable() const
{ {
if (m_mediaElements.isEmpty()) if (m_mediaElements.isEmpty())
return TimeRanges::create(); return TimeRanges::create();
...@@ -108,13 +108,13 @@ PassRefPtrWillBeRawPtr<TimeRanges> MediaController::seekable() const ...@@ -108,13 +108,13 @@ PassRefPtrWillBeRawPtr<TimeRanges> MediaController::seekable() const
// the intersection of the ranges of the media resources of the slaved media elements that the // the intersection of the ranges of the media resources of the slaved media elements that the
// user agent is able to seek to, at the time the attribute is evaluated. // user agent is able to seek to, at the time the attribute is evaluated.
MediaElementSequence::const_iterator it = m_mediaElements.begin(); MediaElementSequence::const_iterator it = m_mediaElements.begin();
RefPtrWillBeRawPtr<TimeRanges> seekableRanges = (*it)->seekable(); TimeRanges* seekableRanges = (*it)->seekable();
for (++it; it != m_mediaElements.end(); ++it) for (++it; it != m_mediaElements.end(); ++it)
seekableRanges->intersectWith((*it)->seekable().get()); seekableRanges->intersectWith((*it)->seekable());
return seekableRanges; return seekableRanges;
} }
PassRefPtrWillBeRawPtr<TimeRanges> MediaController::played() TimeRanges* MediaController::played()
{ {
if (m_mediaElements.isEmpty()) if (m_mediaElements.isEmpty())
return TimeRanges::create(); return TimeRanges::create();
...@@ -123,9 +123,9 @@ PassRefPtrWillBeRawPtr<TimeRanges> MediaController::played() ...@@ -123,9 +123,9 @@ PassRefPtrWillBeRawPtr<TimeRanges> MediaController::played()
// the union of the ranges of the media resources of the slaved media elements that the // the union of the ranges of the media resources of the slaved media elements that the
// user agent has so far rendered, at the time the attribute is evaluated. // user agent has so far rendered, at the time the attribute is evaluated.
MediaElementSequence::const_iterator it = m_mediaElements.begin(); MediaElementSequence::const_iterator it = m_mediaElements.begin();
RefPtrWillBeRawPtr<TimeRanges> playedRanges = (*it)->played(); TimeRanges* playedRanges = (*it)->played();
for (++it; it != m_mediaElements.end(); ++it) for (++it; it != m_mediaElements.end(); ++it)
playedRanges->unionWith((*it)->played().get()); playedRanges->unionWith((*it)->played());
return playedRanges; return playedRanges;
} }
......
...@@ -49,9 +49,9 @@ public: ...@@ -49,9 +49,9 @@ public:
void addMediaElement(HTMLMediaElement*); void addMediaElement(HTMLMediaElement*);
void removeMediaElement(HTMLMediaElement*); void removeMediaElement(HTMLMediaElement*);
PassRefPtrWillBeRawPtr<TimeRanges> buffered() const; TimeRanges* buffered() const;
PassRefPtrWillBeRawPtr<TimeRanges> seekable() const; TimeRanges* seekable() const;
PassRefPtrWillBeRawPtr<TimeRanges> played(); TimeRanges* played();
double duration() const; double duration() const;
double currentTime() const; double currentTime() const;
......
...@@ -28,12 +28,11 @@ ...@@ -28,12 +28,11 @@
#include "bindings/core/v8/ScriptWrappable.h" #include "bindings/core/v8/ScriptWrappable.h"
#include "core/CoreExport.h" #include "core/CoreExport.h"
#include "wtf/PassRefPtr.h" #include "platform/heap/Handle.h"
#include "wtf/RefCounted.h"
namespace blink { namespace blink {
class CORE_EXPORT MediaError final : public RefCountedWillBeGarbageCollectedFinalized<MediaError>, public ScriptWrappable { class CORE_EXPORT MediaError final : public GarbageCollected<MediaError>, public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO(); DEFINE_WRAPPERTYPEINFO();
public: public:
enum Code { enum Code {
...@@ -43,9 +42,9 @@ public: ...@@ -43,9 +42,9 @@ public:
MEDIA_ERR_SRC_NOT_SUPPORTED, MEDIA_ERR_SRC_NOT_SUPPORTED,
}; };
static PassRefPtrWillBeRawPtr<MediaError> create(Code code) static MediaError* create(Code code)
{ {
return adoptRefWillBeNoop(new MediaError(code)); return new MediaError(code);
} }
Code code() const { return m_code; } Code code() const { return m_code; }
......
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
// https://html.spec.whatwg.org/#error-codes // https://html.spec.whatwg.org/#error-codes
[ [
GarbageCollected,
RuntimeEnabled=Media, RuntimeEnabled=Media,
WillBeGarbageCollected,
] interface MediaError { ] interface MediaError {
const unsigned short MEDIA_ERR_ABORTED = 1; const unsigned short MEDIA_ERR_ABORTED = 1;
const unsigned short MEDIA_ERR_NETWORK = 2; const unsigned short MEDIA_ERR_NETWORK = 2;
......
...@@ -29,12 +29,10 @@ ...@@ -29,12 +29,10 @@
#include "bindings/core/v8/ScriptWrappable.h" #include "bindings/core/v8/ScriptWrappable.h"
#include "core/CoreExport.h" #include "core/CoreExport.h"
#include "platform/heap/Handle.h" #include "platform/heap/Handle.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
namespace blink { namespace blink {
class CORE_EXPORT MediaKeyError final : public RefCountedWillBeGarbageCollectedFinalized<MediaKeyError>, public ScriptWrappable { class CORE_EXPORT MediaKeyError final : public GarbageCollected<MediaKeyError>, public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO(); DEFINE_WRAPPERTYPEINFO();
public: public:
enum { enum {
...@@ -47,9 +45,9 @@ public: ...@@ -47,9 +45,9 @@ public:
}; };
typedef unsigned short Code; typedef unsigned short Code;
static PassRefPtrWillBeRawPtr<MediaKeyError> create(Code code, unsigned systemCode = 0) static MediaKeyError* create(Code code, unsigned systemCode = 0)
{ {
return adoptRefWillBeNoop(new MediaKeyError(code, systemCode)); return new MediaKeyError(code, systemCode);
} }
Code code() const { return m_code; } Code code() const { return m_code; }
......
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
*/ */
[ [
GarbageCollected,
RuntimeEnabled=PrefixedEncryptedMedia, RuntimeEnabled=PrefixedEncryptedMedia,
WillBeGarbageCollected,
] interface MediaKeyError { ] interface MediaKeyError {
const unsigned short MEDIA_KEYERR_UNKNOWN = 1; const unsigned short MEDIA_KEYERR_UNKNOWN = 1;
const unsigned short MEDIA_KEYERR_CLIENT = 2; const unsigned short MEDIA_KEYERR_CLIENT = 2;
......
...@@ -70,7 +70,7 @@ private: ...@@ -70,7 +70,7 @@ private:
RefPtr<DOMUint8Array> m_initData; RefPtr<DOMUint8Array> m_initData;
RefPtr<DOMUint8Array> m_message; RefPtr<DOMUint8Array> m_message;
String m_defaultURL; String m_defaultURL;
RefPtrWillBeMember<MediaKeyError> m_errorCode; PersistentWillBeMember<MediaKeyError> m_errorCode;
unsigned short m_systemCode; unsigned short m_systemCode;
}; };
......
...@@ -39,31 +39,31 @@ TimeRanges::TimeRanges(double start, double end) ...@@ -39,31 +39,31 @@ TimeRanges::TimeRanges(double start, double end)
add(start, end); add(start, end);
} }
PassRefPtrWillBeRawPtr<TimeRanges> TimeRanges::create(const blink::WebTimeRanges& webRanges) TimeRanges* TimeRanges::create(const blink::WebTimeRanges& webRanges)
{ {
RefPtrWillBeRawPtr<TimeRanges> ranges = TimeRanges::create(); TimeRanges* ranges = TimeRanges::create();
unsigned size = webRanges.size(); unsigned size = webRanges.size();
for (unsigned i = 0; i < size; ++i) for (unsigned i = 0; i < size; ++i)
ranges->add(webRanges[i].start, webRanges[i].end); ranges->add(webRanges[i].start, webRanges[i].end);
return ranges.release(); return ranges;
} }
PassRefPtrWillBeRawPtr<TimeRanges> TimeRanges::copy() const TimeRanges* TimeRanges::copy() const
{ {
RefPtrWillBeRawPtr<TimeRanges> newSession = TimeRanges::create(); TimeRanges* newSession = TimeRanges::create();
unsigned size = m_ranges.size(); unsigned size = m_ranges.size();
for (unsigned i = 0; i < size; i++) for (unsigned i = 0; i < size; i++)
newSession->add(m_ranges[i].m_start, m_ranges[i].m_end); newSession->add(m_ranges[i].m_start, m_ranges[i].m_end);
return newSession.release(); return newSession;
} }
void TimeRanges::invert() void TimeRanges::invert()
{ {
RefPtrWillBeRawPtr<TimeRanges> inverted = TimeRanges::create(); TimeRanges* inverted = TimeRanges::create();
double posInf = std::numeric_limits<double>::infinity(); double posInf = std::numeric_limits<double>::infinity();
double negInf = -std::numeric_limits<double>::infinity(); double negInf = -std::numeric_limits<double>::infinity();
...@@ -92,18 +92,18 @@ void TimeRanges::intersectWith(const TimeRanges* other) ...@@ -92,18 +92,18 @@ void TimeRanges::intersectWith(const TimeRanges* other)
if (other == this) if (other == this)
return; return;
RefPtrWillBeRawPtr<TimeRanges> invertedOther = other->copy(); TimeRanges* invertedOther = other->copy();
invertedOther->invert(); invertedOther->invert();
invert(); invert();
unionWith(invertedOther.get()); unionWith(invertedOther);
invert(); invert();
} }
void TimeRanges::unionWith(const TimeRanges* other) void TimeRanges::unionWith(const TimeRanges* other)
{ {
ASSERT(other); ASSERT(other);
RefPtrWillBeRawPtr<TimeRanges> unioned = copy(); TimeRanges* unioned = copy();
for (size_t index = 0; index < other->m_ranges.size(); ++index) { for (size_t index = 0; index < other->m_ranges.size(); ++index) {
const Range& range = other->m_ranges[index]; const Range& range = other->m_ranges[index];
unioned->add(range.m_start, range.m_end); unioned->add(range.m_start, range.m_end);
......
...@@ -28,9 +28,8 @@ ...@@ -28,9 +28,8 @@
#include "bindings/core/v8/ScriptWrappable.h" #include "bindings/core/v8/ScriptWrappable.h"
#include "core/CoreExport.h" #include "core/CoreExport.h"
#include "platform/heap/Handle.h"
#include "public/platform/WebTimeRange.h" #include "public/platform/WebTimeRange.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
#include "wtf/Vector.h" #include "wtf/Vector.h"
#include <algorithm> #include <algorithm>
...@@ -39,7 +38,7 @@ namespace blink { ...@@ -39,7 +38,7 @@ namespace blink {
class ExceptionState; class ExceptionState;
class CORE_EXPORT TimeRanges : public RefCountedWillBeGarbageCollectedFinalized<TimeRanges>, public ScriptWrappable { class CORE_EXPORT TimeRanges : public GarbageCollectedFinalized<TimeRanges>, public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO(); DEFINE_WRAPPERTYPEINFO();
public: public:
// We consider all the Ranges to be semi-bounded as follow: [start, end[ // We consider all the Ranges to be semi-bounded as follow: [start, end[
...@@ -85,17 +84,17 @@ public: ...@@ -85,17 +84,17 @@ public:
} }
}; };
static PassRefPtrWillBeRawPtr<TimeRanges> create() static TimeRanges* create()
{ {
return adoptRefWillBeNoop(new TimeRanges); return new TimeRanges;
} }
static PassRefPtrWillBeRawPtr<TimeRanges> create(double start, double end) static TimeRanges* create(double start, double end)
{ {
return adoptRefWillBeNoop(new TimeRanges(start, end)); return new TimeRanges(start, end);
} }
static PassRefPtrWillBeRawPtr<TimeRanges> create(const blink::WebTimeRanges&); static TimeRanges* create(const WebTimeRanges&);
PassRefPtrWillBeRawPtr<TimeRanges> copy() const; TimeRanges* copy() const;
void intersectWith(const TimeRanges*); void intersectWith(const TimeRanges*);
void unionWith(const TimeRanges*); void unionWith(const TimeRanges*);
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
// https://html.spec.whatwg.org/#time-ranges // https://html.spec.whatwg.org/#time-ranges
[ [
WillBeGarbageCollected, GarbageCollected,
RuntimeEnabled=Media RuntimeEnabled=Media
] interface TimeRanges { ] interface TimeRanges {
readonly attribute unsigned long length; readonly attribute unsigned long length;
......
...@@ -72,8 +72,8 @@ TEST(TimeRangesTest, CreateFromWebTimeRanges) ...@@ -72,8 +72,8 @@ TEST(TimeRangesTest, CreateFromWebTimeRanges)
TEST(TimeRangesTest, AddOrder) TEST(TimeRangesTest, AddOrder)
{ {
RefPtrWillBeRawPtr<TimeRanges> rangeA = TimeRanges::create(); TimeRanges* rangeA = TimeRanges::create();
RefPtrWillBeRawPtr<TimeRanges> rangeB = TimeRanges::create(); TimeRanges* rangeB = TimeRanges::create();
rangeA->add(0, 2); rangeA->add(0, 2);
rangeA->add(3, 4); rangeA->add(3, 4);
...@@ -91,7 +91,7 @@ TEST(TimeRangesTest, AddOrder) ...@@ -91,7 +91,7 @@ TEST(TimeRangesTest, AddOrder)
TEST(TimeRangesTest, OverlappingAdds) TEST(TimeRangesTest, OverlappingAdds)
{ {
RefPtrWillBeRawPtr<TimeRanges> ranges = TimeRanges::create(); TimeRanges* ranges = TimeRanges::create();
ranges->add(0, 2); ranges->add(0, 2);
ranges->add(10, 11); ranges->add(10, 11);
...@@ -121,24 +121,24 @@ TEST(TimeRangesTest, OverlappingAdds) ...@@ -121,24 +121,24 @@ TEST(TimeRangesTest, OverlappingAdds)
TEST(TimeRangesTest, IntersectWith_Self) TEST(TimeRangesTest, IntersectWith_Self)
{ {
RefPtrWillBeRawPtr<TimeRanges> ranges = TimeRanges::create(0, 2); TimeRanges* ranges = TimeRanges::create(0, 2);
ASSERT_RANGE("{ [0,2) }", ranges); ASSERT_RANGE("{ [0,2) }", ranges);
ranges->intersectWith(ranges.get()); ranges->intersectWith(ranges);
ASSERT_RANGE("{ [0,2) }", ranges); ASSERT_RANGE("{ [0,2) }", ranges);
} }
TEST(TimeRangesTest, IntersectWith_IdenticalRange) TEST(TimeRangesTest, IntersectWith_IdenticalRange)
{ {
RefPtrWillBeRawPtr<TimeRanges> rangesA = TimeRanges::create(0, 2); TimeRanges* rangesA = TimeRanges::create(0, 2);
RefPtrWillBeRawPtr<TimeRanges> rangesB = rangesA->copy(); TimeRanges* rangesB = rangesA->copy();
ASSERT_RANGE("{ [0,2) }", rangesA); ASSERT_RANGE("{ [0,2) }", rangesA);
ASSERT_RANGE("{ [0,2) }", rangesB); ASSERT_RANGE("{ [0,2) }", rangesB);
rangesA->intersectWith(rangesB.get()); rangesA->intersectWith(rangesB);
ASSERT_RANGE("{ [0,2) }", rangesA); ASSERT_RANGE("{ [0,2) }", rangesA);
ASSERT_RANGE("{ [0,2) }", rangesB); ASSERT_RANGE("{ [0,2) }", rangesB);
...@@ -146,13 +146,13 @@ TEST(TimeRangesTest, IntersectWith_IdenticalRange) ...@@ -146,13 +146,13 @@ TEST(TimeRangesTest, IntersectWith_IdenticalRange)
TEST(TimeRangesTest, IntersectWith_Empty) TEST(TimeRangesTest, IntersectWith_Empty)
{ {
RefPtrWillBeRawPtr<TimeRanges> rangesA = TimeRanges::create(0, 2); TimeRanges* rangesA = TimeRanges::create(0, 2);
RefPtrWillBeRawPtr<TimeRanges> rangesB = TimeRanges::create(); TimeRanges* rangesB = TimeRanges::create();
ASSERT_RANGE("{ [0,2) }", rangesA); ASSERT_RANGE("{ [0,2) }", rangesA);
ASSERT_RANGE("{ }", rangesB); ASSERT_RANGE("{ }", rangesB);
rangesA->intersectWith(rangesB.get()); rangesA->intersectWith(rangesB);
ASSERT_RANGE("{ }", rangesA); ASSERT_RANGE("{ }", rangesA);
ASSERT_RANGE("{ }", rangesB); ASSERT_RANGE("{ }", rangesB);
...@@ -160,8 +160,8 @@ TEST(TimeRangesTest, IntersectWith_Empty) ...@@ -160,8 +160,8 @@ TEST(TimeRangesTest, IntersectWith_Empty)
TEST(TimeRangesTest, IntersectWith_DisjointRanges1) TEST(TimeRangesTest, IntersectWith_DisjointRanges1)
{ {
RefPtrWillBeRawPtr<TimeRanges> rangesA = TimeRanges::create(); TimeRanges* rangesA = TimeRanges::create();
RefPtrWillBeRawPtr<TimeRanges> rangesB = TimeRanges::create(); TimeRanges* rangesB = TimeRanges::create();
rangesA->add(0, 1); rangesA->add(0, 1);
rangesA->add(4, 5); rangesA->add(4, 5);
...@@ -172,7 +172,7 @@ TEST(TimeRangesTest, IntersectWith_DisjointRanges1) ...@@ -172,7 +172,7 @@ TEST(TimeRangesTest, IntersectWith_DisjointRanges1)
ASSERT_RANGE("{ [0,1) [4,5) }", rangesA); ASSERT_RANGE("{ [0,1) [4,5) }", rangesA);
ASSERT_RANGE("{ [2,3) [6,7) }", rangesB); ASSERT_RANGE("{ [2,3) [6,7) }", rangesB);
rangesA->intersectWith(rangesB.get()); rangesA->intersectWith(rangesB);
ASSERT_RANGE("{ }", rangesA); ASSERT_RANGE("{ }", rangesA);
ASSERT_RANGE("{ [2,3) [6,7) }", rangesB); ASSERT_RANGE("{ [2,3) [6,7) }", rangesB);
...@@ -180,8 +180,8 @@ TEST(TimeRangesTest, IntersectWith_DisjointRanges1) ...@@ -180,8 +180,8 @@ TEST(TimeRangesTest, IntersectWith_DisjointRanges1)
TEST(TimeRangesTest, IntersectWith_DisjointRanges2) TEST(TimeRangesTest, IntersectWith_DisjointRanges2)
{ {
RefPtrWillBeRawPtr<TimeRanges> rangesA = TimeRanges::create(); TimeRanges* rangesA = TimeRanges::create();
RefPtrWillBeRawPtr<TimeRanges> rangesB = TimeRanges::create(); TimeRanges* rangesB = TimeRanges::create();
rangesA->add(0, 1); rangesA->add(0, 1);
rangesA->add(4, 5); rangesA->add(4, 5);
...@@ -192,7 +192,7 @@ TEST(TimeRangesTest, IntersectWith_DisjointRanges2) ...@@ -192,7 +192,7 @@ TEST(TimeRangesTest, IntersectWith_DisjointRanges2)
ASSERT_RANGE("{ [0,1) [4,5) }", rangesA); ASSERT_RANGE("{ [0,1) [4,5) }", rangesA);
ASSERT_RANGE("{ [1,4) [5,7) }", rangesB); ASSERT_RANGE("{ [1,4) [5,7) }", rangesB);
rangesA->intersectWith(rangesB.get()); rangesA->intersectWith(rangesB);
ASSERT_RANGE("{ }", rangesA); ASSERT_RANGE("{ }", rangesA);
ASSERT_RANGE("{ [1,4) [5,7) }", rangesB); ASSERT_RANGE("{ [1,4) [5,7) }", rangesB);
...@@ -200,8 +200,8 @@ TEST(TimeRangesTest, IntersectWith_DisjointRanges2) ...@@ -200,8 +200,8 @@ TEST(TimeRangesTest, IntersectWith_DisjointRanges2)
TEST(TimeRangesTest, IntersectWith_CompleteOverlap1) TEST(TimeRangesTest, IntersectWith_CompleteOverlap1)
{ {
RefPtrWillBeRawPtr<TimeRanges> rangesA = TimeRanges::create(); TimeRanges* rangesA = TimeRanges::create();
RefPtrWillBeRawPtr<TimeRanges> rangesB = TimeRanges::create(); TimeRanges* rangesB = TimeRanges::create();
rangesA->add(1, 3); rangesA->add(1, 3);
rangesA->add(4, 5); rangesA->add(4, 5);
...@@ -212,7 +212,7 @@ TEST(TimeRangesTest, IntersectWith_CompleteOverlap1) ...@@ -212,7 +212,7 @@ TEST(TimeRangesTest, IntersectWith_CompleteOverlap1)
ASSERT_RANGE("{ [1,3) [4,5) [6,9) }", rangesA); ASSERT_RANGE("{ [1,3) [4,5) [6,9) }", rangesA);
ASSERT_RANGE("{ [0,10) }", rangesB); ASSERT_RANGE("{ [0,10) }", rangesB);
rangesA->intersectWith(rangesB.get()); rangesA->intersectWith(rangesB);
ASSERT_RANGE("{ [1,3) [4,5) [6,9) }", rangesA); ASSERT_RANGE("{ [1,3) [4,5) [6,9) }", rangesA);
ASSERT_RANGE("{ [0,10) }", rangesB); ASSERT_RANGE("{ [0,10) }", rangesB);
...@@ -220,8 +220,8 @@ TEST(TimeRangesTest, IntersectWith_CompleteOverlap1) ...@@ -220,8 +220,8 @@ TEST(TimeRangesTest, IntersectWith_CompleteOverlap1)
TEST(TimeRangesTest, IntersectWith_CompleteOverlap2) TEST(TimeRangesTest, IntersectWith_CompleteOverlap2)
{ {
RefPtrWillBeRawPtr<TimeRanges> rangesA = TimeRanges::create(); TimeRanges* rangesA = TimeRanges::create();
RefPtrWillBeRawPtr<TimeRanges> rangesB = TimeRanges::create(); TimeRanges* rangesB = TimeRanges::create();
rangesA->add(1, 3); rangesA->add(1, 3);
rangesA->add(4, 5); rangesA->add(4, 5);
...@@ -232,7 +232,7 @@ TEST(TimeRangesTest, IntersectWith_CompleteOverlap2) ...@@ -232,7 +232,7 @@ TEST(TimeRangesTest, IntersectWith_CompleteOverlap2)
ASSERT_RANGE("{ [1,3) [4,5) [6,9) }", rangesA); ASSERT_RANGE("{ [1,3) [4,5) [6,9) }", rangesA);
ASSERT_RANGE("{ [1,9) }", rangesB); ASSERT_RANGE("{ [1,9) }", rangesB);
rangesA->intersectWith(rangesB.get()); rangesA->intersectWith(rangesB);
ASSERT_RANGE("{ [1,3) [4,5) [6,9) }", rangesA); ASSERT_RANGE("{ [1,3) [4,5) [6,9) }", rangesA);
ASSERT_RANGE("{ [1,9) }", rangesB); ASSERT_RANGE("{ [1,9) }", rangesB);
...@@ -240,8 +240,8 @@ TEST(TimeRangesTest, IntersectWith_CompleteOverlap2) ...@@ -240,8 +240,8 @@ TEST(TimeRangesTest, IntersectWith_CompleteOverlap2)
TEST(TimeRangesTest, IntersectWith_Gaps1) TEST(TimeRangesTest, IntersectWith_Gaps1)
{ {
RefPtrWillBeRawPtr<TimeRanges> rangesA = TimeRanges::create(); TimeRanges* rangesA = TimeRanges::create();
RefPtrWillBeRawPtr<TimeRanges> rangesB = TimeRanges::create(); TimeRanges* rangesB = TimeRanges::create();
rangesA->add(0, 2); rangesA->add(0, 2);
rangesA->add(4, 6); rangesA->add(4, 6);
...@@ -251,7 +251,7 @@ TEST(TimeRangesTest, IntersectWith_Gaps1) ...@@ -251,7 +251,7 @@ TEST(TimeRangesTest, IntersectWith_Gaps1)
ASSERT_RANGE("{ [0,2) [4,6) }", rangesA); ASSERT_RANGE("{ [0,2) [4,6) }", rangesA);
ASSERT_RANGE("{ [1,5) }", rangesB); ASSERT_RANGE("{ [1,5) }", rangesB);
rangesA->intersectWith(rangesB.get()); rangesA->intersectWith(rangesB);
ASSERT_RANGE("{ [1,2) [4,5) }", rangesA); ASSERT_RANGE("{ [1,2) [4,5) }", rangesA);
ASSERT_RANGE("{ [1,5) }", rangesB); ASSERT_RANGE("{ [1,5) }", rangesB);
...@@ -259,8 +259,8 @@ TEST(TimeRangesTest, IntersectWith_Gaps1) ...@@ -259,8 +259,8 @@ TEST(TimeRangesTest, IntersectWith_Gaps1)
TEST(TimeRangesTest, IntersectWith_Gaps2) TEST(TimeRangesTest, IntersectWith_Gaps2)
{ {
RefPtrWillBeRawPtr<TimeRanges> rangesA = TimeRanges::create(); TimeRanges* rangesA = TimeRanges::create();
RefPtrWillBeRawPtr<TimeRanges> rangesB = TimeRanges::create(); TimeRanges* rangesB = TimeRanges::create();
rangesA->add(0, 2); rangesA->add(0, 2);
rangesA->add(4, 6); rangesA->add(4, 6);
...@@ -271,7 +271,7 @@ TEST(TimeRangesTest, IntersectWith_Gaps2) ...@@ -271,7 +271,7 @@ TEST(TimeRangesTest, IntersectWith_Gaps2)
ASSERT_RANGE("{ [0,2) [4,6) [8,10) }", rangesA); ASSERT_RANGE("{ [0,2) [4,6) [8,10) }", rangesA);
ASSERT_RANGE("{ [1,9) }", rangesB); ASSERT_RANGE("{ [1,9) }", rangesB);
rangesA->intersectWith(rangesB.get()); rangesA->intersectWith(rangesB);
ASSERT_RANGE("{ [1,2) [4,6) [8,9) }", rangesA); ASSERT_RANGE("{ [1,2) [4,6) [8,9) }", rangesA);
ASSERT_RANGE("{ [1,9) }", rangesB); ASSERT_RANGE("{ [1,9) }", rangesB);
...@@ -279,8 +279,8 @@ TEST(TimeRangesTest, IntersectWith_Gaps2) ...@@ -279,8 +279,8 @@ TEST(TimeRangesTest, IntersectWith_Gaps2)
TEST(TimeRangesTest, IntersectWith_Gaps3) TEST(TimeRangesTest, IntersectWith_Gaps3)
{ {
RefPtrWillBeRawPtr<TimeRanges> rangesA = TimeRanges::create(); TimeRanges* rangesA = TimeRanges::create();
RefPtrWillBeRawPtr<TimeRanges> rangesB = TimeRanges::create(); TimeRanges* rangesB = TimeRanges::create();
rangesA->add(0, 2); rangesA->add(0, 2);
rangesA->add(4, 7); rangesA->add(4, 7);
...@@ -292,7 +292,7 @@ TEST(TimeRangesTest, IntersectWith_Gaps3) ...@@ -292,7 +292,7 @@ TEST(TimeRangesTest, IntersectWith_Gaps3)
ASSERT_RANGE("{ [0,2) [4,7) [8,10) }", rangesA); ASSERT_RANGE("{ [0,2) [4,7) [8,10) }", rangesA);
ASSERT_RANGE("{ [1,5) [6,9) }", rangesB); ASSERT_RANGE("{ [1,5) [6,9) }", rangesB);
rangesA->intersectWith(rangesB.get()); rangesA->intersectWith(rangesB);
ASSERT_RANGE("{ [1,2) [4,5) [6,7) [8,9) }", rangesA); ASSERT_RANGE("{ [1,2) [4,5) [6,7) [8,9) }", rangesA);
ASSERT_RANGE("{ [1,5) [6,9) }", rangesB); ASSERT_RANGE("{ [1,5) [6,9) }", rangesB);
...@@ -300,7 +300,7 @@ TEST(TimeRangesTest, IntersectWith_Gaps3) ...@@ -300,7 +300,7 @@ TEST(TimeRangesTest, IntersectWith_Gaps3)
TEST(TimeRangesTest, Nearest) TEST(TimeRangesTest, Nearest)
{ {
RefPtrWillBeRawPtr<TimeRanges> ranges = TimeRanges::create(); TimeRanges* ranges = TimeRanges::create();
ranges->add(0, 2); ranges->add(0, 2);
ranges->add(5, 7); ranges->add(5, 7);
......
...@@ -298,7 +298,7 @@ void MediaControlsPainter::paintMediaSliderInternal(LayoutObject* object, const ...@@ -298,7 +298,7 @@ void MediaControlsPainter::paintMediaSliderInternal(LayoutObject* object, const
// Draw the buffered range. Since the element may have multiple buffered ranges and it'd be // Draw the buffered range. Since the element may have multiple buffered ranges and it'd be
// distracting/'busy' to show all of them, show only the buffered range containing the current play head. // distracting/'busy' to show all of them, show only the buffered range containing the current play head.
RefPtrWillBeRawPtr<TimeRanges> bufferedTimeRanges = mediaElement->buffered(); TimeRanges* bufferedTimeRanges = mediaElement->buffered();
float duration = mediaElement->duration(); float duration = mediaElement->duration();
float currentTime = mediaElement->currentTime(); float currentTime = mediaElement->currentTime();
if (std::isnan(duration) || std::isinf(duration) || !duration || std::isnan(currentTime)) if (std::isnan(duration) || std::isinf(duration) || !duration || std::isnan(currentTime))
......
...@@ -300,11 +300,11 @@ double MediaSource::duration() const ...@@ -300,11 +300,11 @@ double MediaSource::duration() const
return isClosed() ? std::numeric_limits<float>::quiet_NaN() : m_webMediaSource->duration(); return isClosed() ? std::numeric_limits<float>::quiet_NaN() : m_webMediaSource->duration();
} }
PassRefPtrWillBeRawPtr<TimeRanges> MediaSource::buffered() const TimeRanges* MediaSource::buffered() const
{ {
// Implements MediaSource algorithm for HTMLMediaElement.buffered. // Implements MediaSource algorithm for HTMLMediaElement.buffered.
// https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#htmlmediaelement-extensions // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#htmlmediaelement-extensions
WillBeHeapVector<RefPtrWillBeMember<TimeRanges>> ranges(m_activeSourceBuffers->length()); HeapVector<Member<TimeRanges>> ranges(m_activeSourceBuffers->length());
for (size_t i = 0; i < m_activeSourceBuffers->length(); ++i) for (size_t i = 0; i < m_activeSourceBuffers->length(); ++i)
ranges[i] = m_activeSourceBuffers->item(i)->buffered(ASSERT_NO_EXCEPTION); ranges[i] = m_activeSourceBuffers->item(i)->buffered(ASSERT_NO_EXCEPTION);
...@@ -326,7 +326,7 @@ PassRefPtrWillBeRawPtr<TimeRanges> MediaSource::buffered() const ...@@ -326,7 +326,7 @@ PassRefPtrWillBeRawPtr<TimeRanges> MediaSource::buffered() const
return TimeRanges::create(); return TimeRanges::create();
// 4. Let intersection ranges equal a TimeRange object containing a single range from 0 to highest end time. // 4. Let intersection ranges equal a TimeRange object containing a single range from 0 to highest end time.
RefPtrWillBeRawPtr<TimeRanges> intersectionRanges = TimeRanges::create(0, highestEndTime); TimeRanges* intersectionRanges = TimeRanges::create(0, highestEndTime);
// 5. For each SourceBuffer object in activeSourceBuffers run the following steps: // 5. For each SourceBuffer object in activeSourceBuffers run the following steps:
bool ended = readyState() == endedKeyword(); bool ended = readyState() == endedKeyword();
...@@ -343,10 +343,10 @@ PassRefPtrWillBeRawPtr<TimeRanges> MediaSource::buffered() const ...@@ -343,10 +343,10 @@ PassRefPtrWillBeRawPtr<TimeRanges> MediaSource::buffered() const
intersectionRanges->intersectWith(sourceRanges); intersectionRanges->intersectWith(sourceRanges);
} }
return intersectionRanges.release(); return intersectionRanges;
} }
PassRefPtrWillBeRawPtr<TimeRanges> MediaSource::seekable() const TimeRanges* MediaSource::seekable() const
{ {
// Implements MediaSource algorithm for HTMLMediaElement.seekable. // Implements MediaSource algorithm for HTMLMediaElement.seekable.
// https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#htmlmediaelement-extensions // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#htmlmediaelement-extensions
...@@ -358,7 +358,7 @@ PassRefPtrWillBeRawPtr<TimeRanges> MediaSource::seekable() const ...@@ -358,7 +358,7 @@ PassRefPtrWillBeRawPtr<TimeRanges> MediaSource::seekable() const
// If duration equals positive Infinity: // If duration equals positive Infinity:
if (sourceDuration == std::numeric_limits<double>::infinity()) { if (sourceDuration == std::numeric_limits<double>::infinity()) {
RefPtrWillBeRawPtr<TimeRanges> buffered = m_attachedElement->buffered(); TimeRanges* buffered = m_attachedElement->buffered();
// 1. If the HTMLMediaElement.buffered attribute returns an empty TimeRanges object, then // 1. If the HTMLMediaElement.buffered attribute returns an empty TimeRanges object, then
// return an empty TimeRanges object and abort these steps. // return an empty TimeRanges object and abort these steps.
......
...@@ -79,8 +79,8 @@ public: ...@@ -79,8 +79,8 @@ public:
void close() override; void close() override;
bool isClosed() const override; bool isClosed() const override;
double duration() const override; double duration() const override;
PassRefPtrWillBeRawPtr<TimeRanges> buffered() const override; TimeRanges* buffered() const override;
PassRefPtrWillBeRawPtr<TimeRanges> seekable() const override; TimeRanges* seekable() const override;
#if !ENABLE(OILPAN) #if !ENABLE(OILPAN)
void refHTMLMediaSource() override { ref(); } void refHTMLMediaSource() override { ref(); }
void derefHTMLMediaSource() override { deref(); } void derefHTMLMediaSource() override { deref(); }
......
...@@ -159,7 +159,7 @@ void SourceBuffer::setMode(const AtomicString& newMode, ExceptionState& exceptio ...@@ -159,7 +159,7 @@ void SourceBuffer::setMode(const AtomicString& newMode, ExceptionState& exceptio
m_mode = newMode; m_mode = newMode;
} }
PassRefPtrWillBeRawPtr<TimeRanges> SourceBuffer::buffered(ExceptionState& exceptionState) const TimeRanges* SourceBuffer::buffered(ExceptionState& exceptionState) const
{ {
// Section 3.1 buffered attribute steps. // Section 3.1 buffered attribute steps.
// 1. If this object has been removed from the sourceBuffers attribute of the parent media source then throw an // 1. If this object has been removed from the sourceBuffers attribute of the parent media source then throw an
......
...@@ -72,7 +72,7 @@ public: ...@@ -72,7 +72,7 @@ public:
const AtomicString& mode() const { return m_mode; } const AtomicString& mode() const { return m_mode; }
void setMode(const AtomicString&, ExceptionState&); void setMode(const AtomicString&, ExceptionState&);
bool updating() const { return m_updating; } bool updating() const { return m_updating; }
PassRefPtrWillBeRawPtr<TimeRanges> buffered(ExceptionState&) const; TimeRanges* buffered(ExceptionState&) const;
double timestampOffset() const; double timestampOffset() const;
void setTimestampOffset(double, ExceptionState&); void setTimestampOffset(double, ExceptionState&);
void appendBuffer(PassRefPtr<DOMArrayBuffer> data, ExceptionState&); void appendBuffer(PassRefPtr<DOMArrayBuffer> data, ExceptionState&);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment