Index: third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp |
index d150c848235c9ef811b0b8e405f15de6e8abe0e5..c5dd7f0dce6bb773cb250b41e87d2796a0201c71 100644 |
--- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp |
@@ -593,21 +593,15 @@ bool GraphicsLayer::hasTrackedPaintInvalidations() const |
void GraphicsLayer::trackPaintInvalidation(const DisplayItemClient& client, const IntRect& rect, PaintInvalidationReason reason) |
{ |
- // The caller must check isTrackingOrCheckingPaintInvalidations() before calling this method |
chrishtr
2016/06/13 20:18:52
This method now gets called in more scenarios?
Xianzhu
2016/06/13 20:52:01
In less scenarios. Now all the callers have rect r
Xianzhu
2016/06/16 19:06:14
I meant we track paint invalidations in less scena
|
- // to avoid constructing the rect unnecessarily. |
- DCHECK(isTrackingOrCheckingPaintInvalidations()); |
- |
- PaintInvalidationTracking& tracking = paintInvalidationTrackingMap().add(this, PaintInvalidationTracking()).storedValue->value; |
- // Omit the entry for trackObjectPaintInvalidation() if the last entry is for the same client. |
- // This is to avoid duplicated entries for setNeedsDisplayInRect() and trackObjectPaintInvalidation(). |
- if (rect.isEmpty() && !tracking.trackedPaintInvalidations.isEmpty() && tracking.trackedPaintInvalidations.last().client == &client) |
+ if (!isTrackingOrCheckingPaintInvalidations() || rect.isEmpty()) |
return; |
+ PaintInvalidationTracking& tracking = paintInvalidationTrackingMap().add(this, PaintInvalidationTracking()).storedValue->value; |
PaintInvalidationInfo info = { &client, client.debugName(), rect, reason }; |
tracking.trackedPaintInvalidations.append(info); |
#if DCHECK_IS_ON() |
- if (!rect.isEmpty() && RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) { |
+ if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) { |
// TODO(crbug.com/496260): Some antialiasing effects overflows the paint invalidation rect. |
IntRect r = rect; |
r.inflate(1); |
@@ -715,14 +709,20 @@ static String pointerAsString(const void* ptr) |
return ts.release(); |
} |
-PassRefPtr<JSONObject> GraphicsLayer::layerTreeAsJSON(LayerTreeFlags flags, RenderingContextMap& renderingContextMap) const |
+PassRefPtr<JSONObject> GraphicsLayer::layerTreeAsJSON(LayerTreeFlags flags) const |
+{ |
+ RenderingContextMap renderingContextMap; |
+ return layerTreeAsJSONInternal(flags, renderingContextMap); |
+} |
+ |
+PassRefPtr<JSONObject> GraphicsLayer::layerTreeAsJSONInternal(LayerTreeFlags flags, RenderingContextMap& renderingContextMap) const |
{ |
RefPtr<JSONObject> json = JSONObject::create(); |
- if (flags & LayerTreeIncludesDebugInfo) { |
+ if (flags & LayerTreeIncludesDebugInfo) |
json->setString("this", pointerAsString(this)); |
- json->setString("debugName", m_client->debugName(this)); |
- } |
+ |
+ json->setString("name", debugName()); |
Xianzhu
2016/06/13 20:52:01
This will help us understand the relationship betw
|
if (m_position != FloatPoint()) |
json->setArray("position", pointAsJSONArray(m_position)); |
@@ -778,7 +778,7 @@ PassRefPtr<JSONObject> GraphicsLayer::layerTreeAsJSON(LayerTreeFlags flags, Rend |
json->setArray("transform", transformAsJSONArray(m_transform)); |
if (m_replicaLayer) |
- json->setObject("replicaLayer", m_replicaLayer->layerTreeAsJSON(flags, renderingContextMap)); |
+ json->setObject("replicaLayer", m_replicaLayer->layerTreeAsJSONInternal(flags, renderingContextMap)); |
if (m_replicatedLayer) |
json->setString("replicatedLayer", flags & LayerTreeIncludesDebugInfo ? pointerAsString(m_replicatedLayer) : ""); |
@@ -862,7 +862,7 @@ PassRefPtr<JSONObject> GraphicsLayer::layerTreeAsJSON(LayerTreeFlags flags, Rend |
if (m_children.size()) { |
RefPtr<JSONArray> childrenJSON = JSONArray::create(); |
for (size_t i = 0; i < m_children.size(); i++) |
- childrenJSON->pushObject(m_children[i]->layerTreeAsJSON(flags, renderingContextMap)); |
+ childrenJSON->pushObject(m_children[i]->layerTreeAsJSONInternal(flags, renderingContextMap)); |
json->setArray("children", childrenJSON); |
} |
@@ -871,9 +871,7 @@ PassRefPtr<JSONObject> GraphicsLayer::layerTreeAsJSON(LayerTreeFlags flags, Rend |
String GraphicsLayer::layerTreeAsText(LayerTreeFlags flags) const |
{ |
- RenderingContextMap renderingContextMap; |
- RefPtr<JSONObject> json = layerTreeAsJSON(flags, renderingContextMap); |
- return json->toPrettyJSONString(); |
+ return layerTreeAsJSON(flags)->toPrettyJSONString(); |
} |
static const cc::Layer* ccLayerForWebLayer(const WebLayer* webLayer) |
@@ -1104,8 +1102,7 @@ void GraphicsLayer::setContentsNeedsDisplay() |
{ |
if (WebLayer* contentsLayer = contentsLayerIfRegistered()) { |
contentsLayer->invalidate(); |
- if (isTrackingOrCheckingPaintInvalidations()) |
- trackPaintInvalidation(*this, m_contentsRect, PaintInvalidationFull); |
+ trackPaintInvalidation(*this, m_contentsRect, PaintInvalidationFull); |
} |
} |
@@ -1120,8 +1117,7 @@ void GraphicsLayer::setNeedsDisplay() |
m_linkHighlights[i]->invalidate(); |
getPaintController().invalidateAll(); |
- if (isTrackingOrCheckingPaintInvalidations()) |
- trackPaintInvalidation(*this, IntRect(IntPoint(), expandedIntSize(m_size)), PaintInvalidationFull); |
+ trackPaintInvalidation(*this, IntRect(IntPoint(), expandedIntSize(m_size)), PaintInvalidationFull); |
} |
void GraphicsLayer::setNeedsDisplayInRect(const IntRect& rect, PaintInvalidationReason invalidationReason, const DisplayItemClient& client) |
@@ -1135,19 +1131,7 @@ void GraphicsLayer::setNeedsDisplayInRect(const IntRect& rect, PaintInvalidation |
for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
m_linkHighlights[i]->invalidate(); |
- if (isTrackingOrCheckingPaintInvalidations()) |
- trackPaintInvalidation(client, rect, invalidationReason); |
-} |
- |
-void GraphicsLayer::displayItemClientWasInvalidated(const DisplayItemClient& displayItemClient, PaintInvalidationReason invalidationReason) |
-{ |
- if (!drawsContent()) |
- return; |
- |
- getPaintController().displayItemClientWasInvalidated(displayItemClient); |
- |
- if (isTrackingOrCheckingPaintInvalidations()) |
- trackPaintInvalidation(displayItemClient, IntRect(), invalidationReason); |
+ trackPaintInvalidation(client, rect, invalidationReason); |
} |
void GraphicsLayer::setContentsRect(const IntRect& rect) |