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

Side by Side Diff: cc/layers/picture_layer_impl.cc

Issue 874613003: cc: Stop pushing properties every activation for picture layers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <set> 10 #include <set>
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 DCHECK_IMPLIES(raster_source_->IsSolidColor(), 136 DCHECK_IMPLIES(raster_source_->IsSolidColor(),
137 layer_impl->tilings_->num_tilings() == 0); 137 layer_impl->tilings_->num_tilings() == 0);
138 138
139 layer_impl->raster_page_scale_ = raster_page_scale_; 139 layer_impl->raster_page_scale_ = raster_page_scale_;
140 layer_impl->raster_device_scale_ = raster_device_scale_; 140 layer_impl->raster_device_scale_ = raster_device_scale_;
141 layer_impl->raster_source_scale_ = raster_source_scale_; 141 layer_impl->raster_source_scale_ = raster_source_scale_;
142 layer_impl->raster_contents_scale_ = raster_contents_scale_; 142 layer_impl->raster_contents_scale_ = raster_contents_scale_;
143 layer_impl->low_res_raster_contents_scale_ = low_res_raster_contents_scale_; 143 layer_impl->low_res_raster_contents_scale_ = low_res_raster_contents_scale_;
144 144
145 layer_impl->SanityCheckTilingState(); 145 layer_impl->SanityCheckTilingState();
146
147 // We always need to push properties.
148 // See http://crbug.com/303943
149 // TODO(danakj): Stop always pushing properties since we don't swap tilings.
150 needs_push_properties_ = true;
151 } 146 }
152 147
153 void PictureLayerImpl::AppendQuads(RenderPass* render_pass, 148 void PictureLayerImpl::AppendQuads(RenderPass* render_pass,
154 const Occlusion& occlusion_in_content_space, 149 const Occlusion& occlusion_in_content_space,
155 AppendQuadsData* append_quads_data) { 150 AppendQuadsData* append_quads_data) {
156 // The bounds and the pile size may differ if the pile wasn't updated (ie. 151 // The bounds and the pile size may differ if the pile wasn't updated (ie.
157 // PictureLayer::Update didn't happen). In that case the pile will be empty. 152 // PictureLayer::Update didn't happen). In that case the pile will be empty.
158 DCHECK_IMPLIES(!raster_source_->GetSize().IsEmpty(), 153 DCHECK_IMPLIES(!raster_source_->GetSize().IsEmpty(),
159 bounds() == raster_source_->GetSize()) 154 bounds() == raster_source_->GetSize())
160 << " bounds " << bounds().ToString() << " pile " 155 << " bounds " << bounds().ToString() << " pile "
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 RemoveAllTilings(); 561 RemoveAllTilings();
567 return; 562 return;
568 } 563 }
569 564
570 // We could do this after doing UpdateTiles, which would avoid doing this for 565 // We could do this after doing UpdateTiles, which would avoid doing this for
571 // tilings that are going to disappear on the pending tree (if scale changed). 566 // tilings that are going to disappear on the pending tree (if scale changed).
572 // But that would also be more complicated, so we just do it here for now. 567 // But that would also be more complicated, so we just do it here for now.
573 tilings_->UpdateTilingsToCurrentRasterSource( 568 tilings_->UpdateTilingsToCurrentRasterSource(
574 raster_source_, pending_set, invalidation_, MinimumContentsScale(), 569 raster_source_, pending_set, invalidation_, MinimumContentsScale(),
575 MaximumContentsScale()); 570 MaximumContentsScale());
571
572 // SetNeedsPushProperties when changing the tiling set or raster source. These
573 // shouldn't imply damage but need to be synced.
574 SetNeedsPushProperties();
vmpstr 2015/01/23 20:57:57 Should this be invoked using PLTS UpdateTilingsToC
danakj 2015/01/23 21:11:36 Only if it added a new tiling to the set.
576 } 575 }
577 576
578 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { 577 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) {
579 if (layer_tree_impl()->IsActiveTree()) { 578 if (layer_tree_impl()->IsActiveTree()) {
580 gfx::RectF layer_damage_rect = 579 gfx::RectF layer_damage_rect =
581 gfx::ScaleRect(tile->content_rect(), 1.f / tile->contents_scale()); 580 gfx::ScaleRect(tile->content_rect(), 1.f / tile->contents_scale());
582 AddDamageRect(layer_damage_rect); 581 AddDamageRect(layer_damage_rect);
583 } 582 }
584 } 583 }
585 584
586 void PictureLayerImpl::DidBeginTracing() { 585 void PictureLayerImpl::DidBeginTracing() {
587 raster_source_->DidBeginTracing(); 586 raster_source_->DidBeginTracing();
588 } 587 }
589 588
590 void PictureLayerImpl::ReleaseResources() { 589 void PictureLayerImpl::ReleaseResources() {
591 // Recreate tilings with new settings, since some of those might change when 590 // Recreate tilings with new settings, since some of those might change when
592 // we release resources. If tilings_ is null, then leave it as null. 591 // we release resources. If tilings_ is null, then leave it as null.
593 if (tilings_) 592 if (tilings_)
594 tilings_ = CreatePictureLayerTilingSet(); 593 tilings_ = CreatePictureLayerTilingSet();
595 ResetRasterScale(); 594 ResetRasterScale();
596 595
597 // To avoid an edge case after lost context where the tree is up to date but 596 // To avoid an edge case after lost context where the tree is up to date but
598 // the tilings have not been managed, request an update draw properties 597 // the tilings have not been managed, request an update draw properties
599 // to force tilings to get managed. 598 // to force tilings to get managed.
600 layer_tree_impl()->set_needs_update_draw_properties(); 599 layer_tree_impl()->set_needs_update_draw_properties();
600
601 // SetNeedsPushProperties when changing the tiling set or raster source. These
602 // shouldn't imply damage but need to be synced.
603 SetNeedsPushProperties();
vmpstr 2015/01/23 20:57:58 Should this be invoked via PLTS constructor? Or is
danakj 2015/01/23 21:11:36 The constructor doesn't add any tilings, and the d
601 } 604 }
602 605
603 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { 606 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() {
604 return raster_source_->GetFlattenedPicture(); 607 return raster_source_->GetFlattenedPicture();
605 } 608 }
606 609
607 scoped_refptr<Tile> PictureLayerImpl::CreateTile( 610 scoped_refptr<Tile> PictureLayerImpl::CreateTile(
608 float contents_scale, 611 float contents_scale,
609 const gfx::Rect& content_rect) { 612 const gfx::Rect& content_rect) {
610 int flags = 0; 613 int flags = 0;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 TilePriority::PriorityBin PictureLayerImpl::GetMaxTilePriorityBin() const { 652 TilePriority::PriorityBin PictureLayerImpl::GetMaxTilePriorityBin() const {
650 if (!HasValidTilePriorities()) 653 if (!HasValidTilePriorities())
651 return TilePriority::EVENTUALLY; 654 return TilePriority::EVENTUALLY;
652 return TilePriority::NOW; 655 return TilePriority::NOW;
653 } 656 }
654 657
655 bool PictureLayerImpl::RequiresHighResToDraw() const { 658 bool PictureLayerImpl::RequiresHighResToDraw() const {
656 return layer_tree_impl()->RequiresHighResToDraw(); 659 return layer_tree_impl()->RequiresHighResToDraw();
657 } 660 }
658 661
662 void PictureLayerImpl::TilingSetChanged() {
663 // SetNeedsPushProperties when changing the tiling set or raster source. These
664 // shouldn't imply damage but need to be synced.
665 SetNeedsPushProperties();
666 }
667
659 gfx::Size PictureLayerImpl::CalculateTileSize( 668 gfx::Size PictureLayerImpl::CalculateTileSize(
660 const gfx::Size& content_bounds) const { 669 const gfx::Size& content_bounds) const {
661 int max_texture_size = 670 int max_texture_size =
662 layer_tree_impl()->resource_provider()->max_texture_size(); 671 layer_tree_impl()->resource_provider()->max_texture_size();
663 672
664 if (is_mask_) { 673 if (is_mask_) {
665 // Masks are not tiled, so if we can't cover the whole mask with one tile, 674 // Masks are not tiled, so if we can't cover the whole mask with one tile,
666 // we shouldn't have such a tiling at all. 675 // we shouldn't have such a tiling at all.
667 DCHECK_LE(content_bounds.width(), max_texture_size); 676 DCHECK_LE(content_bounds.width(), max_texture_size);
668 DCHECK_LE(content_bounds.height(), max_texture_size); 677 DCHECK_LE(content_bounds.height(), max_texture_size);
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 1295
1287 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { 1296 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const {
1288 if (!layer_tree_impl()->IsActiveTree()) 1297 if (!layer_tree_impl()->IsActiveTree())
1289 return true; 1298 return true;
1290 1299
1291 return AllTilesRequiredAreReadyToDraw( 1300 return AllTilesRequiredAreReadyToDraw(
1292 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); 1301 &PictureLayerTiling::IsTileRequiredForDrawIfVisible);
1293 } 1302 }
1294 1303
1295 } // namespace cc 1304 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698