| OLD | NEW |
| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <limits> | 6 #include <limits> |
| 7 | 7 |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "cc/base/region.h" | 9 #include "cc/base/region.h" |
| 10 #include "cc/debug/benchmark_instrumentation.h" | |
| 11 #include "cc/debug/debug_colors.h" | 10 #include "cc/debug/debug_colors.h" |
| 12 #include "cc/resources/picture_pile_impl.h" | 11 #include "cc/resources/picture_pile_impl.h" |
| 13 #include "skia/ext/analysis_canvas.h" | 12 #include "skia/ext/analysis_canvas.h" |
| 14 #include "third_party/skia/include/core/SkCanvas.h" | 13 #include "third_party/skia/include/core/SkCanvas.h" |
| 15 #include "third_party/skia/include/core/SkSize.h" | 14 #include "third_party/skia/include/core/SkSize.h" |
| 16 #include "ui/gfx/rect_conversions.h" | 15 #include "ui/gfx/rect_conversions.h" |
| 17 #include "ui/gfx/size_conversions.h" | 16 #include "ui/gfx/size_conversions.h" |
| 18 #include "ui/gfx/skia_util.h" | 17 #include "ui/gfx/skia_util.h" |
| 19 | 18 |
| 20 namespace cc { | 19 namespace cc { |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 "Contents scale: " << contents_scale; | 193 "Contents scale: " << contents_scale; |
| 195 | 194 |
| 196 content_clip.Intersect(canvas_rect); | 195 content_clip.Intersect(canvas_rect); |
| 197 | 196 |
| 198 if (!unclipped.Intersects(content_clip)) | 197 if (!unclipped.Intersects(content_clip)) |
| 199 continue; | 198 continue; |
| 200 | 199 |
| 201 base::TimeDelta best_duration = | 200 base::TimeDelta best_duration = |
| 202 base::TimeDelta::FromInternalValue(std::numeric_limits<int64>::max()); | 201 base::TimeDelta::FromInternalValue(std::numeric_limits<int64>::max()); |
| 203 int repeat_count = std::max(1, slow_down_raster_scale_factor_for_debug_); | 202 int repeat_count = std::max(1, slow_down_raster_scale_factor_for_debug_); |
| 203 int rasterized_pixel_count = 0; |
| 204 | 204 |
| 205 TRACE_EVENT0(benchmark_instrumentation::kCategory, | |
| 206 benchmark_instrumentation::kRasterLoop); | |
| 207 for (int j = 0; j < repeat_count; ++j) { | 205 for (int j = 0; j < repeat_count; ++j) { |
| 208 base::TimeTicks start_time; | 206 base::TimeTicks start_time; |
| 209 if (rendering_stats_instrumentation) | 207 if (rendering_stats_instrumentation) |
| 210 start_time = rendering_stats_instrumentation->StartRecording(); | 208 start_time = rendering_stats_instrumentation->StartRecording(); |
| 211 (*i)->Raster(canvas, callback, content_clip, contents_scale); | 209 rasterized_pixel_count = |
| 210 (*i)->Raster(canvas, callback, content_clip, contents_scale); |
| 212 if (rendering_stats_instrumentation) { | 211 if (rendering_stats_instrumentation) { |
| 213 base::TimeDelta duration = | 212 base::TimeDelta duration = |
| 214 rendering_stats_instrumentation->EndRecording(start_time); | 213 rendering_stats_instrumentation->EndRecording(start_time); |
| 215 best_duration = std::min(best_duration, duration); | 214 best_duration = std::min(best_duration, duration); |
| 216 } | 215 } |
| 217 } | 216 } |
| 218 if (rendering_stats_instrumentation) { | 217 if (rendering_stats_instrumentation) { |
| 219 int64 rasterized_pixel_count = | |
| 220 repeat_count * content_clip.width() * content_clip.height(); | |
| 221 rendering_stats_instrumentation->AddRaster(best_duration, | 218 rendering_stats_instrumentation->AddRaster(best_duration, |
| 222 rasterized_pixel_count); | 219 rasterized_pixel_count); |
| 223 } | 220 } |
| 224 | 221 |
| 225 if (show_debug_picture_borders_) { | 222 if (show_debug_picture_borders_) { |
| 226 gfx::Rect border = gfx::ScaleToEnclosedRect( | 223 gfx::Rect border = gfx::ScaleToEnclosedRect( |
| 227 (*i)->LayerRect(), contents_scale); | 224 (*i)->LayerRect(), contents_scale); |
| 228 border.Inset(0, 0, 1, 1); | 225 border.Inset(0, 0, 1, 1); |
| 229 | 226 |
| 230 SkPaint picture_border_paint; | 227 SkPaint picture_border_paint; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 PictureList& picture_list = (*pli).second; | 377 PictureList& picture_list = (*pli).second; |
| 381 for (PictureList::iterator picture = picture_list.begin(); | 378 for (PictureList::iterator picture = picture_list.begin(); |
| 382 picture != picture_list.end(); | 379 picture != picture_list.end(); |
| 383 picture++) { | 380 picture++) { |
| 384 (*picture)->EmitTraceSnapshot(); | 381 (*picture)->EmitTraceSnapshot(); |
| 385 } | 382 } |
| 386 } | 383 } |
| 387 } | 384 } |
| 388 | 385 |
| 389 } // namespace cc | 386 } // namespace cc |
| OLD | NEW |