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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 2191533003: Refactor Timer classes in preparation for landing FrameTimers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More build fixes Created 4 years, 4 months 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 } 662 }
663 663
664 void HTMLMediaElement::scheduleEvent(Event* event) 664 void HTMLMediaElement::scheduleEvent(Event* event)
665 { 665 {
666 #if LOG_MEDIA_EVENTS 666 #if LOG_MEDIA_EVENTS
667 BLINK_MEDIA_LOG << "scheduleEvent(" << (void*)this << ")" << " - scheduling '" << event->type() << "'"; 667 BLINK_MEDIA_LOG << "scheduleEvent(" << (void*)this << ")" << " - scheduling '" << event->type() << "'";
668 #endif 668 #endif
669 m_asyncEventQueue->enqueueEvent(event); 669 m_asyncEventQueue->enqueueEvent(event);
670 } 670 }
671 671
672 void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*) 672 void HTMLMediaElement::loadTimerFired(TimerBase*)
673 { 673 {
674 if (m_pendingActionFlags & LoadTextTrackResource) 674 if (m_pendingActionFlags & LoadTextTrackResource)
675 honorUserPreferencesForAutomaticTextTrackSelection(); 675 honorUserPreferencesForAutomaticTextTrackSelection();
676 676
677 if (m_pendingActionFlags & LoadMediaResource) { 677 if (m_pendingActionFlags & LoadMediaResource) {
678 if (m_loadState == LoadingFromSourceElement) 678 if (m_loadState == LoadingFromSourceElement)
679 loadNextSourceChild(); 679 loadNextSourceChild();
680 else 680 else
681 loadInternal(); 681 loadInternal();
682 } 682 }
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 if (m_deferredLoadState == WaitingForTrigger) { 1187 if (m_deferredLoadState == WaitingForTrigger) {
1188 executeDeferredLoad(); 1188 executeDeferredLoad();
1189 return; 1189 return;
1190 } 1190 }
1191 if (m_deferredLoadState == ExecuteOnStopDelayingLoadEventTask) 1191 if (m_deferredLoadState == ExecuteOnStopDelayingLoadEventTask)
1192 return; 1192 return;
1193 DCHECK_EQ(m_deferredLoadState, WaitingForStopDelayingLoadEventTask); 1193 DCHECK_EQ(m_deferredLoadState, WaitingForStopDelayingLoadEventTask);
1194 m_deferredLoadState = ExecuteOnStopDelayingLoadEventTask; 1194 m_deferredLoadState = ExecuteOnStopDelayingLoadEventTask;
1195 } 1195 }
1196 1196
1197 void HTMLMediaElement::deferredLoadTimerFired(Timer<HTMLMediaElement>*) 1197 void HTMLMediaElement::deferredLoadTimerFired(TimerBase*)
1198 { 1198 {
1199 setShouldDelayLoadEvent(false); 1199 setShouldDelayLoadEvent(false);
1200 1200
1201 if (m_deferredLoadState == ExecuteOnStopDelayingLoadEventTask) { 1201 if (m_deferredLoadState == ExecuteOnStopDelayingLoadEventTask) {
1202 executeDeferredLoad(); 1202 executeDeferredLoad();
1203 return; 1203 return;
1204 } 1204 }
1205 DCHECK_EQ(m_deferredLoadState, WaitingForStopDelayingLoadEventTask); 1205 DCHECK_EQ(m_deferredLoadState, WaitingForStopDelayingLoadEventTask);
1206 m_deferredLoadState = WaitingForTrigger; 1206 m_deferredLoadState = WaitingForTrigger;
1207 } 1207 }
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 if (shouldUpdateDisplayState) { 1659 if (shouldUpdateDisplayState) {
1660 updateDisplayState(); 1660 updateDisplayState();
1661 if (mediaControls()) 1661 if (mediaControls())
1662 mediaControls()->refreshClosedCaptionsButtonVisibility(); 1662 mediaControls()->refreshClosedCaptionsButtonVisibility();
1663 } 1663 }
1664 1664
1665 updatePlayState(); 1665 updatePlayState();
1666 cueTimeline().updateActiveCues(currentTime()); 1666 cueTimeline().updateActiveCues(currentTime());
1667 } 1667 }
1668 1668
1669 void HTMLMediaElement::progressEventTimerFired(Timer<HTMLMediaElement>*) 1669 void HTMLMediaElement::progressEventTimerFired(TimerBase*)
1670 { 1670 {
1671 if (m_networkState != NETWORK_LOADING) 1671 if (m_networkState != NETWORK_LOADING)
1672 return; 1672 return;
1673 1673
1674 double time = WTF::currentTime(); 1674 double time = WTF::currentTime();
1675 double timedelta = time - m_previousProgressTime; 1675 double timedelta = time - m_previousProgressTime;
1676 1676
1677 if (webMediaPlayer() && webMediaPlayer()->didLoadingProgress()) { 1677 if (webMediaPlayer() && webMediaPlayer()->didLoadingProgress()) {
1678 scheduleEvent(EventTypeNames::progress); 1678 scheduleEvent(EventTypeNames::progress);
1679 m_previousProgressTime = time; 1679 m_previousProgressTime = time;
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
2324 2324
2325 void HTMLMediaElement::startPlaybackProgressTimer() 2325 void HTMLMediaElement::startPlaybackProgressTimer()
2326 { 2326 {
2327 if (m_playbackProgressTimer.isActive()) 2327 if (m_playbackProgressTimer.isActive())
2328 return; 2328 return;
2329 2329
2330 m_previousProgressTime = WTF::currentTime(); 2330 m_previousProgressTime = WTF::currentTime();
2331 m_playbackProgressTimer.startRepeating(maxTimeupdateEventFrequency, BLINK_FR OM_HERE); 2331 m_playbackProgressTimer.startRepeating(maxTimeupdateEventFrequency, BLINK_FR OM_HERE);
2332 } 2332 }
2333 2333
2334 void HTMLMediaElement::playbackProgressTimerFired(Timer<HTMLMediaElement>*) 2334 void HTMLMediaElement::playbackProgressTimerFired(TimerBase*)
2335 { 2335 {
2336 if (!std::isnan(m_fragmentEndTime) && currentTime() >= m_fragmentEndTime && getDirectionOfPlayback() == Forward) { 2336 if (!std::isnan(m_fragmentEndTime) && currentTime() >= m_fragmentEndTime && getDirectionOfPlayback() == Forward) {
2337 m_fragmentEndTime = std::numeric_limits<double>::quiet_NaN(); 2337 m_fragmentEndTime = std::numeric_limits<double>::quiet_NaN();
2338 if (!m_paused) { 2338 if (!m_paused) {
2339 UseCounter::count(document(), UseCounter::HTMLMediaElementPauseAtFra gmentEnd); 2339 UseCounter::count(document(), UseCounter::HTMLMediaElementPauseAtFra gmentEnd);
2340 // changes paused to true and fires a simple event named pause at th e media element. 2340 // changes paused to true and fires a simple event named pause at th e media element.
2341 pauseInternal(); 2341 pauseInternal();
2342 } 2342 }
2343 } 2343 }
2344 2344
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2392 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); 2392 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled());
2393 2393
2394 audioTracks().scheduleChangeEvent(); 2394 audioTracks().scheduleChangeEvent();
2395 2395
2396 // FIXME: Add call on m_mediaSource to notify it of track changes once the S ourceBuffer.audioTracks attribute is added. 2396 // FIXME: Add call on m_mediaSource to notify it of track changes once the S ourceBuffer.audioTracks attribute is added.
2397 2397
2398 if (!m_audioTracksTimer.isActive()) 2398 if (!m_audioTracksTimer.isActive())
2399 m_audioTracksTimer.startOneShot(0, BLINK_FROM_HERE); 2399 m_audioTracksTimer.startOneShot(0, BLINK_FROM_HERE);
2400 } 2400 }
2401 2401
2402 void HTMLMediaElement::audioTracksTimerFired(Timer<HTMLMediaElement>*) 2402 void HTMLMediaElement::audioTracksTimerFired(TimerBase*)
2403 { 2403 {
2404 Vector<WebMediaPlayer::TrackId> enabledTrackIds; 2404 Vector<WebMediaPlayer::TrackId> enabledTrackIds;
2405 for (unsigned i = 0; i < audioTracks().length(); ++i) { 2405 for (unsigned i = 0; i < audioTracks().length(); ++i) {
2406 AudioTrack* track = audioTracks().anonymousIndexedGetter(i); 2406 AudioTrack* track = audioTracks().anonymousIndexedGetter(i);
2407 if (track->enabled()) 2407 if (track->enabled())
2408 enabledTrackIds.append(track->id()); 2408 enabledTrackIds.append(track->id());
2409 } 2409 }
2410 2410
2411 webMediaPlayer()->enabledAudioTracksChanged(enabledTrackIds); 2411 webMediaPlayer()->enabledAudioTracksChanged(enabledTrackIds);
2412 } 2412 }
(...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after
4020 4020
4021 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst 4021 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst
4022 { 4022 {
4023 IntRect result; 4023 IntRect result;
4024 if (LayoutObject* object = m_element->layoutObject()) 4024 if (LayoutObject* object = m_element->layoutObject())
4025 result = object->absoluteBoundingBoxRect(); 4025 result = object->absoluteBoundingBoxRect();
4026 return result; 4026 return result;
4027 } 4027 }
4028 4028
4029 } // namespace blink 4029 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.h ('k') | third_party/WebKit/Source/core/html/HTMLTrackElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698