Chromium Code Reviews| Index: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| index a23c6a4f7feeac806f2ce01e6a46fe57afe6bc7a..8a5a0d4695ee3da9b9abd9369325e4829881275a 100644 |
| --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| @@ -94,6 +94,8 @@ |
| #include "wtf/text/CString.h" |
| #include <limits> |
| +#define MEDIA_LOG_LEVEL 3 |
| + |
| #ifndef LOG_MEDIA_EVENTS |
| // Default to not logging events because so many are generated they can overwhelm the rest of |
| // the logging. |
| @@ -126,7 +128,6 @@ enum MediaControlsShow { |
| MediaControlsShowMax |
| }; |
| -#if !LOG_DISABLED |
| String urlForLoggingMedia(const KURL& url) |
| { |
| static const unsigned maximumURLLengthForLogging = 128; |
| @@ -140,7 +141,6 @@ const char* boolString(bool val) |
| { |
| return val ? "true" : "false"; |
| } |
| -#endif |
| DocumentElementSetMap& documentToElementSetMap() |
| { |
| @@ -433,7 +433,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum |
| { |
| ThreadState::current()->registerPreFinalizer(this); |
| - WTF_LOG(Media, "HTMLMediaElement::HTMLMediaElement(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "HTMLMediaElement(" << (void*)this << ")"; |
| if (document.settings() && document.settings()->mediaPlaybackRequiresUserGesture()) |
| m_userGestureRequiredForPlay = true; |
| @@ -446,7 +446,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum |
| HTMLMediaElement::~HTMLMediaElement() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::~HTMLMediaElement(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "~HTMLMediaElement(" << (void*)this << ")"; |
| // m_audioSourceNode is explicitly cleared by AudioNode::dispose(). |
| // Since AudioNode::dispose() is guaranteed to be always called before |
| @@ -471,7 +471,7 @@ void HTMLMediaElement::dispose() |
| void HTMLMediaElement::didMoveToNewDocument(Document& oldDocument) |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::didMoveToNewDocument(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "didMoveToNewDocument(" << (void*)this << ")"; |
| if (m_shouldDelayLoadEvent) { |
| document().incrementLoadEventDelayCount(); |
| @@ -558,7 +558,7 @@ LayoutObject* HTMLMediaElement::createLayoutObject(const ComputedStyle&) |
| Node::InsertionNotificationRequest HTMLMediaElement::insertedInto(ContainerNode* insertionPoint) |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::insertedInto(%p, %p)", this, insertionPoint); |
| + DVLOG(MEDIA_LOG_LEVEL) << "insertedInto(" << (void*)this << ", " << insertionPoint << ")"; |
| HTMLElement::insertedInto(insertionPoint); |
| if (insertionPoint->inShadowIncludingDocument()) { |
| @@ -579,7 +579,7 @@ void HTMLMediaElement::didNotifySubtreeInsertionsToDocument() |
| void HTMLMediaElement::removedFrom(ContainerNode* insertionPoint) |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::removedFrom(%p, %p)", this, insertionPoint); |
| + DVLOG(MEDIA_LOG_LEVEL) << "removedFrom(" << (void*)this << ", " << insertionPoint << ")"; |
| HTMLElement::removedFrom(insertionPoint); |
| if (insertionPoint->inActiveDocument()) { |
| @@ -605,7 +605,7 @@ void HTMLMediaElement::didRecalcStyle(StyleRecalcChange) |
| void HTMLMediaElement::scheduleTextTrackResourceLoad() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::scheduleTextTrackResourceLoad(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "scheduleTextTrackResourceLoad(" << (void*)this << ")"; |
| m_pendingActionFlags |= LoadTextTrackResource; |
| @@ -628,7 +628,7 @@ void HTMLMediaElement::scheduleEvent(const AtomicString& eventName) |
| void HTMLMediaElement::scheduleEvent(Event* event) |
| { |
| #if LOG_MEDIA_EVENTS |
| - WTF_LOG(Media, "HTMLMediaElement::scheduleEvent(%p) - scheduling '%s'", this, event->type().ascii().data()); |
| + DVLOG(MEDIA_LOG_LEVEL) << "scheduleEvent(" << (void*)this << ")" << " - scheduling '" << event->type() << "'"; |
| #endif |
| m_asyncEventQueue->enqueueEvent(event); |
| } |
| @@ -687,14 +687,14 @@ String HTMLMediaElement::canPlayType(const String& mimeType) const |
| break; |
| } |
| - WTF_LOG(Media, "HTMLMediaElement::canPlayType(%p, %s) -> %s", this, mimeType.utf8().data(), canPlay.utf8().data()); |
| + DVLOG(MEDIA_LOG_LEVEL) << "canPlayType(" << (void*)this << ", " << mimeType << ") -> " << canPlay; |
| return canPlay; |
| } |
| void HTMLMediaElement::load() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::load(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "load(" << (void*)this << ")"; |
| m_autoplayHelper->loadMethodCalled(); |
| @@ -708,7 +708,7 @@ void HTMLMediaElement::load() |
| // in resource selection algorithm. |
| void HTMLMediaElement::invokeLoadAlgorithm() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::invokeLoadAlgorithm(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "invokeLoadAlgorithm(" << (void*)this << ")"; |
| // Perform the cleanup required for the resource load algorithm to run. |
| stopPeriodicTimers(); |
| @@ -796,7 +796,7 @@ void HTMLMediaElement::invokeLoadAlgorithm() |
| void HTMLMediaElement::invokeResourceSelectionAlgorithm() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::invokeResourceSelectionAlgorithm(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "invokeResourceSelectionAlgorithm(" << (void*)this << ")"; |
| // The resource selection algorithm |
| // 1 - Set the networkState to NETWORK_NO_SOURCE |
| setNetworkState(NETWORK_NO_SOURCE); |
| @@ -840,7 +840,7 @@ void HTMLMediaElement::loadInternal() |
| void HTMLMediaElement::selectMediaResource() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "selectMediaResource(" << (void*)this << ")"; |
| enum Mode { Object, Attribute, Children, Nothing }; |
| Mode mode = Nothing; |
| @@ -871,7 +871,7 @@ void HTMLMediaElement::selectMediaResource() |
| setNetworkState(NETWORK_EMPTY); |
| updateDisplayState(); |
| - WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), nothing to load", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "selectMediaResource(" << (void*)this << "), nothing to load"; |
| return; |
| } |
| @@ -885,15 +885,15 @@ void HTMLMediaElement::selectMediaResource() |
| switch (mode) { |
| case Object: |
| loadSourceFromObject(); |
| - WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), using 'srcObject' attribute", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "selectMediaResource(" << (void*)this << ", using 'srcObject' attribute"; |
| break; |
| case Attribute: |
| loadSourceFromAttribute(); |
| - WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), using 'src' attribute url", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "selectMediaResource(" << (void*)this << "), using 'src' attribute url"; |
| break; |
| case Children: |
| loadNextSourceChild(); |
| - WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), using source element", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "selectMediaResource(" << (void*)this << "), using source element"; |
| break; |
| default: |
| ASSERT_NOT_REACHED(); |
|
wolenetz
2016/05/19 17:43:36
nit: NOTREACHED() ?
|
| @@ -919,7 +919,7 @@ void HTMLMediaElement::loadSourceFromAttribute() |
| // If the src attribute's value is the empty string ... jump down to the failed step below |
| if (srcValue.isEmpty()) { |
| mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); |
| - WTF_LOG(Media, "HTMLMediaElement::selectMediaResource(%p), empty 'src'", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "selectMediaResource(" << (void*)this << "), empty 'src'"; |
| return; |
| } |
| @@ -958,7 +958,7 @@ void HTMLMediaElement::loadResource(const WebMediaPlayerSource& source, ContentT |
| if (source.isURL()) { |
| url = source.getAsURL(); |
| ASSERT(isSafeToLoadURL(url, Complain)); |
| - WTF_LOG(Media, "HTMLMediaElement::loadResource(%p, %s, %s)", this, urlForLoggingMedia(url).utf8().data(), contentType.raw().utf8().data()); |
| + DVLOG(MEDIA_LOG_LEVEL) << "loadResource(" << (void*)this << ", " << urlForLoggingMedia(url) << ", " << contentType.raw() << ")"; |
| } |
| LocalFrame* frame = document().frame(); |
| @@ -979,7 +979,7 @@ void HTMLMediaElement::loadResource(const WebMediaPlayerSource& source, ContentT |
| if (m_audioSourceNode) |
| m_audioSourceNode->onCurrentSrcChanged(m_currentSrc); |
| - WTF_LOG(Media, "HTMLMediaElement::loadResource(%p) - m_currentSrc -> %s", this, urlForLoggingMedia(m_currentSrc).utf8().data()); |
| + DVLOG(MEDIA_LOG_LEVEL) << "loadResource(" << (void*)this << ") - m_currentSrc -> " << urlForLoggingMedia(m_currentSrc); |
| startProgressEventTimer(); |
| @@ -1023,7 +1023,7 @@ void HTMLMediaElement::loadResource(const WebMediaPlayerSource& source, ContentT |
| // Skip this optional deferral for MediaStream sources or any blob URL, |
| // including MediaSource blob URLs. |
| if (!isStreamOrBlobUrl && effectivePreloadType() == WebMediaPlayer::PreloadNone) { |
| - WTF_LOG(Media, "HTMLMediaElement::loadResource(%p) : Delaying load because preload == 'none'", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "loadResource(" << (void*)this << ") : Delaying load because preload == 'none'"; |
| deferLoad(); |
| } else { |
| startPlayerLoad(); |
| @@ -1244,7 +1244,7 @@ void HTMLMediaElement::disableAutomaticTextTrackSelection() |
| bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionIfInvalid) |
| { |
| if (!url.isValid()) { |
| - WTF_LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%p, %s) -> FALSE because url is invalid", this, urlForLoggingMedia(url).utf8().data()); |
| + DVLOG(MEDIA_LOG_LEVEL) << "isSafeToLoadURL(" << (void*)this << ", " << urlForLoggingMedia(url) << ") -> FALSE because url is invalid"; |
| return false; |
| } |
| @@ -1252,12 +1252,12 @@ bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionI |
| if (!frame || !document().getSecurityOrigin()->canDisplay(url)) { |
| if (actionIfInvalid == Complain) |
| FrameLoader::reportLocalLoadFailed(frame, url.elidedString()); |
| - WTF_LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%p, %s) -> FALSE rejected by SecurityOrigin", this, urlForLoggingMedia(url).utf8().data()); |
| + DVLOG(MEDIA_LOG_LEVEL) << "isSafeToLoadURL(" << (void*)this << ", " << urlForLoggingMedia(url) << ") -> FALSE rejected by SecurityOrigin"; |
| return false; |
| } |
| if (!document().contentSecurityPolicy()->allowMediaFromSource(url)) { |
| - WTF_LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%p, %s) -> rejected by Content Security Policy", this, urlForLoggingMedia(url).utf8().data()); |
| + DVLOG(MEDIA_LOG_LEVEL) << "isSafeToLoadURL(" << (void*)this << ", " << urlForLoggingMedia(url) << ") -> rejected by Content Security Policy"; |
| return false; |
| } |
| @@ -1288,7 +1288,7 @@ void HTMLMediaElement::startProgressEventTimer() |
| void HTMLMediaElement::waitForSourceChange() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::waitForSourceChange(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "waitForSourceChange(" << (void*)this << ")"; |
| stopPeriodicTimers(); |
| m_loadState = WaitingForSource; |
| @@ -1307,7 +1307,7 @@ void HTMLMediaElement::waitForSourceChange() |
| void HTMLMediaElement::noneSupported() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::noneSupported(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "noneSupported(" << (void*)this << ")"; |
| stopPeriodicTimers(); |
| m_loadState = WaitingForSource; |
| @@ -1347,7 +1347,7 @@ void HTMLMediaElement::noneSupported() |
| void HTMLMediaElement::mediaEngineError(MediaError* err) |
| { |
| ASSERT(m_readyState >= HAVE_METADATA); |
| - WTF_LOG(Media, "HTMLMediaElement::mediaEngineError(%p, %d)", this, static_cast<int>(err->code())); |
| + DVLOG(MEDIA_LOG_LEVEL) << "mediaEngineError(" << (void*)this << ", " << static_cast<int>(err->code()) << ")"; |
| // 1 - The user agent should cancel the fetching process. |
| stopPeriodicTimers(); |
| @@ -1372,7 +1372,7 @@ void HTMLMediaElement::mediaEngineError(MediaError* err) |
| void HTMLMediaElement::cancelPendingEventsAndCallbacks() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::cancelPendingEventsAndCallbacks(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "cancelPendingEventsAndCallbacks(" << (void*)this << ")"; |
| m_asyncEventQueue->cancelAllEvents(); |
| for (HTMLSourceElement* source = Traversal<HTMLSourceElement>::firstChild(*this); source; source = Traversal<HTMLSourceElement>::nextSibling(*source)) |
| @@ -1400,7 +1400,7 @@ void HTMLMediaElement::mediaLoadingFailed(WebMediaPlayer::NetworkState error) |
| if (m_currentSourceNode) |
| m_currentSourceNode->scheduleErrorEvent(); |
| else |
| - WTF_LOG(Media, "HTMLMediaElement::setNetworkState(%p) - error event not sent, <source> was removed", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "setNetworkState(" << (void*)this << ") - error event not sent, <source> was removed"; |
| // 9.Otherwise.10 - Asynchronously await a stable state. The synchronous section consists of all the remaining steps of this algorithm until the algorithm says the synchronous section has ended. |
| @@ -1408,10 +1408,10 @@ void HTMLMediaElement::mediaLoadingFailed(WebMediaPlayer::NetworkState error) |
| forgetResourceSpecificTracks(); |
| if (havePotentialSourceChild()) { |
| - WTF_LOG(Media, "HTMLMediaElement::setNetworkState(%p) - scheduling next <source>", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "setNetworkState(" << (void*)this << ") - scheduling next <source>"; |
| scheduleNextSourceChild(); |
| } else { |
| - WTF_LOG(Media, "HTMLMediaElement::setNetworkState(%p) - no more <source> elements, waiting", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "setNetworkState(" << (void*)this << ") - no more <source> elements, waiting"; |
| waitForSourceChange(); |
| } |
| @@ -1434,7 +1434,7 @@ void HTMLMediaElement::mediaLoadingFailed(WebMediaPlayer::NetworkState error) |
| void HTMLMediaElement::setNetworkState(WebMediaPlayer::NetworkState state) |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::setNetworkState(%p, %d) - current state is %d", this, static_cast<int>(state), static_cast<int>(m_networkState)); |
| + DVLOG(MEDIA_LOG_LEVEL) << "setNetworkState(" << (void*)this << ", " << static_cast<int>(state) << ") - current state is " << static_cast<int>(m_networkState); |
| if (state == WebMediaPlayer::NetworkStateEmpty) { |
| // Just update the cached state and leave, we can't do anything. |
| @@ -1489,7 +1489,7 @@ void HTMLMediaElement::readyStateChanged() |
| void HTMLMediaElement::setReadyState(ReadyState state) |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::setReadyState(%p, %d) - current state is %d,", this, static_cast<int>(state), static_cast<int>(m_readyState)); |
| + DVLOG(MEDIA_LOG_LEVEL) << "setReadyState(" << (void*)this << ", " << static_cast<int>(state) << ") - current state is " << static_cast<int>(m_readyState); |
| // Set "wasPotentiallyPlaying" BEFORE updating m_readyState, potentiallyPlaying() uses it |
| bool wasPotentiallyPlaying = potentiallyPlaying(); |
| @@ -1655,7 +1655,7 @@ void HTMLMediaElement::progressEventTimerFired(Timer<HTMLMediaElement>*) |
| void HTMLMediaElement::addPlayedRange(double start, double end) |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::addPlayedRange(%p, %f, %f)", this, start, end); |
| + DVLOG(MEDIA_LOG_LEVEL) << "addPlayedRange(" << (void*)this << ", " << start << ", " << end << ")"; |
| if (!m_playedTimeRanges) |
| m_playedTimeRanges = TimeRanges::create(); |
| m_playedTimeRanges->add(start, end); |
| @@ -1668,14 +1668,14 @@ bool HTMLMediaElement::supportsSave() const |
| void HTMLMediaElement::setIgnorePreloadNone() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::setIgnorePreloadNone(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "setIgnorePreloadNone(" << (void*)this << ")"; |
| m_ignorePreloadNone = true; |
| setPlayerPreload(); |
| } |
| void HTMLMediaElement::seek(double time) |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::seek(%p, %f)", this, time); |
| + DVLOG(MEDIA_LOG_LEVEL) << "seek(" << (void*)this << ", " << time << ")"; |
| // 2 - If the media element's readyState is HAVE_NOTHING, abort these steps. |
| if (m_readyState == HAVE_NOTHING) |
| @@ -1712,7 +1712,7 @@ void HTMLMediaElement::seek(double time) |
| // fire a 'seeked' event. |
| double mediaTime = webMediaPlayer()->mediaTimeForTimeValue(time); |
| if (time != mediaTime) { |
| - WTF_LOG(Media, "HTMLMediaElement::seek(%p, %f) - media timeline equivalent is %f", this, time, mediaTime); |
| + DVLOG(MEDIA_LOG_LEVEL) << "seek(" << (void*)this << ", " << time << ") - media timeline equivalent is " << mediaTime; |
| time = mediaTime; |
| } |
| @@ -1746,7 +1746,7 @@ void HTMLMediaElement::seek(double time) |
| void HTMLMediaElement::finishSeek() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::finishSeek(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "finishSeek(" << (void*)this << ")"; |
| // 14 - Set the seeking IDL attribute to false. |
| m_seeking = false; |
| @@ -1792,7 +1792,7 @@ void HTMLMediaElement::refreshCachedTime() const |
| void HTMLMediaElement::invalidateCachedTime() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::invalidateCachedTime(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "invalidateCachedTime(" << (void*)this << ")"; |
| m_cachedTime = std::numeric_limits<double>::quiet_NaN(); |
| } |
| @@ -1806,7 +1806,7 @@ double HTMLMediaElement::currentTime() const |
| return 0; |
| if (m_seeking) { |
| - WTF_LOG(Media, "HTMLMediaElement::currentTime(%p) - seeking, returning %f", this, m_lastSeekTime); |
| + DVLOG(MEDIA_LOG_LEVEL) << "currentTime(" << (void*)this << ") - seeking, returning " << m_lastSeekTime; |
| return m_lastSeekTime; |
| } |
| @@ -1815,7 +1815,7 @@ double HTMLMediaElement::currentTime() const |
| static const double minCachedDeltaForWarning = 0.01; |
| double delta = m_cachedTime - webMediaPlayer()->currentTime(); |
| if (delta > minCachedDeltaForWarning) |
| - WTF_LOG(Media, "HTMLMediaElement::currentTime(%p) - WARNING, cached time is %f seconds off of media time when paused", this, delta); |
| + DVLOG(MEDIA_LOG_LEVEL) << "currentTime(" << (void*)this << ") - WARNING, cached time is " << delta << "seconds off of media time when paused"; |
| #endif |
| return m_cachedTime; |
| } |
| @@ -1887,7 +1887,7 @@ double HTMLMediaElement::playbackRate() const |
| void HTMLMediaElement::setPlaybackRate(double rate) |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::setPlaybackRate(%p, %f)", this, rate); |
| + DVLOG(MEDIA_LOG_LEVEL) << "setPlaybackRate(" << (void*)this << ", " << rate << ")"; |
| if (m_playbackRate != rate) { |
| m_playbackRate = rate; |
| @@ -1947,7 +1947,7 @@ String HTMLMediaElement::preload() const |
| void HTMLMediaElement::setPreload(const AtomicString& preload) |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::setPreload(%p, %s)", this, preload.utf8().data()); |
| + DVLOG(MEDIA_LOG_LEVEL) << "setPreload(" << (void*)this << ", " << preload << ")"; |
| setAttribute(preloadAttr, preload); |
| } |
| @@ -2030,7 +2030,7 @@ ScriptPromise HTMLMediaElement::playForBindings(ScriptState* scriptState) |
| Nullable<ExceptionCode> HTMLMediaElement::play() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::play(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "play(" << (void*)this << ")"; |
| m_autoplayHelper->playMethodCalled(); |
| @@ -2059,7 +2059,7 @@ Nullable<ExceptionCode> HTMLMediaElement::play() |
| void HTMLMediaElement::playInternal() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::playInternal(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "playInternal(" << (void*)this << ")"; |
| // Always return the buffering strategy to normal when not paused, |
| // regardless of the cause. (In contrast with aggressive buffering which is |
| @@ -2098,7 +2098,7 @@ void HTMLMediaElement::playInternal() |
| void HTMLMediaElement::pause() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::pause(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "pause(" << (void*)this << ")"; |
| // Only buffer aggressively on a user-initiated pause. Other types of pauses |
| // (which go directly to pauseInternal()) should not cause this behavior. |
| @@ -2110,7 +2110,7 @@ void HTMLMediaElement::pause() |
| void HTMLMediaElement::pauseInternal() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::pauseInternal(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "pauseInternal(" << (void*)this << ")"; |
| if (m_networkState == NETWORK_EMPTY) |
| invokeResourceSelectionAlgorithm(); |
| @@ -2159,7 +2159,7 @@ bool HTMLMediaElement::loop() const |
| void HTMLMediaElement::setLoop(bool b) |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::setLoop(%p, %s)", this, boolString(b)); |
| + DVLOG(MEDIA_LOG_LEVEL) << "setLoop(" << (void*)this << ", " << boolString(b) << ")"; |
| setBooleanAttribute(loopAttr, b); |
| } |
| @@ -2198,7 +2198,7 @@ double HTMLMediaElement::volume() const |
| void HTMLMediaElement::setVolume(double vol, ExceptionState& exceptionState) |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::setVolume(%p, %f)", this, vol); |
| + DVLOG(MEDIA_LOG_LEVEL) << "setVolume(" << (void*)this << ", " << vol << ")"; |
| if (m_volume == vol) |
| return; |
| @@ -2222,7 +2222,7 @@ bool HTMLMediaElement::muted() const |
| void HTMLMediaElement::setMuted(bool muted) |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::setMuted(%p, %s)", this, boolString(muted)); |
| + DVLOG(MEDIA_LOG_LEVEL) << "setMuted(" << (void*)this << ", " << boolString(muted) << ")"; |
| if (m_muted == muted) |
| return; |
| @@ -2328,7 +2328,7 @@ AudioTrackList& HTMLMediaElement::audioTracks() |
| void HTMLMediaElement::audioTrackChanged(WebMediaPlayer::TrackId trackId, bool enabled) |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::audioTrackChanged(%p) trackId=%u enabled=%d", this, trackId, enabled); |
| + DVLOG(MEDIA_LOG_LEVEL) << "audioTrackChanged(" << (void*)this << ") trackId= " << trackId << " enabled=" << boolString(enabled); |
| ASSERT(RuntimeEnabledFeatures::audioVideoTracksEnabled()); |
| audioTracks().scheduleChangeEvent(); |
| @@ -2354,8 +2354,8 @@ void HTMLMediaElement::audioTracksTimerFired(Timer<HTMLMediaElement>*) |
| WebMediaPlayer::TrackId HTMLMediaElement::addAudioTrack(const WebString& id, WebMediaPlayerClient::AudioTrackKind kind, const WebString& label, const WebString& language, bool enabled) |
| { |
| AtomicString kindString = AudioKindToString(kind); |
| - WTF_LOG(Media, "HTMLMediaElement::addAudioTrack(%p, '%s', '%s', '%s', '%s', %d)", |
| - this, id.utf8().data(), kindString.ascii().data(), label.utf8().data(), language.utf8().data(), enabled); |
| + DVLOG(MEDIA_LOG_LEVEL) << "addAudioTrack(" << (void*)this << ", '" << (String)id << "', ' " << (AtomicString)kindString |
| + << "', '" << (String)label << "', '" << (String)language << "', " << boolString(enabled) << ")"; |
| if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) |
| return 0; |
| @@ -2368,7 +2368,7 @@ WebMediaPlayer::TrackId HTMLMediaElement::addAudioTrack(const WebString& id, Web |
| void HTMLMediaElement::removeAudioTrack(WebMediaPlayer::TrackId trackId) |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::removeAudioTrack(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "removeAudioTrack(" << (void*)this << ")"; |
| if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) |
| return; |
| @@ -2384,7 +2384,7 @@ VideoTrackList& HTMLMediaElement::videoTracks() |
| void HTMLMediaElement::selectedVideoTrackChanged(WebMediaPlayer::TrackId* selectedTrackId) |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::selectedVideoTrackChanged(%p) selectedTrackId=%s", this, selectedTrackId ? String::format("%u", *selectedTrackId).ascii().data() : "none"); |
| + DVLOG(MEDIA_LOG_LEVEL) << "selectedVideoTrackChanged(" << (void*)this << ") selectedTrackId=" << (selectedTrackId ? String::format("%u", *selectedTrackId) : "none"); |
| ASSERT(RuntimeEnabledFeatures::audioVideoTracksEnabled()); |
| if (selectedTrackId) |
| @@ -2398,8 +2398,8 @@ void HTMLMediaElement::selectedVideoTrackChanged(WebMediaPlayer::TrackId* select |
| WebMediaPlayer::TrackId HTMLMediaElement::addVideoTrack(const WebString& id, WebMediaPlayerClient::VideoTrackKind kind, const WebString& label, const WebString& language, bool selected) |
| { |
| AtomicString kindString = VideoKindToString(kind); |
| - WTF_LOG(Media, "HTMLMediaElement::addVideoTrack(%p, '%s', '%s', '%s', '%s', %d)", |
| - this, id.utf8().data(), kindString.ascii().data(), label.utf8().data(), language.utf8().data(), selected); |
| + DVLOG(MEDIA_LOG_LEVEL) << "addVideoTrack(" << (void*)this << ", '" << (String)id << "', '" << (AtomicString)kindString |
| + << "', '" << (String)label << "', '" << (String)language << "', " << boolString(selected) << ")"; |
| if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) |
| return 0; |
| @@ -2416,7 +2416,7 @@ WebMediaPlayer::TrackId HTMLMediaElement::addVideoTrack(const WebString& id, Web |
| void HTMLMediaElement::removeVideoTrack(WebMediaPlayer::TrackId trackId) |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::removeVideoTrack(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "removeVideoTrack(" << (void*)this << ")"; |
| if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) |
| return; |
| @@ -2572,10 +2572,8 @@ void HTMLMediaElement::didAddTrackElement(HTMLTrackElement* trackElement) |
| void HTMLMediaElement::didRemoveTrackElement(HTMLTrackElement* trackElement) |
| { |
| -#if !LOG_DISABLED |
| KURL url = trackElement->getNonEmptyURLAttribute(srcAttr); |
| - WTF_LOG(Media, "HTMLMediaElement::didRemoveTrackElement(%p) - 'src' is %s", this, urlForLoggingMedia(url).utf8().data()); |
| -#endif |
| + DVLOG(MEDIA_LOG_LEVEL) << "didRemoveTrackElement(" << (void*)this << ") - 'src' is " << urlForLoggingMedia(url); |
| TextTrack* textTrack = trackElement->track(); |
| if (!textTrack) |
| @@ -2638,18 +2636,14 @@ bool HTMLMediaElement::havePotentialSourceChild() |
| KURL HTMLMediaElement::selectNextSourceChild(ContentType* contentType, InvalidURLAction actionIfInvalid) |
| { |
| -#if !LOG_DISABLED |
| // Don't log if this was just called to find out if there are any valid <source> elements. |
| bool shouldLog = actionIfInvalid != DoNothing; |
| if (shouldLog) |
| - WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p)", this); |
| -#endif |
| + DVLOG(MEDIA_LOG_LEVEL) << "selectNextSourceChild(" << (void*)this << ")"; |
| if (!m_nextChildNodeToConsider) { |
| -#if !LOG_DISABLED |
| if (shouldLog) |
| - WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p) -> 0x0000, \"\"", this); |
| -#endif |
| + DVLOG(MEDIA_LOG_LEVEL) << "selectNextSourceChild(" << (void*)this << ") -> 0x0000, \"\""; |
| return KURL(); |
| } |
| @@ -2680,10 +2674,8 @@ KURL HTMLMediaElement::selectNextSourceChild(ContentType* contentType, InvalidUR |
| // attribute's value is the empty string ... jump down to the failed |
| // step below |
| const AtomicString& srcValue = source->fastGetAttribute(srcAttr); |
| -#if !LOG_DISABLED |
| if (shouldLog) |
| - WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p) - 'src' is %s", this, urlForLoggingMedia(mediaURL).utf8().data()); |
| -#endif |
| + DVLOG(MEDIA_LOG_LEVEL) << "selectNextSourceChild(" << (void*)this << ") - 'src' is " << urlForLoggingMedia(mediaURL); |
| if (srcValue.isEmpty()) |
| goto checkAgain; |
| @@ -2705,10 +2697,8 @@ KURL HTMLMediaElement::selectNextSourceChild(ContentType* contentType, InvalidUR |
| if (type.isEmpty() && mediaURL.protocolIsData()) |
| type = mimeTypeFromDataURL(mediaURL); |
| if (!type.isEmpty()) { |
| -#if !LOG_DISABLED |
| if (shouldLog) |
| - WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p) - 'type' is '%s'", this, type.utf8().data()); |
| -#endif |
| + DVLOG(MEDIA_LOG_LEVEL) << "selectNextSourceChild(" << (void*)this << ") - 'type' is '" << type << "'"; |
| if (!supportsType(ContentType(type))) |
| goto checkAgain; |
| } |
| @@ -2731,21 +2721,17 @@ checkAgain: |
| m_nextChildNodeToConsider = nullptr; |
| } |
| -#if !LOG_DISABLED |
| if (shouldLog) |
| - WTF_LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p) -> %p, %s", this, m_currentSourceNode.get(), canUseSourceElement ? urlForLoggingMedia(mediaURL).utf8().data() : ""); |
| -#endif |
| + DVLOG(MEDIA_LOG_LEVEL) << "selectNextSourceChild(" << (void*)this << ") -> " << m_currentSourceNode.get() << ", " << (canUseSourceElement ? urlForLoggingMedia(mediaURL) : ""); |
| return canUseSourceElement ? mediaURL : KURL(); |
| } |
| void HTMLMediaElement::sourceWasAdded(HTMLSourceElement* source) |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::sourceWasAdded(%p, %p)", this, source); |
| + DVLOG(MEDIA_LOG_LEVEL) << "sourceWasAdded(" << (void*)this << ", " << source << ")"; |
| -#if !LOG_DISABLED |
| KURL url = source->getNonEmptyURLAttribute(srcAttr); |
| - WTF_LOG(Media, "HTMLMediaElement::sourceWasAdded(%p) - 'src' is %s", this, urlForLoggingMedia(url).utf8().data()); |
| -#endif |
| + DVLOG(MEDIA_LOG_LEVEL) << "sourceWasAdded(" << (void*)this << ") - 'src' is " << urlForLoggingMedia(url); |
| // We should only consider a <source> element when there is not src attribute at all. |
| if (fastHasAttribute(srcAttr)) |
| @@ -2762,7 +2748,7 @@ void HTMLMediaElement::sourceWasAdded(HTMLSourceElement* source) |
| } |
| if (m_currentSourceNode && source == m_currentSourceNode->nextSibling()) { |
| - WTF_LOG(Media, "HTMLMediaElement::sourceWasAdded(%p) - <source> inserted immediately after current source", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "sourceWasAdded(" << (void*)this << ") - <source> inserted immediately after current source"; |
| // Ignore current |m_nextChildNodeToConsider| and consider |source|. |
| m_nextChildNodeToConsider = source; |
| return; |
| @@ -2792,12 +2778,10 @@ void HTMLMediaElement::sourceWasAdded(HTMLSourceElement* source) |
| void HTMLMediaElement::sourceWasRemoved(HTMLSourceElement* source) |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::sourceWasRemoved(%p, %p)", this, source); |
| + DVLOG(MEDIA_LOG_LEVEL) << "sourceWasRemoved(" << (void*)this << ", " << source << ")"; |
| -#if !LOG_DISABLED |
| KURL url = source->getNonEmptyURLAttribute(srcAttr); |
| - WTF_LOG(Media, "HTMLMediaElement::sourceWasRemoved(%p) - 'src' is %s", this, urlForLoggingMedia(url).utf8().data()); |
| -#endif |
| + DVLOG(MEDIA_LOG_LEVEL) << "sourceWasRemoved(" << (void*)this << ") - 'src' is " << urlForLoggingMedia(url); |
| if (source != m_currentSourceNode && source != m_nextChildNodeToConsider) |
| return; |
| @@ -2805,19 +2789,19 @@ void HTMLMediaElement::sourceWasRemoved(HTMLSourceElement* source) |
| if (source == m_nextChildNodeToConsider) { |
| if (m_currentSourceNode) |
| m_nextChildNodeToConsider = m_currentSourceNode->nextSibling(); |
| - WTF_LOG(Media, "HTMLMediaElement::sourceRemoved(%p) - m_nextChildNodeToConsider set to %p", this, m_nextChildNodeToConsider.get()); |
| + DVLOG(MEDIA_LOG_LEVEL) << "sourceWasRemoved(" << (void*)this << ") - m_nextChildNodeToConsider set to " << m_nextChildNodeToConsider.get(); |
| } else if (source == m_currentSourceNode) { |
| // Clear the current source node pointer, but don't change the movie as the spec says: |
| // 4.8.8 - Dynamically modifying a source element and its attribute when the element is already |
| // inserted in a video or audio element will have no effect. |
| m_currentSourceNode = nullptr; |
| - WTF_LOG(Media, "HTMLMediaElement::sourceRemoved(%p) - m_currentSourceNode set to 0", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "sourceWasRemoved(" << (void*)this << ") - m_currentSourceNode set to 0"; |
| } |
| } |
| void HTMLMediaElement::timeChanged() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::timeChanged(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "timeChanged(" << (void*)this << ")"; |
| cueTimeline().updateActiveCues(currentTime()); |
| @@ -2867,7 +2851,7 @@ void HTMLMediaElement::timeChanged() |
| void HTMLMediaElement::durationChanged() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::durationChanged(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "durationChanged(" << (void*)this << ")"; |
| // FIXME: Change WebMediaPlayer to convey the currentTime |
| // when the duration change occured. The current WebMediaPlayer |
| // implementations always clamp currentTime() to duration() |
| @@ -2877,13 +2861,13 @@ void HTMLMediaElement::durationChanged() |
| void HTMLMediaElement::durationChanged(double duration, bool requestSeek) |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::durationChanged(%p, %f, %d)", this, duration, requestSeek); |
| + DVLOG(MEDIA_LOG_LEVEL) << "durationChanged(" << (void*)this << ", " << duration << ", " << boolString(requestSeek) << ")"; |
| // Abort if duration unchanged. |
| if (m_duration == duration) |
| return; |
| - WTF_LOG(Media, "HTMLMediaElement::durationChanged(%p) : %f -> %f", this, m_duration, duration); |
| + DVLOG(MEDIA_LOG_LEVEL) << "durationChanged(" << (void*)this << ") : " << m_duration << " -> " << duration; |
| m_duration = duration; |
| scheduleEvent(EventTypeNames::durationchange); |
| @@ -2898,7 +2882,7 @@ void HTMLMediaElement::durationChanged(double duration, bool requestSeek) |
| void HTMLMediaElement::playbackStateChanged() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::playbackStateChanged(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "playbackStateChanged(" << (void*)this << ")"; |
| if (!webMediaPlayer()) |
| return; |
| @@ -2961,7 +2945,7 @@ void HTMLMediaElement::repaint() |
| void HTMLMediaElement::sizeChanged() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::sizeChanged(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "sizeChanged(" << (void*)this << ")"; |
| ASSERT(hasVideo()); // "resize" makes no sense absent video. |
| if (m_readyState > HAVE_NOTHING && isHTMLVideoElement()) |
| @@ -3062,8 +3046,8 @@ void HTMLMediaElement::updatePlayState() |
| bool isPlaying = webMediaPlayer() && !webMediaPlayer()->paused(); |
| bool shouldBePlaying = potentiallyPlaying(); |
| - WTF_LOG(Media, "HTMLMediaElement::updatePlayState(%p) - shouldBePlaying = %s, isPlaying = %s", |
| - this, boolString(shouldBePlaying), boolString(isPlaying)); |
| + DVLOG(MEDIA_LOG_LEVEL) << "updatePlayState(" << (void*)this << ") - shouldBePlaying = " |
| + << boolString(shouldBePlaying) << ", isPlaying = " << boolString(isPlaying); |
| if (shouldBePlaying) { |
| setDisplayMode(Video); |
| @@ -3154,7 +3138,7 @@ void HTMLMediaElement::clearMediaPlayer() |
| void HTMLMediaElement::stop() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::stop(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "stop(" << (void*)this << ")"; |
| // Close the async event queue so that no events are enqueued. |
| cancelPendingEventsAndCallbacks(); |
| @@ -3221,14 +3205,14 @@ bool HTMLMediaElement::isFullscreen() const |
| void HTMLMediaElement::enterFullscreen() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::enterFullscreen(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "enterFullscreen(" << (void*)this << ")"; |
| Fullscreen::from(document()).requestFullscreen(*this, Fullscreen::PrefixedRequest); |
| } |
| void HTMLMediaElement::exitFullscreen() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::exitFullscreen(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "exitFullscreen(" << (void*)this << ")"; |
| Fullscreen::from(document()).exitFullscreen(); |
| } |
| @@ -3324,14 +3308,14 @@ TextTrackContainer& HTMLMediaElement::ensureTextTrackContainer() |
| void HTMLMediaElement::updateTextTrackDisplay() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::updateTextTrackDisplay(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "updateTextTrackDisplay(" << (void*)this << ")"; |
| ensureTextTrackContainer().updateDisplay(*this, TextTrackContainer::DidNotStartExposingControls); |
| } |
| void HTMLMediaElement::mediaControlsDidBecomeVisible() |
| { |
| - WTF_LOG(Media, "HTMLMediaElement::mediaControlsDidBecomeVisible(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "mediaControlsDidBecomeVisible(" << (void*)this << ")"; |
| // When the user agent starts exposing a user interface for a video element, |
| // the user agent should run the rules for updating the text track rendering |
| @@ -3412,7 +3396,7 @@ void HTMLMediaElement::setShouldDelayLoadEvent(bool shouldDelay) |
| if (m_shouldDelayLoadEvent == shouldDelay) |
| return; |
| - WTF_LOG(Media, "HTMLMediaElement::setShouldDelayLoadEvent(%p, %s)", this, boolString(shouldDelay)); |
| + DVLOG(MEDIA_LOG_LEVEL) << "setShouldDelayLoadEvent(" << (void*)this << ", " << boolString(shouldDelay) << ")"; |
| m_shouldDelayLoadEvent = shouldDelay; |
| if (shouldDelay) |
| @@ -3483,7 +3467,7 @@ CueTimeline& HTMLMediaElement::cueTimeline() |
| void HTMLMediaElement::configureTextTrackDisplay() |
| { |
| ASSERT(m_textTracks); |
| - WTF_LOG(Media, "HTMLMediaElement::configureTextTrackDisplay(%p)", this); |
| + DVLOG(MEDIA_LOG_LEVEL) << "configureTextTrackDisplay(" << (void*)this << ")"; |
| if (m_processingPreferenceChange) |
| return; |