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

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

Issue 1416073002: Remove redundant webmediaplayer check (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 2 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 | « no previous file | 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 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after
1773 if (m_readyState == HAVE_NOTHING) { 1773 if (m_readyState == HAVE_NOTHING) {
1774 m_defaultPlaybackStartPosition = time; 1774 m_defaultPlaybackStartPosition = time;
1775 return; 1775 return;
1776 } 1776 }
1777 1777
1778 seek(time); 1778 seek(time);
1779 } 1779 }
1780 1780
1781 double HTMLMediaElement::duration() const 1781 double HTMLMediaElement::duration() const
1782 { 1782 {
1783 // FIXME: remove m_webMediaPlayer check once we figure out how 1783 if (m_readyState < HAVE_METADATA)
1784 // m_webMediaPlayer is going out of sync with readystate.
1785 // m_webMediaPlayer is cleared but readystate is not set to HAVE_NOTHING.
1786 if (!m_webMediaPlayer || m_readyState < HAVE_METADATA)
1787 return std::numeric_limits<double>::quiet_NaN(); 1784 return std::numeric_limits<double>::quiet_NaN();
1788 1785
1789 // FIXME: Refactor so m_duration is kept current (in both MSE and 1786 // FIXME: Refactor so m_duration is kept current (in both MSE and
1790 // non-MSE cases) once we have transitioned from HAVE_NOTHING -> 1787 // non-MSE cases) once we have transitioned from HAVE_NOTHING ->
1791 // HAVE_METADATA. Currently, m_duration may be out of date for at least MSE 1788 // HAVE_METADATA. Currently, m_duration may be out of date for at least MSE
1792 // case because MediaSource and SourceBuffer do not notify the element 1789 // case because MediaSource and SourceBuffer do not notify the element
1793 // directly upon duration changes caused by endOfStream, remove, or append 1790 // directly upon duration changes caused by endOfStream, remove, or append
1794 // operations; rather the notification is triggered by the WebMediaPlayer 1791 // operations; rather the notification is triggered by the WebMediaPlayer
1795 // implementation observing that the underlying engine has updated duration 1792 // implementation observing that the underlying engine has updated duration
1796 // and notifying the element to consult its MediaSource for current 1793 // and notifying the element to consult its MediaSource for current
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1839 updatePlaybackRate(); 1836 updatePlaybackRate();
1840 } 1837 }
1841 1838
1842 HTMLMediaElement::DirectionOfPlayback HTMLMediaElement::directionOfPlayback() co nst 1839 HTMLMediaElement::DirectionOfPlayback HTMLMediaElement::directionOfPlayback() co nst
1843 { 1840 {
1844 return m_playbackRate >= 0 ? Forward : Backward; 1841 return m_playbackRate >= 0 ? Forward : Backward;
1845 } 1842 }
1846 1843
1847 void HTMLMediaElement::updatePlaybackRate() 1844 void HTMLMediaElement::updatePlaybackRate()
1848 { 1845 {
1849 // FIXME: remove m_webMediaPlayer check once we figure out how 1846 if (potentiallyPlaying())
1850 // m_webMediaPlayer is going out of sync with readystate.
1851 // m_webMediaPlayer is cleared but readystate is not set to HAVE_NOTHING.
1852 if (m_webMediaPlayer && potentiallyPlaying())
1853 webMediaPlayer()->setRate(playbackRate()); 1847 webMediaPlayer()->setRate(playbackRate());
1854 } 1848 }
1855 1849
1856 bool HTMLMediaElement::ended() const 1850 bool HTMLMediaElement::ended() const
1857 { 1851 {
1858 // 4.8.10.8 Playing the media resource 1852 // 4.8.10.8 Playing the media resource
1859 // The ended attribute must return true if the media element has ended 1853 // The ended attribute must return true if the media element has ended
1860 // playback and the direction of playback is forwards, and false otherwise. 1854 // playback and the direction of playback is forwards, and false otherwise.
1861 return endedPlayback() && directionOfPlayback() == Forward; 1855 return endedPlayback() && directionOfPlayback() == Forward;
1862 } 1856 }
(...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after
3638 visitor->trace(m_client); 3632 visitor->trace(m_client);
3639 } 3633 }
3640 3634
3641 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) 3635 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl)
3642 { 3636 {
3643 visitor->trace(m_client); 3637 visitor->trace(m_client);
3644 } 3638 }
3645 #endif 3639 #endif
3646 3640
3647 } 3641 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698