Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: Source/platform/graphics/GraphicsLayer.cpp

Issue 498193003: Add |GraphicsLayerDebugInfo::getAnnotatedInvalidationRects| (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: use TRACE_EVENT Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /* * Copyright (C) 2009 Apple Inc. All rights reserved.
2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 2 *
4 * Redistribution and use in source and binary forms, with or without 3 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 4 * modification, are permitted provided that the following conditions
6 * are met: 5 * are met:
7 * 1. Redistributions of source code must retain the above copyright 6 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 7 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 8 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 9 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 10 * documentation and/or other materials provided with the distribution.
12 * 11 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 12 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 14 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 15 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 16 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 17 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 18 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 19 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 20 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 23 */
25 24
26 #include "config.h" 25 #include "config.h"
27 26
28 #include "platform/graphics/GraphicsLayer.h" 27 #include "platform/graphics/GraphicsLayer.h"
29 28
30 #include "SkImageFilter.h" 29 #include "SkImageFilter.h"
31 #include "SkMatrix44.h" 30 #include "SkMatrix44.h"
31 #include "platform/TraceEvent.h"
32 #include "platform/geometry/FloatRect.h" 32 #include "platform/geometry/FloatRect.h"
33 #include "platform/geometry/LayoutRect.h" 33 #include "platform/geometry/LayoutRect.h"
34 #include "platform/graphics/GraphicsLayerFactory.h" 34 #include "platform/graphics/GraphicsLayerFactory.h"
35 #include "platform/graphics/Image.h" 35 #include "platform/graphics/Image.h"
36 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" 36 #include "platform/graphics/filters/SkiaImageFilterBuilder.h"
37 #include "platform/graphics/skia/NativeImageSkia.h" 37 #include "platform/graphics/skia/NativeImageSkia.h"
38 #include "platform/scroll/ScrollableArea.h" 38 #include "platform/scroll/ScrollableArea.h"
39 #include "platform/text/TextStream.h" 39 #include "platform/text/TextStream.h"
40 #include "public/platform/Platform.h" 40 #include "public/platform/Platform.h"
41 #include "public/platform/WebCompositorAnimation.h" 41 #include "public/platform/WebCompositorAnimation.h"
(...skipping 17 matching lines...) Expand all
59 #endif 59 #endif
60 60
61 using blink::Platform; 61 using blink::Platform;
62 using blink::WebCompositorAnimation; 62 using blink::WebCompositorAnimation;
63 using blink::WebFilterOperations; 63 using blink::WebFilterOperations;
64 using blink::WebLayer; 64 using blink::WebLayer;
65 using blink::WebPoint; 65 using blink::WebPoint;
66 66
67 namespace blink { 67 namespace blink {
68 68
69 namespace {
70
71 bool firstPaintInvalidationTrackingEnabled()
72 {
73 bool isEnabled;
74 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("blink.invalida tion"), &isEnabled);
enne (OOO) 2014/09/04 18:39:33 How do you plan on having this handle show paint r
kouhei (in TOK) 2014/09/04 18:58:52 Devtools has access to the trace event category fl
enne (OOO) 2014/09/04 21:39:40 Flipping the flag = enabling that trace category?
75 return isEnabled;
76 }
77
78 } // namespace
79
69 typedef HashMap<const GraphicsLayer*, Vector<FloatRect> > RepaintMap; 80 typedef HashMap<const GraphicsLayer*, Vector<FloatRect> > RepaintMap;
70 static RepaintMap& repaintRectMap() 81 static RepaintMap& repaintRectMap()
71 { 82 {
72 DEFINE_STATIC_LOCAL(RepaintMap, map, ()); 83 DEFINE_STATIC_LOCAL(RepaintMap, map, ());
73 return map; 84 return map;
74 } 85 }
75 86
76 PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, G raphicsLayerClient* client) 87 PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, G raphicsLayerClient* client)
77 { 88 {
78 return factory->createGraphicsLayer(client); 89 return factory->createGraphicsLayer(client);
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 277
267 // If the compositing layer offset changes, we need to repaint. 278 // If the compositing layer offset changes, we need to repaint.
268 if (shouldSetNeedsDisplay == SetNeedsDisplay) 279 if (shouldSetNeedsDisplay == SetNeedsDisplay)
269 setNeedsDisplay(); 280 setNeedsDisplay();
270 } 281 }
271 282
272 void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const I ntRect& clip) 283 void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const I ntRect& clip)
273 { 284 {
274 if (!m_client) 285 if (!m_client)
275 return; 286 return;
287 if (firstPaintInvalidationTrackingEnabled())
288 m_debugInfo.clearAnnotatedInvalidateRects();
276 incrementPaintCount(); 289 incrementPaintCount();
277 m_client->paintContents(this, context, m_paintingPhase, clip); 290 m_client->paintContents(this, context, m_paintingPhase, clip);
278 } 291 }
279 292
280 void GraphicsLayer::updateChildList() 293 void GraphicsLayer::updateChildList()
281 { 294 {
282 WebLayer* childHost = m_layer->layer(); 295 WebLayer* childHost = m_layer->layer();
283 childHost->removeAllChildren(); 296 childHost->removeAllChildren();
284 297
285 clearContentsLayerIfUnregistered(); 298 clearContentsLayerIfUnregistered();
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 void GraphicsLayer::setNeedsDisplay() 903 void GraphicsLayer::setNeedsDisplay()
891 { 904 {
892 if (drawsContent()) { 905 if (drawsContent()) {
893 m_layer->layer()->invalidate(); 906 m_layer->layer()->invalidate();
894 addRepaintRect(FloatRect(FloatPoint(), m_size)); 907 addRepaintRect(FloatRect(FloatPoint(), m_size));
895 for (size_t i = 0; i < m_linkHighlights.size(); ++i) 908 for (size_t i = 0; i < m_linkHighlights.size(); ++i)
896 m_linkHighlights[i]->invalidate(); 909 m_linkHighlights[i]->invalidate();
897 } 910 }
898 } 911 }
899 912
900 void GraphicsLayer::setNeedsDisplayInRect(const FloatRect& rect) 913 void GraphicsLayer::setNeedsDisplayInRect(const FloatRect& rect, WebInvalidation DebugAnnotations annotations)
901 { 914 {
902 if (drawsContent()) { 915 if (drawsContent()) {
903 m_layer->layer()->invalidateRect(rect); 916 m_layer->layer()->invalidateRect(rect);
917 if (firstPaintInvalidationTrackingEnabled())
918 m_debugInfo.appendAnnotatedInvalidateRect(rect, annotations);
904 addRepaintRect(rect); 919 addRepaintRect(rect);
905 for (size_t i = 0; i < m_linkHighlights.size(); ++i) 920 for (size_t i = 0; i < m_linkHighlights.size(); ++i)
906 m_linkHighlights[i]->invalidate(); 921 m_linkHighlights[i]->invalidate();
907 } 922 }
908 } 923 }
909 924
910 void GraphicsLayer::setContentsRect(const IntRect& rect) 925 void GraphicsLayer::setContentsRect(const IntRect& rect)
911 { 926 {
912 if (rect == m_contentsRect) 927 if (rect == m_contentsRect)
913 return; 928 return;
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 #ifndef NDEBUG 1071 #ifndef NDEBUG
1057 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) 1072 void showGraphicsLayerTree(const blink::GraphicsLayer* layer)
1058 { 1073 {
1059 if (!layer) 1074 if (!layer)
1060 return; 1075 return;
1061 1076
1062 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); 1077 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo);
1063 fprintf(stderr, "%s\n", output.utf8().data()); 1078 fprintf(stderr, "%s\n", output.utf8().data());
1064 } 1079 }
1065 #endif 1080 #endif
OLDNEW
« no previous file with comments | « Source/platform/graphics/GraphicsLayer.h ('k') | Source/platform/graphics/GraphicsLayerDebugInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698