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

Unified Diff: cc/layers/picture_layer_impl.cc

Issue 900073003: cc: Rework how picture layer tiling set gets into raster queues. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed unrelated changes Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: cc/layers/picture_layer_impl.cc
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 3a0753f5da627c156836ea8d7a77240927261e75..306fffc9adff76e291e9ad333562600f374826a2 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -54,17 +54,6 @@ const int kTileRoundUp = 64;
namespace cc {
-PictureLayerImpl::Pair::Pair() : active(nullptr), pending(nullptr) {
-}
-
-PictureLayerImpl::Pair::Pair(PictureLayerImpl* active_layer,
- PictureLayerImpl* pending_layer)
- : active(active_layer), pending(pending_layer) {
-}
-
-PictureLayerImpl::Pair::~Pair() {
-}
-
PictureLayerImpl::PictureLayerImpl(
LayerTreeImpl* tree_impl,
int id,
@@ -87,13 +76,26 @@ PictureLayerImpl::PictureLayerImpl(
only_used_low_res_last_append_quads_(false),
is_mask_(is_mask),
nearest_neighbor_(false) {
- layer_tree_impl()->RegisterPictureLayerImpl(this);
+ // If this layer is created while we have no tile manager, then we will get a
+ // call to ReleaseResources and RecreateResources when we get a tile manager,
+ // so we will be able to register a tiling set into it at that time.
+ // Otherwise, if tile manager already exists, then register the tiling set
+ // right now.
+ if (tree_impl->tile_manager()) {
+ WhichTree tree = tree_impl->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE;
+ tree_impl->tile_manager()->RegisterPictureLayerTilingSet(id, tree,
+ tilings_.get());
+ }
}
PictureLayerImpl::~PictureLayerImpl() {
if (twin_layer_)
twin_layer_->twin_layer_ = nullptr;
- layer_tree_impl()->UnregisterPictureLayerImpl(this);
+
+ if (layer_tree_impl()->tile_manager()) {
+ layer_tree_impl()->tile_manager()->UnregisterPictureLayerTilingSet(
+ id(), GetTree());
+ }
}
const char* PictureLayerImpl::LayerTypeAsString() const {
@@ -600,14 +602,20 @@ void PictureLayerImpl::DidBeginTracing() {
}
void PictureLayerImpl::ReleaseResources() {
- // Recreate tilings with new settings, since some of those might change when
- // we release resources.
+ if (layer_tree_impl()->tile_manager()) {
enne (OOO) 2015/02/10 21:28:31 When can you not have a TileManager during this ca
vmpstr 2015/02/11 21:37:16 Several unittests aren't too happy without this if
enne (OOO) 2015/02/11 21:46:16 Ok! Thanks for the explanation.
+ layer_tree_impl()->tile_manager()->UnregisterPictureLayerTilingSet(
+ id(), GetTree());
+ }
tilings_ = nullptr;
ResetRasterScale();
}
void PictureLayerImpl::RecreateResources() {
+ DCHECK(!tilings_);
+ DCHECK(layer_tree_impl()->tile_manager());
tilings_ = CreatePictureLayerTilingSet();
+ layer_tree_impl()->tile_manager()->RegisterPictureLayerTilingSet(
+ id(), GetTree(), tilings_.get());
// To avoid an edge case after lost context where the tree is up to date but
// the tilings have not been managed, request an update draw properties

Powered by Google App Engine
This is Rietveld 408576698