Title: [136139] trunk/Source/WebKit2
- Revision
- 136139
- Author
- [email protected]
- Date
- 2012-11-29 10:17:51 -0800 (Thu, 29 Nov 2012)
Log Message
[CoordinatedGraphics] Have LayerTreeRenderer::ensureLayer() return the layer
https://bugs.webkit.org/show_bug.cgi?id=103645
Reviewed by Noam Rosenthal.
The current LayerTreeRenderer code keep calling ensureLayer() and then
LayerMap::find() to retrieve the layer. Since ensureLayer() already has
a pointer to the layer, we can simply have the function return it.
This is slightly more efficient and it makes the code a bit simpler.
* UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:
(WebKit::LayerTreeRenderer::setLayerChildren):
(WebKit::LayerTreeRenderer::setLayerFilters):
(WebKit::LayerTreeRenderer::setLayerState):
(WebKit::LayerTreeRenderer::ensureLayer):
* UIProcess/CoordinatedGraphics/LayerTreeRenderer.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (136138 => 136139)
--- trunk/Source/WebKit2/ChangeLog 2012-11-29 18:14:58 UTC (rev 136138)
+++ trunk/Source/WebKit2/ChangeLog 2012-11-29 18:17:51 UTC (rev 136139)
@@ -1,3 +1,22 @@
+2012-11-29 Christophe Dumez <[email protected]>
+
+ [CoordinatedGraphics] Have LayerTreeRenderer::ensureLayer() return the layer
+ https://bugs.webkit.org/show_bug.cgi?id=103645
+
+ Reviewed by Noam Rosenthal.
+
+ The current LayerTreeRenderer code keep calling ensureLayer() and then
+ LayerMap::find() to retrieve the layer. Since ensureLayer() already has
+ a pointer to the layer, we can simply have the function return it.
+ This is slightly more efficient and it makes the code a bit simpler.
+
+ * UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:
+ (WebKit::LayerTreeRenderer::setLayerChildren):
+ (WebKit::LayerTreeRenderer::setLayerFilters):
+ (WebKit::LayerTreeRenderer::setLayerState):
+ (WebKit::LayerTreeRenderer::ensureLayer):
+ * UIProcess/CoordinatedGraphics/LayerTreeRenderer.h:
+
2012-11-29 Mikhail Pozdnyakov <[email protected]>
[WK2] TiledBackingStore: User events are sent to web page before it is shown
Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp (136138 => 136139)
--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp 2012-11-29 18:14:58 UTC (rev 136138)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp 2012-11-29 18:17:51 UTC (rev 136139)
@@ -266,9 +266,7 @@
void LayerTreeRenderer::setLayerChildren(WebLayerID id, const Vector<WebLayerID>& childIDs)
{
- ensureLayer(id);
- LayerMap::iterator it = m_layers.find(id);
- GraphicsLayer* layer = it->value;
+ GraphicsLayer* layer = ensureLayer(id);
Vector<GraphicsLayer*> children;
for (size_t i = 0; i < childIDs.size(); ++i) {
@@ -286,11 +284,8 @@
#if ENABLE(CSS_FILTERS)
void LayerTreeRenderer::setLayerFilters(WebLayerID id, const FilterOperations& filters)
{
- ensureLayer(id);
- LayerMap::iterator it = m_layers.find(id);
- ASSERT(it != m_layers.end());
+ GraphicsLayer* layer = ensureLayer(id);
- GraphicsLayer* layer = it->value;
#if ENABLE(CSS_SHADERS)
injectCachedCustomFilterPrograms(filters);
#endif
@@ -332,12 +327,8 @@
void LayerTreeRenderer::setLayerState(WebLayerID id, const WebLayerInfo& layerInfo)
{
- ensureLayer(id);
- LayerMap::iterator it = m_layers.find(id);
- ASSERT(it != m_layers.end());
+ GraphicsLayer* layer = ensureLayer(id);
- GraphicsLayer* layer = it->value;
-
layer->setReplicatedByLayer(layerByID(layerInfo.replica));
layer->setMaskLayer(layerByID(layerInfo.mask));
@@ -385,12 +376,18 @@
}
-void LayerTreeRenderer::ensureLayer(WebLayerID id)
+WebCore::GraphicsLayer* LayerTreeRenderer::ensureLayer(WebLayerID id)
{
+ LayerMap::iterator it = m_layers.find(id);
+ if (it != m_layers.end())
+ return it->value;
+
// We have to leak the new layer's pointer and manage it ourselves,
// because OwnPtr is not copyable.
- if (m_layers.find(id) == m_layers.end())
- m_layers.add(id, createLayer(id).leakPtr());
+ WebCore::GraphicsLayer* layer = createLayer(id).leakPtr();
+ m_layers.add(id, layer);
+
+ return layer;
}
void LayerTreeRenderer::setRootLayerID(WebLayerID layerID)
Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h (136138 => 136139)
--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h 2012-11-29 18:14:58 UTC (rev 136138)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h 2012-11-29 18:17:51 UTC (rev 136139)
@@ -142,7 +142,7 @@
void assignImageBackingToLayer(WebCore::GraphicsLayer*, CoordinatedImageBackingID);
void removeReleasedImageBackingsIfNeeded();
void ensureRootLayer();
- void ensureLayer(WebLayerID);
+ WebCore::GraphicsLayer* ensureLayer(WebLayerID);
void commitPendingBackingStoreOperations();
CoordinatedBackingStore* getBackingStore(WebCore::GraphicsLayer*);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes