| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/debug/rasterize_and_record_benchmark.h" | 5 #include "cc/debug/rasterize_and_record_benchmark.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 SkTileGridPicture::TileGridInfo tile_grid_info; | 111 SkTileGridPicture::TileGridInfo tile_grid_info; |
| 112 PicturePileBase::ComputeTileGridInfo(tile_grid_size, &tile_grid_info); | 112 PicturePileBase::ComputeTileGridInfo(tile_grid_size, &tile_grid_info); |
| 113 | 113 |
| 114 gfx::Rect visible_content_rect = gfx::ScaleToEnclosingRect( | 114 gfx::Rect visible_content_rect = gfx::ScaleToEnclosingRect( |
| 115 layer->visible_content_rect(), 1.f / layer->contents_scale_x()); | 115 layer->visible_content_rect(), 1.f / layer->contents_scale_x()); |
| 116 if (visible_content_rect.IsEmpty()) | 116 if (visible_content_rect.IsEmpty()) |
| 117 return; | 117 return; |
| 118 | 118 |
| 119 | 119 |
| 120 base::TimeDelta min_time = | 120 base::TimeDelta min_time = base::TimeDelta::Max(); |
| 121 base::TimeDelta::FromInternalValue(std::numeric_limits<int64>::max()); | |
| 122 for (int i = 0; i < record_repeat_count_; ++i) { | 121 for (int i = 0; i < record_repeat_count_; ++i) { |
| 123 base::TimeTicks start = Now(); | 122 base::TimeTicks start = Now(); |
| 124 scoped_refptr<Picture> picture = Picture::Create( | 123 scoped_refptr<Picture> picture = Picture::Create( |
| 125 visible_content_rect, painter, tile_grid_info, false, 0); | 124 visible_content_rect, painter, tile_grid_info, false, 0); |
| 126 base::TimeTicks end = Now(); | 125 base::TimeTicks end = Now(); |
| 127 base::TimeDelta duration = end - start; | 126 base::TimeDelta duration = end - start; |
| 128 if (duration < min_time) | 127 if (duration < min_time) |
| 129 min_time = duration; | 128 min_time = duration; |
| 130 } | 129 } |
| 131 | 130 |
| 132 record_results_.pixels_recorded += | 131 record_results_.pixels_recorded += |
| 133 visible_content_rect.width() * visible_content_rect.height(); | 132 visible_content_rect.width() * visible_content_rect.height(); |
| 134 record_results_.total_best_time += min_time; | 133 record_results_.total_best_time += min_time; |
| 135 } | 134 } |
| 136 | 135 |
| 137 RasterizeAndRecordBenchmark::RecordResults::RecordResults() | 136 RasterizeAndRecordBenchmark::RecordResults::RecordResults() |
| 138 : pixels_recorded(0) {} | 137 : pixels_recorded(0) {} |
| 139 | 138 |
| 140 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} | 139 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} |
| 141 | 140 |
| 142 } // namespace cc | 141 } // namespace cc |
| OLD | NEW |