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