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

Unified Diff: cc/picture_layer.cc

Issue 11574026: cc: Add some more infrastructure for two trees (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 80 columns /o\ Created 8 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 side-by-side diff with in-line comments
Download patch
Index: cc/picture_layer.cc
diff --git a/cc/picture_layer.cc b/cc/picture_layer.cc
index ca2bf4a2988e8c71b9127b46488506f3fdfa71ee..a7466cb633e47191db5b3526ffd7ead89d53a935 100644
--- a/cc/picture_layer.cc
+++ b/cc/picture_layer.cc
@@ -3,6 +3,8 @@
// found in the LICENSE file.
#include "cc/picture_layer.h"
+
+#include "cc/layer_tree_impl.h"
#include "cc/picture_layer_impl.h"
#include "ui/gfx/rect_conversions.h"
@@ -29,15 +31,30 @@ scoped_ptr<LayerImpl> PictureLayer::createLayerImpl(LayerTreeImpl* treeImpl) {
void PictureLayer::pushPropertiesTo(LayerImpl* base_layer) {
Layer::pushPropertiesTo(base_layer);
+
PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer);
- layer_impl->didUpdateBounds();
+ layer_impl->tilings_.SetLayerBounds(bounds());
+ layer_impl->invalidation_.Clear();
+ layer_impl->invalidation_.Swap(pile_invalidation_);
pile_.PushPropertiesTo(layer_impl->pile_);
- // TODO(enne): Once we have two trees on the impl side, we need to
- // sync the active layer's tiles prior to this Invalidate call since it
- // will make new tiles for anything intersecting the invalidation.
- layer_impl->tilings_.Invalidate(pile_invalidation_);
- pile_invalidation_.Clear();
+ // TODO(enne): Remove this once syncing happens to the pending tree rather
+ // than the active one.
+ if (layer_impl->layerTreeImpl()->IsActiveTree()) {
+ layer_impl->tilings_.Invalidate(layer_impl->invalidation_);
+ return;
+ }
+
+ if (drawsContent()) {
nduca 2012/12/14 02:18:43 can this be a method on the picture layer impl? Di
enne (OOO) 2012/12/14 17:30:53 Do you mean without having to instantiate an activ
+ // If there is an active tree version of this layer, get a copy of its
+ // tiles. This needs to be done last, after setting invalidation and the
+ // pile.
+ DCHECK(layer_impl->layerTreeImpl()->IsPendingTree());
+ PictureLayerImpl* active_twin = static_cast<PictureLayerImpl*>(
+ base_layer->layerTreeImpl()->ActiveTreeLayerById(id()));
+ if (active_twin)
+ layer_impl->SyncFromActiveLayer(active_twin);
+ }
}
void PictureLayer::setNeedsDisplayRect(const gfx::RectF& layer_rect) {
« cc/layer_tree_impl.h ('K') | « cc/layer_tree_impl.cc ('k') | cc/picture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698