Title: [97451] trunk/Source
Revision
97451
Author
[email protected]
Date
2011-10-14 01:36:20 -0700 (Fri, 14 Oct 2011)

Log Message

Clear WebMediaPlayerClientImpl back pointer on destruction
https://bugs.webkit.org/show_bug.cgi?id=69973

Reviewed by James Robinson.

Clear the backpointer and remove the unused m_currentFrame

Source/WebCore:

* platform/graphics/chromium/VideoLayerChromium.cpp:
(WebCore::VideoLayerChromium::VideoLayerChromium):
(WebCore::VideoLayerChromium::cleanupResources):
(WebCore::VideoLayerChromium::updateCompositorResources):
(WebCore::VideoLayerChromium::releaseProvider):
* platform/graphics/chromium/VideoLayerChromium.h:

Source/WebKit/chromium:

* src/WebMediaPlayerClientImpl.cpp:
(WebKit::WebMediaPlayerClientImpl::~WebMediaPlayerClientImpl):
(WebKit::WebMediaPlayerClientImpl::load):
(WebKit::WebMediaPlayerClientImpl::getCurrentFrame):
(WebKit::WebMediaPlayerClientImpl::putCurrentFrame):
* src/WebMediaPlayerClientImpl.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (97450 => 97451)


--- trunk/Source/WebCore/ChangeLog	2011-10-14 08:34:05 UTC (rev 97450)
+++ trunk/Source/WebCore/ChangeLog	2011-10-14 08:36:20 UTC (rev 97451)
@@ -1,3 +1,19 @@
+2011-10-14  Justin Schuh  <[email protected]>
+
+        Clear WebMediaPlayerClientImpl back pointer on destruction
+        https://bugs.webkit.org/show_bug.cgi?id=69973
+
+        Reviewed by James Robinson.
+
+        Clear the backpointer and remove the unused m_currentFrame
+
+        * platform/graphics/chromium/VideoLayerChromium.cpp:
+        (WebCore::VideoLayerChromium::VideoLayerChromium):
+        (WebCore::VideoLayerChromium::cleanupResources):
+        (WebCore::VideoLayerChromium::updateCompositorResources):
+        (WebCore::VideoLayerChromium::releaseProvider):
+        * platform/graphics/chromium/VideoLayerChromium.h:
+
 2011-10-13  Hans Wennborg  <[email protected]>
 
         IndexedDB: Make IDBCursor.value() return an IDBAny object

Modified: trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp (97450 => 97451)


--- trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp	2011-10-14 08:34:05 UTC (rev 97450)
+++ trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp	2011-10-14 08:36:20 UTC (rev 97451)
@@ -56,7 +56,6 @@
     , m_frameFormat(VideoFrameChromium::Invalid)
     , m_provider(provider)
     , m_planes(0)
-    , m_currentFrame(0)
 {
 }
 
@@ -75,12 +74,11 @@
     LayerChromium::cleanupResources();
     for (unsigned i = 0; i < MaxPlanes; ++i)
         m_textures[i].m_texture.clear();
-    releaseCurrentFrame();
 }
 
 void VideoLayerChromium::updateCompositorResources(GraphicsContext3D* context, TextureAllocator* allocator)
 {
-    if (!m_delegate)
+    if (!m_delegate || !m_provider)
         return;
 
     if (m_dirtyRect.isEmpty() && texturesValid()) {
@@ -269,13 +267,9 @@
     }
 }
 
-void VideoLayerChromium::releaseCurrentFrame()
+void VideoLayerChromium::releaseProvider()
 {
-    if (!m_currentFrame)
-        return;
-
-    m_provider->putCurrentFrame(m_currentFrame);
-    m_currentFrame = 0;
+    m_provider = 0;
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.h (97450 => 97451)


--- trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.h	2011-10-14 08:34:05 UTC (rev 97450)
+++ trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.h	2011-10-14 08:36:20 UTC (rev 97451)
@@ -53,9 +53,7 @@
     virtual void updateCompositorResources(GraphicsContext3D*, TextureAllocator*);
     virtual bool drawsContent() const { return true; }
 
-    // This function is called by VideoFrameProvider. When this method is called
-    // putCurrentFrame() must be called to return the frame currently held.
-    void releaseCurrentFrame();
+    void releaseProvider();
 
     virtual void pushPropertiesTo(CCLayerImpl*);
 
@@ -87,10 +85,6 @@
     enum { MaxPlanes = 3 };
     Texture m_textures[MaxPlanes];
     unsigned m_planes;
-
-    // This will be null for the entire duration of video playback if hardware
-    // decoding is not being used.
-    VideoFrameChromium* m_currentFrame;
 };
 
 }

Modified: trunk/Source/WebKit/chromium/ChangeLog (97450 => 97451)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-10-14 08:34:05 UTC (rev 97450)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-10-14 08:36:20 UTC (rev 97451)
@@ -1,3 +1,19 @@
+2011-10-14  Justin Schuh  <[email protected]>
+
+        Clear WebMediaPlayerClientImpl back pointer on destruction
+        https://bugs.webkit.org/show_bug.cgi?id=69973
+
+        Reviewed by James Robinson.
+
+        Clear the backpointer and remove the unused m_currentFrame
+
+        * src/WebMediaPlayerClientImpl.cpp:
+        (WebKit::WebMediaPlayerClientImpl::~WebMediaPlayerClientImpl):
+        (WebKit::WebMediaPlayerClientImpl::load):
+        (WebKit::WebMediaPlayerClientImpl::getCurrentFrame):
+        (WebKit::WebMediaPlayerClientImpl::putCurrentFrame):
+        * src/WebMediaPlayerClientImpl.h:
+
 2011-10-14  Polina Sokolova  <[email protected]>
 
         Make it possible for plugins to get current fullscreen element.

Modified: trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp (97450 => 97451)


--- trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp	2011-10-14 08:34:05 UTC (rev 97450)
+++ trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp	2011-10-14 08:36:20 UTC (rev 97451)
@@ -100,11 +100,10 @@
 
 WebMediaPlayerClientImpl::~WebMediaPlayerClientImpl()
 {
-    // VideoLayerChromium may outlive this object so make sure all frames are
-    // released.
+    // VideoLayerChromium may outlive this object so clear the back pointer.
 #if USE(ACCELERATED_COMPOSITING)
     if (m_videoLayer.get())
-        m_videoLayer->releaseCurrentFrame();
+        m_videoLayer->releaseProvider();
 #endif
 }
 
@@ -220,13 +219,6 @@
 {
     m_url = url;
 
-    // Video frame object is owned by WebMediaPlayer. Before destroying
-    // WebMediaPlayer all frames need to be released.
-#if USE(ACCELERATED_COMPOSITING)
-    if (m_videoLayer.get())
-        m_videoLayer->releaseCurrentFrame();
-#endif
-
     if (m_preload == MediaPlayer::None) {
         m_webMediaPlayer.clear();
         m_delayingLoad = true;
@@ -579,23 +571,24 @@
 
 VideoFrameChromium* WebMediaPlayerClientImpl::getCurrentFrame()
 {
-    VideoFrameChromium* videoFrame = 0;
-    if (m_webMediaPlayer.get()) {
+    ASSERT(!m_currentVideoFrame);
+    if (m_webMediaPlayer && !m_currentVideoFrame) {
         WebVideoFrame* webkitVideoFrame = m_webMediaPlayer->getCurrentFrame();
         if (webkitVideoFrame)
-            videoFrame = new VideoFrameChromiumImpl(webkitVideoFrame);
+            m_currentVideoFrame = adoptPtr(new VideoFrameChromiumImpl(webkitVideoFrame));
     }
-    return videoFrame;
+    return m_currentVideoFrame.get();
 }
 
 void WebMediaPlayerClientImpl::putCurrentFrame(VideoFrameChromium* videoFrame)
 {
-    if (videoFrame) {
+    if (videoFrame && videoFrame == m_currentVideoFrame) {
         if (m_webMediaPlayer.get()) {
             m_webMediaPlayer->putCurrentFrame(
                 VideoFrameChromiumImpl::toWebVideoFrame(videoFrame));
         }
-        delete videoFrame;
+        ASSERT(videoFrame == m_currentVideoFrame);
+        m_currentVideoFrame.clear();
     }
 }
 #endif

Modified: trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h (97450 => 97451)


--- trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h	2011-10-14 08:34:05 UTC (rev 97450)
+++ trunk/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h	2011-10-14 08:36:20 UTC (rev 97451)
@@ -156,6 +156,7 @@
 
     WebCore::MediaPlayer* m_mediaPlayer;
     OwnPtr<WebMediaPlayer> m_webMediaPlayer;
+    OwnPtr<WebCore::VideoFrameChromium> m_currentVideoFrame;
     String m_url;
     bool m_delayingLoad;
     WebCore::MediaPlayer::Preload m_preload;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to