Title: [97679] branches/chromium/874/Source
- Revision
- 97679
- Author
- [email protected]
- Date
- 2011-10-17 17:26:08 -0700 (Mon, 17 Oct 2011)
Log Message
Merge 97451 - 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:
[email protected]
Review URL: http://codereview.chromium.org/8333009
Modified Paths
Diff
Modified: branches/chromium/874/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp (97678 => 97679)
--- branches/chromium/874/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp 2011-10-18 00:07:33 UTC (rev 97678)
+++ branches/chromium/874/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp 2011-10-18 00:26:08 UTC (rev 97679)
@@ -56,7 +56,6 @@
, m_skipsDraw(true)
, m_frameFormat(VideoFrameChromium::Invalid)
, m_provider(provider)
- , m_currentFrame(0)
{
}
@@ -75,12 +74,11 @@
LayerChromium::cleanupResources();
for (size_t i = 0; i < 3; ++i)
m_textures[i].m_texture.clear();
- releaseCurrentFrame();
}
void VideoLayerChromium::updateCompositorResources(GraphicsContext3D* context)
{
- if (!m_contentsDirty || !m_owner)
+ if (!m_contentsDirty || !m_owner || !m_provider)
return;
RenderLayerBacking* backing = static_cast<RenderLayerBacking*>(m_owner->client());
@@ -246,13 +244,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: branches/chromium/874/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.h (97678 => 97679)
--- branches/chromium/874/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.h 2011-10-18 00:07:33 UTC (rev 97678)
+++ branches/chromium/874/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.h 2011-10-18 00:26:08 UTC (rev 97679)
@@ -53,9 +53,7 @@
virtual void updateCompositorResources(GraphicsContext3D*);
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*);
@@ -85,10 +83,6 @@
VideoFrameProvider* m_provider;
Texture m_textures[3];
-
- // This will be null for the entire duration of video playback if hardware
- // decoding is not being used.
- VideoFrameChromium* m_currentFrame;
};
}
Modified: branches/chromium/874/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp (97678 => 97679)
--- branches/chromium/874/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp 2011-10-18 00:07:33 UTC (rev 97678)
+++ branches/chromium/874/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp 2011-10-18 00:26:08 UTC (rev 97679)
@@ -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;
@@ -577,23 +569,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: branches/chromium/874/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h (97678 => 97679)
--- branches/chromium/874/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h 2011-10-18 00:07:33 UTC (rev 97678)
+++ branches/chromium/874/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h 2011-10-18 00:26:08 UTC (rev 97679)
@@ -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