Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: cc/resources/picture_pile.cc

Issue 73923003: Shared Raster Worker Threads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: WIP - make API to retrieve number of raster threads consistent + nits Created 6 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
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"
14 #include "cc/resources/tile_priority.h" 15 #include "cc/resources/tile_priority.h"
15 16
16 namespace { 17 namespace {
17 // 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
18 // picture that intersects the visible layer rect expanded by this distance 19 // picture that intersects the visible layer rect expanded by this distance
19 // will be recorded. 20 // will be recorded.
20 const int kPixelDistanceToRecord = 8000; 21 const int kPixelDistanceToRecord = 8000;
21 22
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 picture->Record(painter, tile_grid_info_); 228 picture->Record(painter, tile_grid_info_);
228 base::TimeDelta duration = 229 base::TimeDelta duration =
229 stats_instrumentation->EndRecording(start_time); 230 stats_instrumentation->EndRecording(start_time);
230 best_duration = std::min(duration, best_duration); 231 best_duration = std::min(duration, best_duration);
231 } 232 }
232 int recorded_pixel_count = 233 int recorded_pixel_count =
233 picture->LayerRect().width() * picture->LayerRect().height(); 234 picture->LayerRect().width() * picture->LayerRect().height();
234 stats_instrumentation->AddRecord(best_duration, recorded_pixel_count); 235 stats_instrumentation->AddRecord(best_duration, recorded_pixel_count);
235 if (num_raster_threads_ > 1) 236 if (num_raster_threads_ > 1)
236 picture->GatherPixelRefs(tile_grid_info_); 237 picture->GatherPixelRefs(tile_grid_info_);
237 picture->CloneForDrawing(num_raster_threads_); 238 picture->CloneForDrawing(switches::GetNumRasterThreads());
reveman 2013/12/27 14:57:13 please remove |num_raster_threads_| and set_num_ra
sohanjg 2013/12/28 09:15:17 Done.
238 } 239 }
239 240
240 for (TilingData::Iterator it(&tiling_, record_rect); 241 for (TilingData::Iterator it(&tiling_, record_rect);
241 it; ++it) { 242 it; ++it) {
242 const PictureMapKey& key = it.index(); 243 const PictureMapKey& key = it.index();
243 gfx::Rect tile = PaddedRect(key); 244 gfx::Rect tile = PaddedRect(key);
244 if (record_rect.Contains(tile)) { 245 if (record_rect.Contains(tile)) {
245 PictureInfo& info = picture_map_[key]; 246 PictureInfo& info = picture_map_[key];
246 info.SetPicture(picture); 247 info.SetPicture(picture);
247 } 248 }
248 } 249 }
249 } 250 }
250 251
251 UpdateRecordedRegion(); 252 UpdateRecordedRegion();
252 return true; 253 return true;
253 } 254 }
254 255
255 } // namespace cc 256 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698