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

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

Issue 1913433003: Remove HTMLMediaElement::m_sentEndEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 , m_pendingActionFlags(0) 405 , m_pendingActionFlags(0)
406 , m_userGestureRequiredForPlay(false) 406 , m_userGestureRequiredForPlay(false)
407 , m_playing(false) 407 , m_playing(false)
408 , m_shouldDelayLoadEvent(false) 408 , m_shouldDelayLoadEvent(false)
409 , m_haveFiredLoadedData(false) 409 , m_haveFiredLoadedData(false)
410 , m_autoplaying(true) 410 , m_autoplaying(true)
411 , m_muted(false) 411 , m_muted(false)
412 , m_paused(true) 412 , m_paused(true)
413 , m_seeking(false) 413 , m_seeking(false)
414 , m_sentStalledEvent(false) 414 , m_sentStalledEvent(false)
415 , m_sentEndEvent(false)
416 , m_ignorePreloadNone(false) 415 , m_ignorePreloadNone(false)
417 , m_textTracksVisible(false) 416 , m_textTracksVisible(false)
418 , m_shouldPerformAutomaticTrackSelection(true) 417 , m_shouldPerformAutomaticTrackSelection(true)
419 , m_tracksAreReady(true) 418 , m_tracksAreReady(true)
420 , m_processingPreferenceChange(false) 419 , m_processingPreferenceChange(false)
421 , m_remoteRoutesAvailable(false) 420 , m_remoteRoutesAvailable(false)
422 , m_playingRemotely(false) 421 , m_playingRemotely(false)
423 , m_inOverlayFullscreenVideo(false) 422 , m_inOverlayFullscreenVideo(false)
424 , m_audioTracks(AudioTrackList::create(*this)) 423 , m_audioTracks(AudioTrackList::create(*this))
425 , m_videoTracks(VideoTrackList::create(*this)) 424 , m_videoTracks(VideoTrackList::create(*this))
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 void HTMLMediaElement::invokeLoadAlgorithm() 708 void HTMLMediaElement::invokeLoadAlgorithm()
710 { 709 {
711 WTF_LOG(Media, "HTMLMediaElement::invokeLoadAlgorithm(%p)", this); 710 WTF_LOG(Media, "HTMLMediaElement::invokeLoadAlgorithm(%p)", this);
712 711
713 // Perform the cleanup required for the resource load algorithm to run. 712 // Perform the cleanup required for the resource load algorithm to run.
714 stopPeriodicTimers(); 713 stopPeriodicTimers();
715 m_loadTimer.stop(); 714 m_loadTimer.stop();
716 cancelDeferredLoad(); 715 cancelDeferredLoad();
717 // FIXME: Figure out appropriate place to reset LoadTextTrackResource if nec essary and set m_pendingActionFlags to 0 here. 716 // FIXME: Figure out appropriate place to reset LoadTextTrackResource if nec essary and set m_pendingActionFlags to 0 here.
718 m_pendingActionFlags &= ~LoadMediaResource; 717 m_pendingActionFlags &= ~LoadMediaResource;
719 m_sentEndEvent = false;
720 m_sentStalledEvent = false; 718 m_sentStalledEvent = false;
721 m_haveFiredLoadedData = false; 719 m_haveFiredLoadedData = false;
722 m_displayMode = Unknown; 720 m_displayMode = Unknown;
723 721
724 // 1 - Abort any already-running instance of the resource selection algorith m for this element. 722 // 1 - Abort any already-running instance of the resource selection algorith m for this element.
725 m_loadState = WaitingForSource; 723 m_loadState = WaitingForSource;
726 m_currentSourceNode = nullptr; 724 m_currentSourceNode = nullptr;
727 725
728 // 2 - If there are any tasks from the media element's media element event t ask source in 726 // 2 - If there are any tasks from the media element's media element event t ask source in
729 // one of the task queues, then remove those tasks. 727 // one of the task queues, then remove those tasks.
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 seek(m_defaultPlaybackStartPosition); 1557 seek(m_defaultPlaybackStartPosition);
1560 jumped = true; 1558 jumped = true;
1561 } 1559 }
1562 m_defaultPlaybackStartPosition = 0; 1560 m_defaultPlaybackStartPosition = 0;
1563 1561
1564 double initialPlaybackPosition = fragmentParser.startTime(); 1562 double initialPlaybackPosition = fragmentParser.startTime();
1565 if (std::isnan(initialPlaybackPosition)) 1563 if (std::isnan(initialPlaybackPosition))
1566 initialPlaybackPosition = 0; 1564 initialPlaybackPosition = 0;
1567 1565
1568 if (!jumped && initialPlaybackPosition > 0) { 1566 if (!jumped && initialPlaybackPosition > 0) {
1569 m_sentEndEvent = false;
1570 UseCounter::count(document(), UseCounter::HTMLMediaElementSeekToFrag mentStart); 1567 UseCounter::count(document(), UseCounter::HTMLMediaElementSeekToFrag mentStart);
1571 seek(initialPlaybackPosition); 1568 seek(initialPlaybackPosition);
1572 jumped = true; 1569 jumped = true;
1573 } 1570 }
1574 1571
1575 if (mediaControls()) 1572 if (mediaControls())
1576 mediaControls()->reset(); 1573 mediaControls()->reset();
1577 if (layoutObject()) 1574 if (layoutObject())
1578 layoutObject()->updateFromElement(); 1575 layoutObject()->updateFromElement();
1579 } 1576 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 if (!seekableRanges->length()) { 1722 if (!seekableRanges->length()) {
1726 m_seeking = false; 1723 m_seeking = false;
1727 return; 1724 return;
1728 } 1725 }
1729 time = seekableRanges->nearest(time, now); 1726 time = seekableRanges->nearest(time, now);
1730 1727
1731 if (m_playing && m_lastSeekTime < now) 1728 if (m_playing && m_lastSeekTime < now)
1732 addPlayedRange(m_lastSeekTime, now); 1729 addPlayedRange(m_lastSeekTime, now);
1733 1730
1734 m_lastSeekTime = time; 1731 m_lastSeekTime = time;
1735 m_sentEndEvent = false;
1736 1732
1737 // 10 - Queue a task to fire a simple event named seeking at the element. 1733 // 10 - Queue a task to fire a simple event named seeking at the element.
1738 scheduleEvent(EventTypeNames::seeking); 1734 scheduleEvent(EventTypeNames::seeking);
1739 1735
1740 // 11 - Set the current playback position to the given new playback position . 1736 // 11 - Set the current playback position to the given new playback position .
1741 webMediaPlayer()->seek(time); 1737 webMediaPlayer()->seek(time);
1742 1738
1743 // 14-17 are handled, if necessary, when the engine signals a readystate cha nge or otherwise 1739 // 14-17 are handled, if necessary, when the engine signals a readystate cha nge or otherwise
1744 // satisfies seek completion and signals a time change. 1740 // satisfies seek completion and signals a time change.
1745 } 1741 }
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
2833 scheduleTimeupdateEvent(false); 2829 scheduleTimeupdateEvent(false);
2834 2830
2835 double now = currentTime(); 2831 double now = currentTime();
2836 double dur = duration(); 2832 double dur = duration();
2837 2833
2838 // When the current playback position reaches the end of the media resource when the direction of 2834 // When the current playback position reaches the end of the media resource when the direction of
2839 // playback is forwards, then the user agent must follow these steps: 2835 // playback is forwards, then the user agent must follow these steps:
2840 if (!std::isnan(dur) && dur && now >= dur && getDirectionOfPlayback() == For ward) { 2836 if (!std::isnan(dur) && dur && now >= dur && getDirectionOfPlayback() == For ward) {
2841 // If the media element has a loop attribute specified 2837 // If the media element has a loop attribute specified
2842 if (loop()) { 2838 if (loop()) {
2843 m_sentEndEvent = false;
2844 // then seek to the earliest possible position of the media resourc e and abort these steps. 2839 // then seek to the earliest possible position of the media resourc e and abort these steps.
2845 seek(0); 2840 seek(0);
2846 } else { 2841 } else {
2847 // If the media element has still ended playback, and the direction of playback is still 2842 // If the media element has still ended playback, and the direction of playback is still
2848 // forwards, and paused is false, 2843 // forwards, and paused is false,
2849 if (!m_paused) { 2844 if (!m_paused) {
2850 // changes paused to true and fires a simple event named pause a t the media element. 2845 // changes paused to true and fires a simple event named pause a t the media element.
2851 m_paused = true; 2846 m_paused = true;
2852 scheduleEvent(EventTypeNames::pause); 2847 scheduleEvent(EventTypeNames::pause);
2853 } 2848 }
2854 // Queue a task to fire a simple event named ended at the media elem ent. 2849 // Queue a task to fire a simple event named ended at the media elem ent.
2855 if (!m_sentEndEvent) { 2850 scheduleEvent(EventTypeNames::ended);
2856 m_sentEndEvent = true;
2857 scheduleEvent(EventTypeNames::ended);
2858 }
2859 Platform::current()->recordAction(UserMetricsAction("Media_Playback_ Ended")); 2851 Platform::current()->recordAction(UserMetricsAction("Media_Playback_ Ended"));
2860 } 2852 }
2861 } else {
2862 m_sentEndEvent = false;
2863 } 2853 }
2864
2865 updatePlayState(); 2854 updatePlayState();
2866 } 2855 }
2867 2856
2868 void HTMLMediaElement::durationChanged() 2857 void HTMLMediaElement::durationChanged()
2869 { 2858 {
2870 WTF_LOG(Media, "HTMLMediaElement::durationChanged(%p)", this); 2859 WTF_LOG(Media, "HTMLMediaElement::durationChanged(%p)", this);
2871 // FIXME: Change WebMediaPlayer to convey the currentTime 2860 // FIXME: Change WebMediaPlayer to convey the currentTime
2872 // when the duration change occured. The current WebMediaPlayer 2861 // when the duration change occured. The current WebMediaPlayer
2873 // implementations always clamp currentTime() to duration() 2862 // implementations always clamp currentTime() to duration()
2874 // so the requestSeek condition here is always false. 2863 // so the requestSeek condition here is always false.
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
3850 3839
3851 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst 3840 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst
3852 { 3841 {
3853 IntRect result; 3842 IntRect result;
3854 if (LayoutObject* object = m_element->layoutObject()) 3843 if (LayoutObject* object = m_element->layoutObject())
3855 result = object->absoluteBoundingBoxRect(); 3844 result = object->absoluteBoundingBoxRect();
3856 return result; 3845 return result;
3857 } 3846 }
3858 3847
3859 } // namespace blink 3848 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698