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

Unified Diff: Source/core/html/HTMLMediaElement.cpp

Issue 298093004: Eliminate MediaPlayer & MediaPlayerClient abstractions(play/pause, other APIs) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed review comments Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/platform/graphics/media/MediaPlayer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index 42f201be24c22d76ea68cd36081d7fbe823fab14..74ba6ba01c1e31a153df35e666deede03d837f81 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -1724,7 +1724,7 @@ void HTMLMediaElement::addPlayedRange(double start, double end)
bool HTMLMediaElement::supportsSave() const
{
- return m_player ? m_player->supportsSave() : false;
+ return webMediaPlayer() && webMediaPlayer()->supportsSave();
}
void HTMLMediaElement::prepareToPlay()
@@ -1780,12 +1780,15 @@ void HTMLMediaElement::seek(double time, ExceptionState& exceptionState)
// time scale, we will ask the media engine to "seek" to the current movie time, which may be a noop and
// not generate a timechanged callback. This means m_seeking will never be cleared and we will never
// fire a 'seeked' event.
+ if (webMediaPlayer()) {
acolwell GONE FROM CHROMIUM 2014/06/02 22:24:26 Do you really need this? I don't believe it is pos
Srirama 2014/06/03 05:48:01 Done.
+ double mediaTime = webMediaPlayer()->mediaTimeForTimeValue(time);
+ if (time != mediaTime) {
#if !LOG_DISABLED
- double mediaTime = m_player->mediaTimeForTimeValue(time);
- if (time != mediaTime)
- WTF_LOG(Media, "HTMLMediaElement::seek(%f) - media timeline equivalent is %f", time, mediaTime);
+ WTF_LOG(Media, "HTMLMediaElement::seek(%f) - media timeline equivalent is %f", time, mediaTime);
#endif
- time = m_player->mediaTimeForTimeValue(time);
+ time = mediaTime;
+ }
+ }
// 7 - If the (possibly now changed) new playback position is not in one of the ranges given in the
// seekable attribute, then let it be the position in one of the ranges given in the seekable attribute
@@ -2830,7 +2833,7 @@ void HTMLMediaElement::mediaPlayerPlaybackStateChanged()
if (!m_player || m_pausedInternal)
return;
- if (m_player->paused())
+ if (webMediaPlayer() && webMediaPlayer()->paused())
acolwell GONE FROM CHROMIUM 2014/06/02 22:24:26 Remove pointer check. The call to this method come
Srirama 2014/06/03 05:48:01 Done.
pause();
else
playInternal();
@@ -3002,8 +3005,8 @@ void HTMLMediaElement::updatePlayState()
return;
if (m_pausedInternal) {
- if (!m_player->paused())
- m_player->pause();
+ if (webMediaPlayer() && !webMediaPlayer()->paused())
+ webMediaPlayer()->pause();
refreshCachedTime();
m_playbackProgressTimer.stop();
if (hasMediaControls())
@@ -3012,7 +3015,7 @@ void HTMLMediaElement::updatePlayState()
}
bool shouldBePlaying = potentiallyPlaying();
- bool playerPaused = m_player->paused();
+ bool playerPaused = webMediaPlayer() && webMediaPlayer()->paused();
WTF_LOG(Media, "HTMLMediaElement::updatePlayState - shouldBePlaying = %s, playerPaused = %s",
boolString(shouldBePlaying), boolString(playerPaused));
@@ -3027,7 +3030,8 @@ void HTMLMediaElement::updatePlayState()
m_player->setRate(m_playbackRate);
updateVolume();
- m_player->play();
+ if (webMediaPlayer())
acolwell GONE FROM CHROMIUM 2014/06/02 22:24:26 Is this really necessary? I believe the conditions
Srirama 2014/06/03 05:48:01 Done.
+ webMediaPlayer()->play();
}
if (hasMediaControls())
@@ -3036,8 +3040,8 @@ void HTMLMediaElement::updatePlayState()
m_playing = true;
} else { // Should not be playing right now
- if (!playerPaused)
- m_player->pause();
+ if (!playerPaused && webMediaPlayer())
+ webMediaPlayer()->pause();
refreshCachedTime();
m_playbackProgressTimer.stop();
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/platform/graphics/media/MediaPlayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698