| 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 #include <string> | 9 #include <string> | 
| 10 | 10 | 
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" | 
| 12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" | 
| 13 #include "base/values.h" | 13 #include "base/values.h" | 
| 14 #include "cc/debug/lap_timer.h" | 14 #include "cc/debug/lap_timer.h" | 
| 15 #include "cc/debug/rasterize_and_record_benchmark_impl.h" | 15 #include "cc/debug/rasterize_and_record_benchmark_impl.h" | 
| 16 #include "cc/layers/layer.h" | 16 #include "cc/layers/layer.h" | 
| 17 #include "cc/layers/picture_layer.h" | 17 #include "cc/layers/picture_layer.h" | 
|  | 18 #include "cc/resources/picture_pile.h" | 
| 18 #include "cc/trees/layer_tree_host.h" | 19 #include "cc/trees/layer_tree_host.h" | 
| 19 #include "cc/trees/layer_tree_host_common.h" | 20 #include "cc/trees/layer_tree_host_common.h" | 
| 20 #include "ui/gfx/geometry/rect.h" | 21 #include "ui/gfx/geometry/rect.h" | 
| 21 | 22 | 
| 22 namespace cc { | 23 namespace cc { | 
| 23 | 24 | 
| 24 namespace { | 25 namespace { | 
| 25 | 26 | 
| 26 const int kDefaultRecordRepeatCount = 100; | 27 const int kDefaultRecordRepeatCount = 100; | 
| 27 | 28 | 
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 99 } | 100 } | 
| 100 | 101 | 
| 101 void RasterizeAndRecordBenchmark::RunOnLayer(PictureLayer* layer) { | 102 void RasterizeAndRecordBenchmark::RunOnLayer(PictureLayer* layer) { | 
| 102   ContentLayerClient* painter = layer->client(); | 103   ContentLayerClient* painter = layer->client(); | 
| 103   gfx::Size content_bounds = layer->content_bounds(); | 104   gfx::Size content_bounds = layer->content_bounds(); | 
| 104 | 105 | 
| 105   DCHECK(host_); | 106   DCHECK(host_); | 
| 106   gfx::Size tile_grid_size = host_->settings().default_tile_size; | 107   gfx::Size tile_grid_size = host_->settings().default_tile_size; | 
| 107 | 108 | 
| 108   SkTileGridFactory::TileGridInfo tile_grid_info; | 109   SkTileGridFactory::TileGridInfo tile_grid_info; | 
| 109   PicturePileBase::ComputeTileGridInfo(tile_grid_size, &tile_grid_info); | 110   PicturePile::ComputeTileGridInfo(tile_grid_size, &tile_grid_info); | 
| 110 | 111 | 
| 111   gfx::Rect visible_content_rect = gfx::ScaleToEnclosingRect( | 112   gfx::Rect visible_content_rect = gfx::ScaleToEnclosingRect( | 
| 112       layer->visible_content_rect(), 1.f / layer->contents_scale_x()); | 113       layer->visible_content_rect(), 1.f / layer->contents_scale_x()); | 
| 113   if (visible_content_rect.IsEmpty()) | 114   if (visible_content_rect.IsEmpty()) | 
| 114     return; | 115     return; | 
| 115 | 116 | 
| 116   for (int mode_index = 0; mode_index < Picture::RECORDING_MODE_COUNT; | 117   for (int mode_index = 0; mode_index < Picture::RECORDING_MODE_COUNT; | 
| 117        mode_index++) { | 118        mode_index++) { | 
| 118     Picture::RecordingMode mode = | 119     Picture::RecordingMode mode = | 
| 119         static_cast<Picture::RecordingMode>(mode_index); | 120         static_cast<Picture::RecordingMode>(mode_index); | 
| (...skipping 28 matching lines...) Expand all  Loading... | 
| 148     record_results_.total_best_time[mode_index] += min_time; | 149     record_results_.total_best_time[mode_index] += min_time; | 
| 149   } | 150   } | 
| 150 } | 151 } | 
| 151 | 152 | 
| 152 RasterizeAndRecordBenchmark::RecordResults::RecordResults() | 153 RasterizeAndRecordBenchmark::RecordResults::RecordResults() | 
| 153     : pixels_recorded(0) {} | 154     : pixels_recorded(0) {} | 
| 154 | 155 | 
| 155 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} | 156 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} | 
| 156 | 157 | 
| 157 }  // namespace cc | 158 }  // namespace cc | 
| OLD | NEW | 
|---|