OLD | NEW |
---|---|
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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
591 void PictureLayerImpl::DidBecomeActive() { | 591 void PictureLayerImpl::DidBecomeActive() { |
592 LayerImpl::DidBecomeActive(); | 592 LayerImpl::DidBecomeActive(); |
593 // TODO(vmpstr): See if this can be removed in favour of calling it from LTHI | 593 // TODO(vmpstr): See if this can be removed in favour of calling it from LTHI |
594 layer_tree_impl()->DidModifyTilePriorities(); | 594 layer_tree_impl()->DidModifyTilePriorities(); |
595 } | 595 } |
596 | 596 |
597 void PictureLayerImpl::DidBeginTracing() { | 597 void PictureLayerImpl::DidBeginTracing() { |
598 raster_source_->DidBeginTracing(); | 598 raster_source_->DidBeginTracing(); |
599 } | 599 } |
600 | 600 |
601 void PictureLayerImpl::ResetTileCache() { | |
602 RemoveAllTilings(); | |
603 if (!tilings_) | |
604 return; | |
605 | |
606 // Reset the settings. | |
607 // TODO(vmpstr): Should this funciton set tilings_ to nullptr instead? | |
enne (OOO)
2014/12/02 21:25:58
I'm not sure. I think previously PictureLayerImpl
danakj
2014/12/02 21:58:37
I'd like to not deal with nullptrs. With my CL it'
| |
608 tilings_->SetMaxTilesForInterestArea(GetMaxTilesForInterestArea()); | |
609 tilings_->SetSkewportTargetTimeInSeconds(GetSkewportTargetTimeInSeconds()); | |
610 tilings_->SetSkewportExtrapolationLimitInContentPixels( | |
611 GetSkewportExtrapolationLimitInContentPixels()); | |
612 } | |
613 | |
601 void PictureLayerImpl::ReleaseResources() { | 614 void PictureLayerImpl::ReleaseResources() { |
602 if (tilings_) | 615 ResetTileCache(); |
603 RemoveAllTilings(); | |
604 | |
605 ResetRasterScale(); | |
606 | 616 |
607 // To avoid an edge case after lost context where the tree is up to date but | 617 // To avoid an edge case after lost context where the tree is up to date but |
608 // the tilings have not been managed, request an update draw properties | 618 // the tilings have not been managed, request an update draw properties |
609 // to force tilings to get managed. | 619 // to force tilings to get managed. |
610 layer_tree_impl()->set_needs_update_draw_properties(); | 620 layer_tree_impl()->set_needs_update_draw_properties(); |
611 } | 621 } |
612 | 622 |
613 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { | 623 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { |
614 return raster_source_->GetFlattenedPicture(); | 624 return raster_source_->GetFlattenedPicture(); |
615 } | 625 } |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
858 } | 868 } |
859 | 869 |
860 *resource_id = draw_info.get_resource_id(); | 870 *resource_id = draw_info.get_resource_id(); |
861 *resource_size = iter.texture_size(); | 871 *resource_size = iter.texture_size(); |
862 } | 872 } |
863 | 873 |
864 void PictureLayerImpl::DoPostCommitInitialization() { | 874 void PictureLayerImpl::DoPostCommitInitialization() { |
865 DCHECK(needs_post_commit_initialization_); | 875 DCHECK(needs_post_commit_initialization_); |
866 DCHECK(layer_tree_impl()->IsPendingTree()); | 876 DCHECK(layer_tree_impl()->IsPendingTree()); |
867 | 877 |
868 if (!tilings_) | 878 if (!tilings_) { |
869 tilings_ = PictureLayerTilingSet::Create(this); | 879 tilings_ = PictureLayerTilingSet::Create( |
880 this, GetMaxTilesForInterestArea(), GetSkewportTargetTimeInSeconds(), | |
881 GetSkewportExtrapolationLimitInContentPixels()); | |
882 } | |
870 | 883 |
871 PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer(); | 884 PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer(); |
872 if (twin_layer) { | 885 if (twin_layer) { |
873 // If the twin has never been pushed to, do not sync from it. | 886 // If the twin has never been pushed to, do not sync from it. |
874 // This can happen if this function is called during activation. | 887 // This can happen if this function is called during activation. |
875 if (!twin_layer->needs_post_commit_initialization_) | 888 if (!twin_layer->needs_post_commit_initialization_) |
876 SyncFromActiveLayer(twin_layer); | 889 SyncFromActiveLayer(twin_layer); |
877 } | 890 } |
878 | 891 |
879 needs_post_commit_initialization_ = false; | 892 needs_post_commit_initialization_ = false; |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1477 IteratorType index = stages_[current_stage_].iterator_type; | 1490 IteratorType index = stages_[current_stage_].iterator_type; |
1478 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; | 1491 TilePriority::PriorityBin tile_type = stages_[current_stage_].tile_type; |
1479 | 1492 |
1480 if (iterators_[index] && iterators_[index].get_type() == tile_type) | 1493 if (iterators_[index] && iterators_[index].get_type() == tile_type) |
1481 break; | 1494 break; |
1482 ++current_stage_; | 1495 ++current_stage_; |
1483 } | 1496 } |
1484 } | 1497 } |
1485 | 1498 |
1486 } // namespace cc | 1499 } // namespace cc |
OLD | NEW |