OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/content_layer.h" | 5 #include "cc/content_layer.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "cc/bitmap_content_layer_updater.h" | 10 #include "cc/bitmap_content_layer_updater.h" |
11 #include "cc/bitmap_skpicture_content_layer_updater.h" | 11 #include "cc/bitmap_skpicture_content_layer_updater.h" |
12 #include "cc/content_layer_client.h" | 12 #include "cc/content_layer_client.h" |
13 #include "cc/layer_painter.h" | 13 #include "cc/layer_painter.h" |
14 #include "cc/layer_tree_host.h" | 14 #include "cc/layer_tree_host.h" |
15 | 15 |
16 namespace cc { | 16 namespace cc { |
17 | 17 |
18 ContentLayerPainter::ContentLayerPainter(ContentLayerClient* client) | 18 ContentLayerPainter::ContentLayerPainter(ContentLayerClient* client) |
19 : m_client(client) | 19 : m_client(client) |
20 { | 20 { |
21 } | 21 } |
22 | 22 |
23 scoped_ptr<ContentLayerPainter> ContentLayerPainter::create(ContentLayerClient*
client) | 23 scoped_ptr<ContentLayerPainter> ContentLayerPainter::create(ContentLayerClient*
client) |
24 { | 24 { |
25 return make_scoped_ptr(new ContentLayerPainter(client)); | 25 return make_scoped_ptr(new ContentLayerPainter(client)); |
26 } | 26 } |
27 | 27 |
28 void ContentLayerPainter::paint(SkCanvas* canvas, const gfx::Rect& contentRect,
gfx::RectF& opaque) | 28 void ContentLayerPainter::paint(SkCanvas* canvas, gfx::Rect contentRect, gfx::Re
ctF& opaque) |
29 { | 29 { |
30 base::TimeTicks paintStart = base::TimeTicks::HighResNow(); | 30 base::TimeTicks paintStart = base::TimeTicks::HighResNow(); |
31 m_client->paintContents(canvas, contentRect, opaque); | 31 m_client->paintContents(canvas, contentRect, opaque); |
32 base::TimeTicks paintEnd = base::TimeTicks::HighResNow(); | 32 base::TimeTicks paintEnd = base::TimeTicks::HighResNow(); |
33 double pixelsPerSec = (contentRect.width() * contentRect.height()) / (paintE
nd - paintStart).InSecondsF(); | 33 double pixelsPerSec = (contentRect.width() * contentRect.height()) / (paintE
nd - paintStart).InSecondsF(); |
34 HISTOGRAM_CUSTOM_COUNTS("Renderer4.AccelContentPaintDurationMS", (paintEnd -
paintStart).InMilliseconds(), 0, 120, 30); | 34 HISTOGRAM_CUSTOM_COUNTS("Renderer4.AccelContentPaintDurationMS", (paintEnd -
paintStart).InMilliseconds(), 0, 120, 30); |
35 HISTOGRAM_CUSTOM_COUNTS("Renderer4.AccelContentPaintMegapixPerSecond", pixel
sPerSec / 1000000, 10, 210, 30); | 35 HISTOGRAM_CUSTOM_COUNTS("Renderer4.AccelContentPaintMegapixPerSecond", pixel
sPerSec / 1000000, 10, 210, 30); |
36 } | 36 } |
37 | 37 |
38 const int ContentLayer::kLCDTextMaxChangeCount = 1; | 38 const int ContentLayer::kLCDTextMaxChangeCount = 1; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // it does not really cause any invalidation. | 138 // it does not really cause any invalidation. |
139 TRACE_EVENT_INSTANT0("cc", "ContentLayer::canUseLCDTextDidChange"); | 139 TRACE_EVENT_INSTANT0("cc", "ContentLayer::canUseLCDTextDidChange"); |
140 } | 140 } |
141 ++m_lcdTextChangeCount; | 141 ++m_lcdTextChangeCount; |
142 | 142 |
143 // Need to repaint the layer with different text AA setting. | 143 // Need to repaint the layer with different text AA setting. |
144 setNeedsDisplay(); | 144 setNeedsDisplay(); |
145 } | 145 } |
146 | 146 |
147 } // namespace cc | 147 } // namespace cc |
OLD | NEW |