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

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

Issue 786583002: cc: Renaming Rasterizer and RasterWorkerPool interfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Update include files alphabetic orders. Created 6 years 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/resources/picture_pile_impl.h" 12 #include "cc/resources/picture_pile_impl.h"
13 #include "cc/resources/raster_worker_pool.h" 13 #include "cc/resources/tile_task_worker_pool.h"
14 #include "skia/ext/analysis_canvas.h" 14 #include "skia/ext/analysis_canvas.h"
15 15
16 namespace { 16 namespace {
17 // Layout pixel buffer around the visible layer rect to record. Any base 17 // Layout pixel buffer around the visible layer rect to record. Any base
18 // picture that intersects the visible layer rect expanded by this distance 18 // picture that intersects the visible layer rect expanded by this distance
19 // will be recorded. 19 // will be recorded.
20 const int kPixelDistanceToRecord = 8000; 20 const int kPixelDistanceToRecord = 8000;
21 // We don't perform solid color analysis on images that have more than 10 skia 21 // We don't perform solid color analysis on images that have more than 10 skia
22 // operations. 22 // operations.
23 const int kOpCountThatIsOkToAnalyze = 10; 23 const int kOpCountThatIsOkToAnalyze = 10;
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 for (const auto& record_rect : record_rects) { 538 for (const auto& record_rect : record_rects) {
539 gfx::Rect padded_record_rect = PadRect(record_rect); 539 gfx::Rect padded_record_rect = PadRect(record_rect);
540 540
541 int repeat_count = std::max(1, slow_down_raster_scale_factor_for_debug_); 541 int repeat_count = std::max(1, slow_down_raster_scale_factor_for_debug_);
542 scoped_refptr<Picture> picture; 542 scoped_refptr<Picture> picture;
543 543
544 // Note: Currently, gathering of pixel refs when using a single 544 // Note: Currently, gathering of pixel refs when using a single
545 // raster thread doesn't provide any benefit. This might change 545 // raster thread doesn't provide any benefit. This might change
546 // in the future but we avoid it for now to reduce the cost of 546 // in the future but we avoid it for now to reduce the cost of
547 // Picture::Create. 547 // Picture::Create.
548 bool gather_pixel_refs = RasterWorkerPool::GetNumRasterThreads() > 1; 548 bool gather_pixel_refs = TileTaskWorkerPool::GetNumWorkerThreads() > 1;
549 549
550 for (int i = 0; i < repeat_count; i++) { 550 for (int i = 0; i < repeat_count; i++) {
551 picture = Picture::Create(padded_record_rect, painter, tile_grid_info_, 551 picture = Picture::Create(padded_record_rect, painter, tile_grid_info_,
552 gather_pixel_refs, recording_mode); 552 gather_pixel_refs, recording_mode);
553 // Note the '&&' with previous is-suitable state. 553 // Note the '&&' with previous is-suitable state.
554 // This means that once a picture-pile becomes unsuitable for gpu 554 // This means that once a picture-pile becomes unsuitable for gpu
555 // rasterization due to some content, it will continue to be unsuitable 555 // rasterization due to some content, it will continue to be unsuitable
556 // even if that content is replaced by gpu-friendly content. 556 // even if that content is replaced by gpu-friendly content.
557 // This is an optimization to avoid iterating though all pictures in 557 // This is an optimization to avoid iterating though all pictures in
558 // the pile after each invalidation. 558 // the pile after each invalidation.
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 const Picture* PicturePile::PictureInfo::GetPicture() const { 771 const Picture* PicturePile::PictureInfo::GetPicture() const {
772 return picture_.get(); 772 return picture_.get();
773 } 773 }
774 774
775 float PicturePile::PictureInfo::GetInvalidationFrequency() const { 775 float PicturePile::PictureInfo::GetInvalidationFrequency() const {
776 return invalidation_history_.count() / 776 return invalidation_history_.count() /
777 static_cast<float>(INVALIDATION_FRAMES_TRACKED); 777 static_cast<float>(INVALIDATION_FRAMES_TRACKED);
778 } 778 }
779 779
780 } // namespace cc 780 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698