Index: cc/playback/display_item_list.cc |
diff --git a/cc/playback/display_item_list.cc b/cc/playback/display_item_list.cc |
index edc67c00e6da71eb53a47b231f16be8a429b5950..88f4909200560b27be6a1b1e940b2de94b4cc82f 100644 |
--- a/cc/playback/display_item_list.cc |
+++ b/cc/playback/display_item_list.cc |
@@ -55,7 +55,7 @@ DisplayItemList::DisplayItemList(gfx::Rect layer_rect, |
use_cached_picture_(settings.use_cached_picture), |
retain_individual_display_items_(retain_individual_display_items), |
layer_rect_(layer_rect), |
- all_items_are_suitable_for_gpu_rasterization_(true), |
+ is_suitable_for_gpu_rasterization_(true), |
approximate_op_count_(0), |
picture_memory_usage_(0), |
external_memory_usage_(0) { |
@@ -123,13 +123,19 @@ void DisplayItemList::ProcessAppendedItems() { |
needs_process_ = false; |
#endif |
for (const DisplayItem* item : items_) { |
- all_items_are_suitable_for_gpu_rasterization_ &= |
- item->is_suitable_for_gpu_rasterization(); |
- approximate_op_count_ += item->approximate_op_count(); |
- |
if (use_cached_picture_) { |
+ // When using a cached picture we will calculate gpu suitability on the |
+ // entire cached picture instead of the items. This is more permissive |
+ // since none of the items might individually trigger a veto even though |
+ // they collectively have enough "bad" operations that a corresponding |
+ // Picture would get vetoed. See crbug.com/513016. |
DCHECK(canvas_); |
- item->Raster(canvas_.get(), gfx::Rect(), NULL); |
+ approximate_op_count_ += item->approximate_op_count(); |
+ item->Raster(canvas_.get(), gfx::Rect(), nullptr); |
+ } else { |
+ is_suitable_for_gpu_rasterization_ &= |
+ item->is_suitable_for_gpu_rasterization(); |
+ approximate_op_count_ += item->approximate_op_count(); |
} |
if (retain_individual_display_items_) { |
@@ -146,11 +152,9 @@ void DisplayItemList::ProcessAppendedItems() { |
void DisplayItemList::RasterIntoCanvas(const DisplayItem& item) { |
DCHECK(canvas_); |
DCHECK(!retain_individual_display_items_); |
- all_items_are_suitable_for_gpu_rasterization_ &= |
- item.is_suitable_for_gpu_rasterization(); |
approximate_op_count_ += item.approximate_op_count(); |
- item.Raster(canvas_.get(), gfx::Rect(), NULL); |
+ item.Raster(canvas_.get(), gfx::Rect(), nullptr); |
} |
bool DisplayItemList::RetainsIndividualDisplayItems() const { |
@@ -179,19 +183,14 @@ void DisplayItemList::Finalize() { |
SkPictureUtils::ApproximateBytesUsed(picture_.get()); |
recorder_.reset(); |
canvas_.clear(); |
+ is_suitable_for_gpu_rasterization_ = |
+ picture_->suitableForGpuRasterization(nullptr); |
} |
} |
bool DisplayItemList::IsSuitableForGpuRasterization() const { |
DCHECK(ProcessAppendedItemsCalled()); |
- if (use_cached_picture_) |
- return picture_->suitableForGpuRasterization(NULL); |
- |
- // This is more permissive than Picture's implementation, since none of the |
- // items might individually trigger a veto even though they collectively have |
- // enough "bad" operations that a corresponding Picture would get vetoed. See |
- // crbug.com/513016. |
- return all_items_are_suitable_for_gpu_rasterization_; |
+ return is_suitable_for_gpu_rasterization_; |
} |
int DisplayItemList::ApproximateOpCount() const { |