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

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

Issue 1205703003: Add tracing for ContentLayerDelegate paintContents and DisplayItemList commit. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | Source/platform/graphics/paint/DisplayItemList.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 10 matching lines...) Expand all
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 23 */
24 24
25 #include "config.h" 25 #include "config.h"
26 26
27 #include "platform/graphics/ContentLayerDelegate.h" 27 #include "platform/graphics/ContentLayerDelegate.h"
28 28
29 #include "platform/EventTracer.h" 29 #include "platform/EventTracer.h"
30 #include "platform/RuntimeEnabledFeatures.h" 30 #include "platform/RuntimeEnabledFeatures.h"
31 #include "platform/TraceEvent.h"
32 #include "platform/TracedValue.h"
31 #include "platform/geometry/IntRect.h" 33 #include "platform/geometry/IntRect.h"
32 #include "platform/graphics/GraphicsContext.h" 34 #include "platform/graphics/GraphicsContext.h"
33 #include "platform/graphics/paint/DisplayItemList.h" 35 #include "platform/graphics/paint/DisplayItemList.h"
34 #include "platform/transforms/AffineTransform.h" 36 #include "platform/transforms/AffineTransform.h"
35 #include "platform/transforms/TransformationMatrix.h" 37 #include "platform/transforms/TransformationMatrix.h"
36 #include "public/platform/WebDisplayItemList.h" 38 #include "public/platform/WebDisplayItemList.h"
37 #include "public/platform/WebFloatRect.h" 39 #include "public/platform/WebFloatRect.h"
38 #include "public/platform/WebRect.h" 40 #include "public/platform/WebRect.h"
39 #include "third_party/skia/include/core/SkCanvas.h" 41 #include "third_party/skia/include/core/SkCanvas.h"
40 #include "third_party/skia/include/core/SkPicture.h" 42 #include "third_party/skia/include/core/SkPicture.h"
41 #include "third_party/skia/include/core/SkPictureRecorder.h" 43 #include "third_party/skia/include/core/SkPictureRecorder.h"
42 44
43 namespace blink { 45 namespace blink {
44 46
45 ContentLayerDelegate::ContentLayerDelegate(GraphicsContextPainter* painter) 47 ContentLayerDelegate::ContentLayerDelegate(GraphicsContextPainter* painter)
46 : m_painter(painter) 48 : m_painter(painter)
47 { 49 {
48 } 50 }
49 51
50 ContentLayerDelegate::~ContentLayerDelegate() 52 ContentLayerDelegate::~ContentLayerDelegate()
51 { 53 {
52 } 54 }
53 55
56 PassRefPtr<TracedValue> toTracedValue(const WebRect& clip)
57 {
58 RefPtr<TracedValue> tracedValue = TracedValue::create();
59 tracedValue->beginArray();
60 tracedValue->pushInteger(clip.x);
61 tracedValue->pushInteger(clip.y);
62 tracedValue->pushInteger(clip.x + clip.width);
63 tracedValue->pushInteger(clip.y + clip.height);
Xianzhu 2015/06/23 22:58:54 The third and fourth values of rect might be ambig
chrishtr 2015/06/23 23:05:38 Done.
64 tracedValue->endArray();
65 return tracedValue;
66 }
67
54 void ContentLayerDelegate::paintContents( 68 void ContentLayerDelegate::paintContents(
55 SkCanvas* canvas, const WebRect& clip, 69 SkCanvas* canvas, const WebRect& clip,
56 WebContentLayerClient::PaintingControlSetting paintingControl) 70 WebContentLayerClient::PaintingControlSetting paintingControl)
57 { 71 {
72 TRACE_EVENT1("blink,benchmark", "ContentLayerDelegate::paintContents", "clip _rect", toTracedValue(clip));
73
58 ASSERT(!RuntimeEnabledFeatures::slimmingPaintEnabled()); 74 ASSERT(!RuntimeEnabledFeatures::slimmingPaintEnabled());
59 75
60 GraphicsContext::DisabledMode disabledMode = GraphicsContext::NothingDisable d; 76 GraphicsContext::DisabledMode disabledMode = GraphicsContext::NothingDisable d;
61 if (paintingControl == WebContentLayerClient::DisplayListPaintingDisabled 77 if (paintingControl == WebContentLayerClient::DisplayListPaintingDisabled
62 || paintingControl == WebContentLayerClient::DisplayListConstructionDisa bled) 78 || paintingControl == WebContentLayerClient::DisplayListConstructionDisa bled)
63 disabledMode = GraphicsContext::FullyDisabled; 79 disabledMode = GraphicsContext::FullyDisabled;
64 OwnPtr<GraphicsContext> context = GraphicsContext::deprecatedCreateWithCanva s(canvas, disabledMode); 80 OwnPtr<GraphicsContext> context = GraphicsContext::deprecatedCreateWithCanva s(canvas, disabledMode);
65 81
66 m_painter->paint(*context, clip); 82 m_painter->paint(*context, clip);
67 } 83 }
68 84
69 void ContentLayerDelegate::paintContents( 85 void ContentLayerDelegate::paintContents(
70 WebDisplayItemList* webDisplayItemList, const WebRect& clip, 86 WebDisplayItemList* webDisplayItemList, const WebRect& clip,
71 WebContentLayerClient::PaintingControlSetting paintingControl) 87 WebContentLayerClient::PaintingControlSetting paintingControl)
72 { 88 {
89 TRACE_EVENT1("blink,benchmark", "ContentLayerDelegate::paintContents", "clip _rect", toTracedValue(clip));
90
73 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); 91 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled());
74 92
75 DisplayItemList* displayItemList = m_painter->displayItemList(); 93 DisplayItemList* displayItemList = m_painter->displayItemList();
76 ASSERT(displayItemList); 94 ASSERT(displayItemList);
77 displayItemList->setDisplayItemConstructionIsDisabled( 95 displayItemList->setDisplayItemConstructionIsDisabled(
78 paintingControl == WebContentLayerClient::DisplayListConstructionDisable d); 96 paintingControl == WebContentLayerClient::DisplayListConstructionDisable d);
79 97
80 // We also disable caching when Painting or Construction are disabled. In bo th cases we would like 98 // We also disable caching when Painting or Construction are disabled. In bo th cases we would like
81 // to compare assuming the full cost of recording, not the cost of re-using cached content. 99 // to compare assuming the full cost of recording, not the cost of re-using cached content.
82 if (paintingControl != WebContentLayerClient::PaintDefaultBehavior) 100 if (paintingControl != WebContentLayerClient::PaintDefaultBehavior)
83 displayItemList->invalidateAll(); 101 displayItemList->invalidateAll();
84 102
85 GraphicsContext::DisabledMode disabledMode = GraphicsContext::NothingDisable d; 103 GraphicsContext::DisabledMode disabledMode = GraphicsContext::NothingDisable d;
86 if (paintingControl == WebContentLayerClient::DisplayListPaintingDisabled 104 if (paintingControl == WebContentLayerClient::DisplayListPaintingDisabled
87 || paintingControl == WebContentLayerClient::DisplayListConstructionDisa bled) 105 || paintingControl == WebContentLayerClient::DisplayListConstructionDisa bled)
88 disabledMode = GraphicsContext::FullyDisabled; 106 disabledMode = GraphicsContext::FullyDisabled;
89 GraphicsContext context(displayItemList, disabledMode); 107 GraphicsContext context(displayItemList, disabledMode);
90 108
91 m_painter->paint(context, clip); 109 m_painter->paint(context, clip);
92 110
93 displayItemList->commitNewDisplayItemsAndAppendToWebDisplayItemList(webDispl ayItemList); 111 displayItemList->commitNewDisplayItemsAndAppendToWebDisplayItemList(webDispl ayItemList);
94 } 112 }
95 113
96 } // namespace blink 114 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/platform/graphics/paint/DisplayItemList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698