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 "cc/resources/picture_pile.h" | 5 #include "cc/resources/picture_pile.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "cc/base/region.h" | 11 #include "cc/base/region.h" |
12 #include "cc/debug/rendering_stats_instrumentation.h" | 12 #include "cc/debug/rendering_stats_instrumentation.h" |
13 #include "cc/resources/picture_pile_impl.h" | 13 #include "cc/resources/picture_pile_impl.h" |
| 14 #include "cc/resources/raster_worker_pool.h" |
14 #include "cc/resources/tile_priority.h" | 15 #include "cc/resources/tile_priority.h" |
15 #include "cc/resources/worker_pool.h" | |
16 | 16 |
17 namespace { | 17 namespace { |
18 // Layout pixel buffer around the visible layer rect to record. Any base | 18 // Layout pixel buffer around the visible layer rect to record. Any base |
19 // picture that intersects the visible layer rect expanded by this distance | 19 // picture that intersects the visible layer rect expanded by this distance |
20 // will be recorded. | 20 // will be recorded. |
21 const int kPixelDistanceToRecord = 8000; | 21 const int kPixelDistanceToRecord = 8000; |
22 | 22 |
23 // TODO(humper): The density threshold here is somewhat arbitrary; need a | 23 // TODO(humper): The density threshold here is somewhat arbitrary; need a |
24 // way to set // this from the command line so we can write a benchmark | 24 // way to set // this from the command line so we can write a benchmark |
25 // script and find a sweet spot. | 25 // script and find a sweet spot. |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 std::numeric_limits<int64>::max()); | 225 std::numeric_limits<int64>::max()); |
226 for (int i = 0; i < repeat_count; i++) { | 226 for (int i = 0; i < repeat_count; i++) { |
227 base::TimeTicks start_time = stats_instrumentation->StartRecording(); | 227 base::TimeTicks start_time = stats_instrumentation->StartRecording(); |
228 picture->Record(painter, tile_grid_info_); | 228 picture->Record(painter, tile_grid_info_); |
229 base::TimeDelta duration = | 229 base::TimeDelta duration = |
230 stats_instrumentation->EndRecording(start_time); | 230 stats_instrumentation->EndRecording(start_time); |
231 best_duration = std::min(duration, best_duration); | 231 best_duration = std::min(duration, best_duration); |
232 } | 232 } |
233 int recorded_pixel_count = | 233 int recorded_pixel_count = |
234 picture->LayerRect().width() * picture->LayerRect().height(); | 234 picture->LayerRect().width() * picture->LayerRect().height(); |
235 int num_raster_threads = WorkerPool::GetNumRasterThreads(); | 235 int num_raster_threads = RasterWorkerPool::GetNumRasterThreads(); |
236 stats_instrumentation->AddRecord(best_duration, recorded_pixel_count); | 236 stats_instrumentation->AddRecord(best_duration, recorded_pixel_count); |
237 if (num_raster_threads > 1) | 237 if (num_raster_threads > 1) |
238 picture->GatherPixelRefs(tile_grid_info_); | 238 picture->GatherPixelRefs(tile_grid_info_); |
239 picture->CloneForDrawing(num_raster_threads); | 239 picture->CloneForDrawing(num_raster_threads); |
240 } | 240 } |
241 | 241 |
242 for (TilingData::Iterator it(&tiling_, record_rect); | 242 for (TilingData::Iterator it(&tiling_, record_rect); |
243 it; ++it) { | 243 it; ++it) { |
244 const PictureMapKey& key = it.index(); | 244 const PictureMapKey& key = it.index(); |
245 gfx::Rect tile = PaddedRect(key); | 245 gfx::Rect tile = PaddedRect(key); |
246 if (record_rect.Contains(tile)) { | 246 if (record_rect.Contains(tile)) { |
247 PictureInfo& info = picture_map_[key]; | 247 PictureInfo& info = picture_map_[key]; |
248 info.SetPicture(picture); | 248 info.SetPicture(picture); |
249 } | 249 } |
250 } | 250 } |
251 } | 251 } |
252 | 252 |
253 UpdateRecordedRegion(); | 253 UpdateRecordedRegion(); |
254 return true; | 254 return true; |
255 } | 255 } |
256 | 256 |
257 } // namespace cc | 257 } // namespace cc |
OLD | NEW |