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

Side by Side Diff: cc/layers/content_layer.cc

Issue 282493002: cc: Remove AccelContentPaintDurationMS and related histos. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit changes Created 6 years, 7 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/layers/content_layer.h" 5 #include "cc/layers/content_layer.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "cc/layers/content_layer_client.h" 10 #include "cc/layers/content_layer_client.h"
11 #include "cc/resources/bitmap_content_layer_updater.h" 11 #include "cc/resources/bitmap_content_layer_updater.h"
12 #include "cc/resources/bitmap_skpicture_content_layer_updater.h" 12 #include "cc/resources/bitmap_skpicture_content_layer_updater.h"
13 #include "cc/resources/layer_painter.h" 13 #include "cc/resources/layer_painter.h"
14 #include "cc/trees/layer_tree_host.h" 14 #include "cc/trees/layer_tree_host.h"
15 #include "third_party/skia/include/core/SkPictureRecorder.h" 15 #include "third_party/skia/include/core/SkPictureRecorder.h"
16 16
17 namespace cc { 17 namespace cc {
18 18
19 ContentLayerPainter::ContentLayerPainter(ContentLayerClient* client) 19 ContentLayerPainter::ContentLayerPainter(ContentLayerClient* client)
20 : client_(client) {} 20 : client_(client) {}
21 21
22 scoped_ptr<ContentLayerPainter> ContentLayerPainter::Create( 22 scoped_ptr<ContentLayerPainter> ContentLayerPainter::Create(
23 ContentLayerClient* client) { 23 ContentLayerClient* client) {
24 return make_scoped_ptr(new ContentLayerPainter(client)); 24 return make_scoped_ptr(new ContentLayerPainter(client));
25 } 25 }
26 26
27 void ContentLayerPainter::Paint(SkCanvas* canvas, 27 void ContentLayerPainter::Paint(SkCanvas* canvas,
28 const gfx::Rect& content_rect, 28 const gfx::Rect& content_rect,
29 gfx::RectF* opaque) { 29 gfx::RectF* opaque) {
30 base::TimeTicks paint_start = base::TimeTicks::HighResNow();
31 client_->PaintContents(canvas, 30 client_->PaintContents(canvas,
32 content_rect, 31 content_rect,
33 opaque, 32 opaque,
34 ContentLayerClient::GRAPHICS_CONTEXT_ENABLED); 33 ContentLayerClient::GRAPHICS_CONTEXT_ENABLED);
35 base::TimeTicks paint_end = base::TimeTicks::HighResNow();
36 // The start and end times might be the same if the paint was very fast or if
37 // our timer granularity is poor. Treat this as a very short time duration
38 // instead of none to avoid dividing by zero.
39 if (paint_end == paint_start)
40 paint_end += base::TimeDelta::FromMicroseconds(1);
41
42 double pixels_per_sec = (content_rect.width() * content_rect.height()) /
43 (paint_end - paint_start).InSecondsF();
44 UMA_HISTOGRAM_CUSTOM_COUNTS("Renderer4.AccelContentPaintDurationMS",
45 (paint_end - paint_start).InMilliseconds(),
46 0,
47 120,
48 30);
49 UMA_HISTOGRAM_CUSTOM_COUNTS("Renderer4.AccelContentPaintMegapixPerSecond",
50 pixels_per_sec / 1000000,
51 10,
52 210,
53 30);
54 } 34 }
55 35
56 scoped_refptr<ContentLayer> ContentLayer::Create(ContentLayerClient* client) { 36 scoped_refptr<ContentLayer> ContentLayer::Create(ContentLayerClient* client) {
57 return make_scoped_refptr(new ContentLayer(client)); 37 return make_scoped_refptr(new ContentLayer(client));
58 } 38 }
59 39
60 ContentLayer::ContentLayer(ContentLayerClient* client) 40 ContentLayer::ContentLayer(ContentLayerClient* client)
61 : TiledLayer(), 41 : TiledLayer(),
62 client_(client), 42 client_(client),
63 can_use_lcd_text_last_frame_(can_use_lcd_text()) { 43 can_use_lcd_text_last_frame_(can_use_lcd_text()) {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 return picture; 154 return picture;
175 } 155 }
176 156
177 void ContentLayer::OnOutputSurfaceCreated() { 157 void ContentLayer::OnOutputSurfaceCreated() {
178 SetTextureFormat( 158 SetTextureFormat(
179 layer_tree_host()->GetRendererCapabilities().best_texture_format); 159 layer_tree_host()->GetRendererCapabilities().best_texture_format);
180 TiledLayer::OnOutputSurfaceCreated(); 160 TiledLayer::OnOutputSurfaceCreated();
181 } 161 }
182 162
183 } // namespace cc 163 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698