Title: [115734] branches/chromium/1084/Source/WebCore/platform/graphics/chromium/cc
- Revision
- 115734
- Author
- [email protected]
- Date
- 2012-05-01 10:08:55 -0700 (Tue, 01 May 2012)
Log Message
Merged 115281 - [chromium] Hold video provider lock from willDraw to didDraw
https://bugs.webkit.org/show_bug.cgi?id=84805
Reviewed by James Robinson.
Note: merged by hand due to conflicts.
* platform/graphics/chromium/cc/CCVideoLayerImpl.cpp:
(WebCore::CCVideoLayerImpl::willDraw):
(WebCore):
(WebCore::CCVideoLayerImpl::willDrawInternal):
(WebCore::CCVideoLayerImpl::appendQuads):
(WebCore::CCVideoLayerImpl::didDraw):
* platform/graphics/chromium/cc/CCVideoLayerImpl.h:
Modified Paths
Diff
Modified: branches/chromium/1084/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp (115733 => 115734)
--- branches/chromium/1084/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp 2012-05-01 16:59:33 UTC (rev 115733)
+++ branches/chromium/1084/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp 2012-05-01 17:08:55 UTC (rev 115734)
@@ -129,8 +129,25 @@
ASSERT(CCProxy::isImplThread());
CCLayerImpl::willDraw(layerRenderer);
- MutexLocker locker(m_providerMutex);
+ // Explicitly lock and unlock the provider mutex so it can be held from
+ // willDraw to didDraw. Since the compositor thread is in the middle of
+ // drawing, the layer will not be destroyed before didDraw is called.
+ // Therefore, the only thing that will prevent this lock from being released
+ // is the GPU process locking it. As the GPU process can't cause the
+ // destruction of the provider (calling stopUsingProvider), holding this
+ // lock should not cause a deadlock.
+ m_providerMutex.lock();
+ willDrawInternal(layerRenderer);
+
+ if (!m_frame)
+ m_providerMutex.unlock();
+}
+
+void CCVideoLayerImpl::willDrawInternal(LayerRendererChromium* layerRenderer)
+{
+ ASSERT(CCProxy::isImplThread());
+
if (!m_provider) {
m_frame = 0;
return;
@@ -157,6 +174,8 @@
void CCVideoLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool&)
{
+ ASSERT(CCProxy::isImplThread());
+
if (!m_frame)
return;
@@ -174,15 +193,15 @@
ASSERT(CCProxy::isImplThread());
CCLayerImpl::didDraw();
- MutexLocker locker(m_providerMutex);
-
- if (!m_provider || !m_frame)
+ if (!m_frame)
return;
for (unsigned plane = 0; plane < m_frame->planes(); ++plane)
m_textures[plane].m_texture->unreserve();
m_provider->putCurrentFrame(m_frame);
m_frame = 0;
+
+ m_providerMutex.unlock();
}
IntSize CCVideoLayerImpl::computeVisibleSize(const VideoFrameChromium* frame, unsigned plane)
Modified: branches/chromium/1084/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h (115733 => 115734)
--- branches/chromium/1084/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h 2012-05-01 16:59:33 UTC (rev 115733)
+++ branches/chromium/1084/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h 2012-05-01 17:08:55 UTC (rev 115734)
@@ -86,9 +86,11 @@
static IntSize computeVisibleSize(const VideoFrameChromium*, unsigned plane);
virtual const char* layerTypeAsString() const { return "VideoLayer"; }
+ void willDrawInternal(LayerRendererChromium*);
bool reserveTextures(const VideoFrameChromium*, GC3Denum format, LayerRendererChromium*);
- Mutex m_providerMutex; // Guards m_provider below.
+ // Guards the destruction of m_provider and the frame that it provides
+ Mutex m_providerMutex;
VideoFrameProvider* m_provider;
Texture m_textures[MaxPlanes];
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes