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

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

Issue 775483002: cc: Remove max tiles and skewport constants from tiling client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 10
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 LayerImpl::DidBecomeActive(); 593 LayerImpl::DidBecomeActive();
594 // TODO(vmpstr): See if this can be removed in favour of calling it from LTHI 594 // TODO(vmpstr): See if this can be removed in favour of calling it from LTHI
595 layer_tree_impl()->DidModifyTilePriorities(); 595 layer_tree_impl()->DidModifyTilePriorities();
596 } 596 }
597 597
598 void PictureLayerImpl::DidBeginTracing() { 598 void PictureLayerImpl::DidBeginTracing() {
599 raster_source_->DidBeginTracing(); 599 raster_source_->DidBeginTracing();
600 } 600 }
601 601
602 void PictureLayerImpl::ReleaseResources() { 602 void PictureLayerImpl::ReleaseResources() {
603 // Recreate tilings with new settings, since some of those might change when
604 // we release resources. If tilings_ is null, then leave it as null.
603 if (tilings_) 605 if (tilings_)
604 RemoveAllTilings(); 606 tilings_ = CreatePictureLayerTilingSet();
605
606 ResetRasterScale(); 607 ResetRasterScale();
607 608
608 // To avoid an edge case after lost context where the tree is up to date but 609 // To avoid an edge case after lost context where the tree is up to date but
609 // the tilings have not been managed, request an update draw properties 610 // the tilings have not been managed, request an update draw properties
610 // to force tilings to get managed. 611 // to force tilings to get managed.
611 layer_tree_impl()->set_needs_update_draw_properties(); 612 layer_tree_impl()->set_needs_update_draw_properties();
612 } 613 }
613 614
614 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { 615 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() {
615 return raster_source_->GetFlattenedPicture(); 616 return raster_source_->GetFlattenedPicture();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 return nullptr; 666 return nullptr;
666 return recycled_twin->tilings_->FindTilingWithScale(tiling->contents_scale()); 667 return recycled_twin->tilings_->FindTilingWithScale(tiling->contents_scale());
667 } 668 }
668 669
669 TilePriority::PriorityBin PictureLayerImpl::GetMaxTilePriorityBin() const { 670 TilePriority::PriorityBin PictureLayerImpl::GetMaxTilePriorityBin() const {
670 if (!HasValidTilePriorities()) 671 if (!HasValidTilePriorities())
671 return TilePriority::EVENTUALLY; 672 return TilePriority::EVENTUALLY;
672 return TilePriority::NOW; 673 return TilePriority::NOW;
673 } 674 }
674 675
675 size_t PictureLayerImpl::GetMaxTilesForInterestArea() const {
676 return layer_tree_impl()->settings().max_tiles_for_interest_area;
677 }
678
679 float PictureLayerImpl::GetSkewportTargetTimeInSeconds() const {
680 return layer_tree_impl()->use_gpu_rasterization()
681 ? 0.f
682 : layer_tree_impl()->settings().skewport_target_time_in_seconds;
683 }
684
685 int PictureLayerImpl::GetSkewportExtrapolationLimitInContentPixels() const {
686 return layer_tree_impl()
687 ->settings()
688 .skewport_extrapolation_limit_in_content_pixels;
689 }
690
691 bool PictureLayerImpl::RequiresHighResToDraw() const { 676 bool PictureLayerImpl::RequiresHighResToDraw() const {
692 return layer_tree_impl()->RequiresHighResToDraw(); 677 return layer_tree_impl()->RequiresHighResToDraw();
693 } 678 }
694 679
695 gfx::Size PictureLayerImpl::CalculateTileSize( 680 gfx::Size PictureLayerImpl::CalculateTileSize(
696 const gfx::Size& content_bounds) const { 681 const gfx::Size& content_bounds) const {
697 int max_texture_size = 682 int max_texture_size =
698 layer_tree_impl()->resource_provider()->max_texture_size(); 683 layer_tree_impl()->resource_provider()->max_texture_size();
699 684
700 if (is_mask_) { 685 if (is_mask_) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 841
857 *resource_id = draw_info.get_resource_id(); 842 *resource_id = draw_info.get_resource_id();
858 *resource_size = iter.texture_size(); 843 *resource_size = iter.texture_size();
859 } 844 }
860 845
861 void PictureLayerImpl::DoPostCommitInitialization() { 846 void PictureLayerImpl::DoPostCommitInitialization() {
862 DCHECK(needs_post_commit_initialization_); 847 DCHECK(needs_post_commit_initialization_);
863 DCHECK(layer_tree_impl()->IsPendingTree()); 848 DCHECK(layer_tree_impl()->IsPendingTree());
864 849
865 if (!tilings_) 850 if (!tilings_)
866 tilings_ = PictureLayerTilingSet::Create(this); 851 tilings_ = CreatePictureLayerTilingSet();
867 852
868 PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer(); 853 PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer();
869 if (twin_layer) { 854 if (twin_layer) {
870 // If the twin has never been pushed to, do not sync from it. 855 // If the twin has never been pushed to, do not sync from it.
871 // This can happen if this function is called during activation. 856 // This can happen if this function is called during activation.
872 if (!twin_layer->needs_post_commit_initialization_) 857 if (!twin_layer->needs_post_commit_initialization_)
873 SyncFromActiveLayer(twin_layer); 858 SyncFromActiveLayer(twin_layer);
874 } 859 }
875 860
876 needs_post_commit_initialization_ = false; 861 needs_post_commit_initialization_ = false;
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 1178
1194 bool PictureLayerImpl::ShouldAdjustRasterScaleDuringScaleAnimations() const { 1179 bool PictureLayerImpl::ShouldAdjustRasterScaleDuringScaleAnimations() const {
1195 return layer_tree_impl()->use_gpu_rasterization(); 1180 return layer_tree_impl()->use_gpu_rasterization();
1196 } 1181 }
1197 1182
1198 float PictureLayerImpl::MaximumTilingContentsScale() const { 1183 float PictureLayerImpl::MaximumTilingContentsScale() const {
1199 float max_contents_scale = tilings_->GetMaximumContentsScale(); 1184 float max_contents_scale = tilings_->GetMaximumContentsScale();
1200 return std::max(max_contents_scale, MinimumContentsScale()); 1185 return std::max(max_contents_scale, MinimumContentsScale());
1201 } 1186 }
1202 1187
1188 scoped_ptr<PictureLayerTilingSet>
1189 PictureLayerImpl::CreatePictureLayerTilingSet() {
1190 const LayerTreeSettings& settings = layer_tree_impl()->settings();
1191 return PictureLayerTilingSet::Create(
1192 this, settings.max_tiles_for_interest_area,
1193 layer_tree_impl()->use_gpu_rasterization()
1194 ? 0.f
1195 : settings.skewport_target_time_in_seconds,
1196 settings.skewport_extrapolation_limit_in_content_pixels);
1197 }
1198
1203 void PictureLayerImpl::UpdateIdealScales() { 1199 void PictureLayerImpl::UpdateIdealScales() {
1204 DCHECK(CanHaveTilings()); 1200 DCHECK(CanHaveTilings());
1205 1201
1206 float min_contents_scale = MinimumContentsScale(); 1202 float min_contents_scale = MinimumContentsScale();
1207 DCHECK_GT(min_contents_scale, 0.f); 1203 DCHECK_GT(min_contents_scale, 0.f);
1208 float min_page_scale = layer_tree_impl()->min_page_scale_factor(); 1204 float min_page_scale = layer_tree_impl()->min_page_scale_factor();
1209 DCHECK_GT(min_page_scale, 0.f); 1205 DCHECK_GT(min_page_scale, 0.f);
1210 float min_device_scale = 1.f; 1206 float min_device_scale = 1.f;
1211 float min_source_scale = 1207 float min_source_scale =
1212 min_contents_scale / min_page_scale / min_device_scale; 1208 min_contents_scale / min_page_scale / min_device_scale;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 1355
1360 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { 1356 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const {
1361 if (!layer_tree_impl()->IsActiveTree()) 1357 if (!layer_tree_impl()->IsActiveTree())
1362 return true; 1358 return true;
1363 1359
1364 return AllTilesRequiredAreReadyToDraw( 1360 return AllTilesRequiredAreReadyToDraw(
1365 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); 1361 &PictureLayerTiling::IsTileRequiredForDrawIfVisible);
1366 } 1362 }
1367 1363
1368 } // namespace cc 1364 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698