| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  101  |  101  | 
|  102   SkTileGridPicture::TileGridInfo tile_grid_info; |  102   SkTileGridPicture::TileGridInfo tile_grid_info; | 
|  103   PicturePileBase::ComputeTileGridInfo(tile_grid_size, &tile_grid_info); |  103   PicturePileBase::ComputeTileGridInfo(tile_grid_size, &tile_grid_info); | 
|  104  |  104  | 
|  105   gfx::Rect visible_content_rect = gfx::ScaleToEnclosingRect( |  105   gfx::Rect visible_content_rect = gfx::ScaleToEnclosingRect( | 
|  106       layer->visible_content_rect(), 1.f / layer->contents_scale_x()); |  106       layer->visible_content_rect(), 1.f / layer->contents_scale_x()); | 
|  107   if (visible_content_rect.IsEmpty()) |  107   if (visible_content_rect.IsEmpty()) | 
|  108     return; |  108     return; | 
|  109  |  109  | 
|  110  |  110  | 
|  111   base::TimeDelta min_time = base::TimeDelta::Max(); |  111   base::TimeDelta min_time = | 
 |  112       base::TimeDelta::FromInternalValue(std::numeric_limits<int64>::max()); | 
|  112   for (int i = 0; i < record_repeat_count_; ++i) { |  113   for (int i = 0; i < record_repeat_count_; ++i) { | 
|  113     base::TimeTicks start = Now(); |  114     base::TimeTicks start = Now(); | 
|  114     scoped_refptr<Picture> picture = Picture::Create( |  115     scoped_refptr<Picture> picture = Picture::Create( | 
|  115         visible_content_rect, painter, tile_grid_info, false, 0); |  116         visible_content_rect, painter, tile_grid_info, false, 0); | 
|  116     base::TimeTicks end = Now(); |  117     base::TimeTicks end = Now(); | 
|  117     base::TimeDelta duration = end - start; |  118     base::TimeDelta duration = end - start; | 
|  118     if (duration < min_time) |  119     if (duration < min_time) | 
|  119       min_time = duration; |  120       min_time = duration; | 
|  120   } |  121   } | 
|  121  |  122  | 
|  122   record_results_.pixels_recorded += |  123   record_results_.pixels_recorded += | 
|  123       visible_content_rect.width() * visible_content_rect.height(); |  124       visible_content_rect.width() * visible_content_rect.height(); | 
|  124   record_results_.total_best_time += min_time; |  125   record_results_.total_best_time += min_time; | 
|  125 } |  126 } | 
|  126  |  127  | 
|  127 RasterizeAndRecordBenchmark::RecordResults::RecordResults() |  128 RasterizeAndRecordBenchmark::RecordResults::RecordResults() | 
|  128     : pixels_recorded(0) {} |  129     : pixels_recorded(0) {} | 
|  129  |  130  | 
|  130 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} |  131 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} | 
|  131  |  132  | 
|  132 }  // namespace cc |  133 }  // namespace cc | 
| OLD | NEW |