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

Unified Diff: Source/web/WebMediaPlayerClientImpl.cpp

Issue 192013002: Move deferred loading logic from WebMediaPlayerClientImpl to HTMLMediaElement. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Clean up unnecessary logic and state. Created 6 years, 9 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
Index: Source/web/WebMediaPlayerClientImpl.cpp
diff --git a/Source/web/WebMediaPlayerClientImpl.cpp b/Source/web/WebMediaPlayerClientImpl.cpp
index 4f635c6fd850322e8d4f6d606a295f8725d5cad8..7e72ca4d7121c349af7c3754ff024bb969e9597d 100644
--- a/Source/web/WebMediaPlayerClientImpl.cpp
+++ b/Source/web/WebMediaPlayerClientImpl.cpp
@@ -178,27 +178,9 @@ void WebMediaPlayerClientImpl::requestSeek(double time)
}
// MediaPlayer -------------------------------------------------
-
-void WebMediaPlayerClientImpl::load(WebMediaPlayer::LoadType loadType, const WTF::String& url)
-{
- m_url = KURL(ParsedURLString, url);
- m_loadType = loadType;
-
- if (m_preload == MediaPlayer::None) {
-#if ENABLE(WEB_AUDIO)
- m_audioSourceProvider.wrap(0); // Clear weak reference to m_webMediaPlayer's WebAudioSourceProvider.
-#endif
- m_webMediaPlayer.clear();
- m_delayingLoad = true;
- } else
- loadInternal();
-}
-
-void WebMediaPlayerClientImpl::loadInternal()
+void WebMediaPlayerClientImpl::load(WebMediaPlayer::LoadType loadType, const WTF::String& url, WebMediaPlayer::CORSMode corsMode)
{
-#if ENABLE(WEB_AUDIO)
- m_audioSourceProvider.wrap(0); // Clear weak reference to m_webMediaPlayer's WebAudioSourceProvider.
-#endif
+ ASSERT(!m_webMediaPlayer);
// FIXME: Remove this cast
LocalFrame* frame = mediaElement().document().frame();
@@ -211,22 +193,22 @@ void WebMediaPlayerClientImpl::loadInternal()
// if necessary.
m_needsWebLayerForVideo = frame->contentRenderer()->compositor()->hasAcceleratedCompositing();
- m_webMediaPlayer = createWebMediaPlayer(this, m_url, frame);
- if (m_webMediaPlayer) {
+ KURL kurl(ParsedURLString, url);
+ m_webMediaPlayer = createWebMediaPlayer(this, kurl, frame);
+ if (!m_webMediaPlayer)
+ return;
+
#if ENABLE(WEB_AUDIO)
- // Make sure if we create/re-create the WebMediaPlayer that we update our wrapper.
- m_audioSourceProvider.wrap(m_webMediaPlayer->audioSourceProvider());
+ // Make sure if we create/re-create the WebMediaPlayer that we update our wrapper.
+ m_audioSourceProvider.wrap(m_webMediaPlayer->audioSourceProvider());
#endif
// Tell WebMediaPlayer about the poster image URL.
philipj_slow 2014/03/08 19:38:40 Re-indent this comment too? Or just remove it, it'
acolwell GONE FROM CHROMIUM 2014/03/10 21:53:31 Done.
- m_webMediaPlayer->setPoster(poster);
+ m_webMediaPlayer->setPoster(poster);
- // Tell WebMediaPlayer about any connected CDM (may be null).
- m_webMediaPlayer->setContentDecryptionModule(HTMLMediaElementEncryptedMedia::contentDecryptionModule(mediaElement()));
-
- WebMediaPlayer::CORSMode corsMode = static_cast<WebMediaPlayer::CORSMode>(m_client->mediaPlayerCORSMode());
- m_webMediaPlayer->load(m_loadType, m_url, corsMode);
- }
+ // Tell WebMediaPlayer about any connected CDM (may be null).
+ m_webMediaPlayer->setContentDecryptionModule(HTMLMediaElementEncryptedMedia::contentDecryptionModule(mediaElement()));
+ m_webMediaPlayer->load(loadType, kurl, corsMode);
}
void WebMediaPlayerClientImpl::play()
@@ -258,12 +240,6 @@ bool WebMediaPlayerClientImpl::canShowFullscreenOverlay() const
return m_webMediaPlayer && m_webMediaPlayer->canEnterFullscreen();
}
-void WebMediaPlayerClientImpl::prepareToPlay()
-{
- if (m_delayingLoad)
- startDelayedLoad();
-}
-
IntSize WebMediaPlayerClientImpl::naturalSize() const
{
if (m_webMediaPlayer)
@@ -429,9 +405,6 @@ void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload)
if (m_webMediaPlayer)
m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preload));
-
- if (m_delayingLoad && m_preload != MediaPlayer::None)
- startDelayedLoad();
}
bool WebMediaPlayerClientImpl::hasSingleSecurityOrigin() const
@@ -543,25 +516,13 @@ void WebMediaPlayerClientImpl::paintOnAndroid(WebCore::GraphicsContext* context,
}
#endif
-void WebMediaPlayerClientImpl::startDelayedLoad()
-{
- ASSERT(m_delayingLoad);
- ASSERT(!m_webMediaPlayer);
-
- m_delayingLoad = false;
-
- loadInternal();
-}
-
WebMediaPlayerClientImpl::WebMediaPlayerClientImpl(MediaPlayerClient* client)
: m_client(client)
- , m_delayingLoad(false)
, m_preload(MediaPlayer::Auto)
, m_needsWebLayerForVideo(false)
, m_volume(1.0)
, m_muted(false)
, m_rate(1.0)
- , m_loadType(WebMediaPlayer::LoadTypeURL)
{
ASSERT(m_client);
}
« Source/core/html/HTMLMediaElement.cpp ('K') | « Source/web/WebMediaPlayerClientImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698