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

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: update 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
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/picture_layer_impl.cc
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index dbe343d08446b986f33a688e4b3b0c2c5a251508..d23849a0a8945863874c52ee8e5447e69dcb2191 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,
@@ -88,12 +77,28 @@ PictureLayerImpl::PictureLayerImpl(
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 +605,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()) {
+ 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
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698