Title: [133599] trunk/Source/WebKit2
- Revision
- 133599
- Author
- kbal...@webkit.org
- Date
- 2012-11-06 06:40:11 -0800 (Tue, 06 Nov 2012)
Log Message
[CoordinatedGraphics] Access to LayerTreeRenderer::m_renderQueue should be thread safe
https://bugs.webkit.org/show_bug.cgi?id=101341
Reviewed by Noam Rosenthal.
The queue can be accessed from public API so we should make
sure it is not updated concurrently with a threaded render loop.
* UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:
(WebKit::LayerTreeRenderer::syncRemoteContent):
(WebKit::LayerTreeRenderer::appendUpdate):
* UIProcess/CoordinatedGraphics/LayerTreeRenderer.h:
(LayerTreeRenderer):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (133598 => 133599)
--- trunk/Source/WebKit2/ChangeLog 2012-11-06 14:18:33 UTC (rev 133598)
+++ trunk/Source/WebKit2/ChangeLog 2012-11-06 14:40:11 UTC (rev 133599)
@@ -1,3 +1,19 @@
+2012-11-06 Balazs Kelemen <kbal...@webkit.org>
+
+ [CoordinatedGraphics] Access to LayerTreeRenderer::m_renderQueue should be thread safe
+ https://bugs.webkit.org/show_bug.cgi?id=101341
+
+ Reviewed by Noam Rosenthal.
+
+ The queue can be accessed from public API so we should make
+ sure it is not updated concurrently with a threaded render loop.
+
+ * UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:
+ (WebKit::LayerTreeRenderer::syncRemoteContent):
+ (WebKit::LayerTreeRenderer::appendUpdate):
+ * UIProcess/CoordinatedGraphics/LayerTreeRenderer.h:
+ (LayerTreeRenderer):
+
2012-11-06 Mikhail Pozdnyakov <mikhail.pozdnya...@intel.com>
[EFL][WK2] Make Ewk_Context Ewk_Object
Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp (133598 => 133599)
--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp 2012-11-06 14:18:33 UTC (rev 133598)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp 2012-11-06 14:40:11 UTC (rev 133599)
@@ -462,9 +462,17 @@
// We enqueue messages and execute them during paint, as they require an active GL context.
ensureRootLayer();
- for (size_t i = 0; i < m_renderQueue.size(); ++i)
- m_renderQueue[i]();
+ Vector<Function<void()> > renderQueue;
+ bool calledOnMainThread = WTF::isMainThread();
+ if (!calledOnMainThread)
+ m_renderQueueMutex.lock();
+ renderQueue.swap(m_renderQueue);
+ if (!calledOnMainThread)
+ m_renderQueueMutex.unlock();
+ for (size_t i = 0; i < renderQueue.size(); ++i)
+ renderQueue[i]();
+
m_renderQueue.clear();
}
@@ -522,6 +530,8 @@
if (!m_isActive)
return;
+ ASSERT(isMainThread());
+ MutexLocker locker(m_renderQueueMutex);
m_renderQueue.append(function);
}
Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h (133598 => 133599)
--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h 2012-11-06 14:18:33 UTC (rev 133598)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h 2012-11-06 14:40:11 UTC (rev 133599)
@@ -126,6 +126,7 @@
// Render queue can be accessed ony from main thread or updatePaintNode call stack!
Vector<Function<void()> > m_renderQueue;
+ Mutex m_renderQueueMutex;
#if USE(TEXTURE_MAPPER)
OwnPtr<WebCore::TextureMapper> m_textureMapper;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes