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

Side by Side Diff: cc/resources/picture.cc

Issue 12426024: cc: Switch RenderingStats collection in Layer::Update() to RenderingStatsInstrumentation (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to 190965 Created 7 years, 8 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 | « cc/resources/picture.h ('k') | cc/resources/picture_pile.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 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "base/debug/trace_event.h" 5 #include "base/debug/trace_event.h"
6 #include "cc/debug/rendering_stats.h" 6 #include "cc/debug/rendering_stats_instrumentation.h"
7 #include "cc/layers/content_layer_client.h" 7 #include "cc/layers/content_layer_client.h"
8 #include "cc/resources/picture.h" 8 #include "cc/resources/picture.h"
9 #include "skia/ext/analysis_canvas.h" 9 #include "skia/ext/analysis_canvas.h"
10 #include "third_party/skia/include/core/SkCanvas.h" 10 #include "third_party/skia/include/core/SkCanvas.h"
11 #include "third_party/skia/include/core/SkData.h" 11 #include "third_party/skia/include/core/SkData.h"
12 #include "third_party/skia/include/core/SkDrawFilter.h" 12 #include "third_party/skia/include/core/SkDrawFilter.h"
13 #include "third_party/skia/include/core/SkPaint.h" 13 #include "third_party/skia/include/core/SkPaint.h"
14 #include "third_party/skia/include/utils/SkPictureUtils.h" 14 #include "third_party/skia/include/utils/SkPictureUtils.h"
15 #include "ui/gfx/rect_conversions.h" 15 #include "ui/gfx/rect_conversions.h"
16 #include "ui/gfx/skia_util.h" 16 #include "ui/gfx/skia_util.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 for (int i = 0; i < num_threads; i++) { 72 for (int i = 0; i < num_threads; i++) {
73 scoped_refptr<Picture> clone = make_scoped_refptr( 73 scoped_refptr<Picture> clone = make_scoped_refptr(
74 new Picture(skia::AdoptRef(new SkPicture(clones[i])), 74 new Picture(skia::AdoptRef(new SkPicture(clones[i])),
75 layer_rect_, 75 layer_rect_,
76 opaque_rect_)); 76 opaque_rect_));
77 clones_.push_back(clone); 77 clones_.push_back(clone);
78 } 78 }
79 } 79 }
80 80
81 void Picture::Record(ContentLayerClient* painter, 81 void Picture::Record(ContentLayerClient* painter,
82 RenderingStats* stats, 82 RenderingStatsInstrumentation* stats_instrumentation,
83 const SkTileGridPicture::TileGridInfo& tile_grid_info) { 83 const SkTileGridPicture::TileGridInfo& tile_grid_info) {
84 TRACE_EVENT2("cc", "Picture::Record", 84 TRACE_EVENT2("cc", "Picture::Record",
85 "width", layer_rect_.width(), "height", layer_rect_.height()); 85 "width", layer_rect_.width(), "height", layer_rect_.height());
86 86
87 // Record() should only be called once. 87 // Record() should only be called once.
88 DCHECK(!picture_); 88 DCHECK(!picture_);
89 DCHECK(!tile_grid_info.fTileInterval.isEmpty()); 89 DCHECK(!tile_grid_info.fTileInterval.isEmpty());
90 picture_ = skia::AdoptRef(new SkTileGridPicture( 90 picture_ = skia::AdoptRef(new SkTileGridPicture(
91 layer_rect_.width(), layer_rect_.height(), tile_grid_info)); 91 layer_rect_.width(), layer_rect_.height(), tile_grid_info));
92 92
(...skipping 11 matching lines...) Expand all
104 paint.setAntiAlias(false); 104 paint.setAntiAlias(false);
105 paint.setXfermodeMode(SkXfermode::kClear_Mode); 105 paint.setXfermodeMode(SkXfermode::kClear_Mode);
106 SkRect layer_skrect = SkRect::MakeXYWH(layer_rect_.x(), 106 SkRect layer_skrect = SkRect::MakeXYWH(layer_rect_.x(),
107 layer_rect_.y(), 107 layer_rect_.y(),
108 layer_rect_.width(), 108 layer_rect_.width(),
109 layer_rect_.height()); 109 layer_rect_.height());
110 canvas->clipRect(layer_skrect); 110 canvas->clipRect(layer_skrect);
111 canvas->drawRect(layer_skrect, paint); 111 canvas->drawRect(layer_skrect, paint);
112 112
113 gfx::RectF opaque_layer_rect; 113 gfx::RectF opaque_layer_rect;
114 base::TimeTicks begin_paint_time; 114 base::TimeTicks start_time = stats_instrumentation->StartRecording();
115 if (stats) 115
116 begin_paint_time = base::TimeTicks::Now();
117 painter->PaintContents(canvas, layer_rect_, &opaque_layer_rect); 116 painter->PaintContents(canvas, layer_rect_, &opaque_layer_rect);
118 if (stats) { 117
119 stats->total_paint_time += base::TimeTicks::Now() - begin_paint_time; 118 base::TimeDelta duration = stats_instrumentation->EndRecording(start_time);
120 stats->total_pixels_painted += 119 stats_instrumentation->AddPaint(duration,
121 layer_rect_.width() * layer_rect_.height(); 120 layer_rect_.width() * layer_rect_.height());
122 }
123 121
124 canvas->restore(); 122 canvas->restore();
125 picture_->endRecording(); 123 picture_->endRecording();
126 124
127 opaque_rect_ = gfx::ToEnclosedRect(opaque_layer_rect); 125 opaque_rect_ = gfx::ToEnclosedRect(opaque_layer_rect);
128 } 126 }
129 127
130 void Picture::Raster( 128 void Picture::Raster(
131 SkCanvas* canvas, 129 SkCanvas* canvas,
132 gfx::Rect content_rect, 130 gfx::Rect content_rect,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 if (*refs && (*refs)->getURI() && !strncmp( 170 if (*refs && (*refs)->getURI() && !strncmp(
173 (*refs)->getURI(), kLabelLazyDecoded, 4)) { 171 (*refs)->getURI(), kLabelLazyDecoded, 4)) {
174 pixel_ref_list.push_back(static_cast<skia::LazyPixelRef*>(*refs)); 172 pixel_ref_list.push_back(static_cast<skia::LazyPixelRef*>(*refs));
175 } 173 }
176 refs++; 174 refs++;
177 } 175 }
178 pixel_refs->unref(); 176 pixel_refs->unref();
179 } 177 }
180 178
181 } // namespace cc 179 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture.h ('k') | cc/resources/picture_pile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698