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

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

Issue 11275156: Merge 133252 - HTMLMediaPlayer should free m_player when src is set/changed (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1312/
Patch Set: Created 8 years, 1 month 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/WebCore/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/html/HTMLMediaElement.cpp
===================================================================
--- Source/WebCore/html/HTMLMediaElement.cpp (revision 133510)
+++ Source/WebCore/html/HTMLMediaElement.cpp (working copy)
@@ -363,8 +363,10 @@
{
if (attribute.name() == srcAttr) {
// Trigger a reload, as long as the 'src' attribute is present.
- if (fastHasAttribute(srcAttr))
+ if (fastHasAttribute(srcAttr)) {
+ clearMediaPlayer(MediaResource);
scheduleLoad(MediaResource);
+ }
} else if (attribute.name() == controlsAttr)
configureMediaControls();
#if PLATFORM(MAC)
@@ -3670,13 +3672,7 @@
// If the media data fetching process is aborted by the user:
// 1 - The user agent should cancel the fetching process.
-#if !ENABLE(PLUGIN_PROXY_FOR_VIDEO)
- m_player.clear();
-#endif
- stopPeriodicTimers();
- m_loadTimer.stop();
- m_loadState = WaitingForSource;
- m_pendingLoadFlags = 0;
+ clearMediaPlayer(-1);
// 2 - Set the error attribute to a new MediaError object whose code attribute is set to MEDIA_ERR_ABORTED.
m_error = MediaError::create(MediaError::MEDIA_ERR_ABORTED);
@@ -3714,6 +3710,18 @@
#endif
}
+void HTMLMediaElement::clearMediaPlayer(unsigned flags)
+{
+#if !ENABLE(PLUGIN_PROXY_FOR_VIDEO)
+ m_player.clear();
+#endif
+ stopPeriodicTimers();
+ m_loadTimer.stop();
+
+ m_pendingLoadFlags &= ~flags;
+ m_loadState = WaitingForSource;
+}
+
bool HTMLMediaElement::canSuspend() const
{
return true;
@@ -4261,7 +4269,7 @@
if (m_audioSourceNode)
m_audioSourceNode->lock();
#endif
-
+
m_player = MediaPlayer::create(this);
#if ENABLE(MEDIA_SOURCE)
« no previous file with comments | « Source/WebCore/html/HTMLMediaElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698