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

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

Issue 706203003: Update from https://crrev.com/303153 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « cc/layers/layer_impl_unittest.cc ('k') | cc/layers/picture_layer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.h" 5 #include "cc/layers/picture_layer.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "cc/layers/content_layer_client.h" 8 #include "cc/layers/content_layer_client.h"
9 #include "cc/layers/picture_layer_impl.h" 9 #include "cc/layers/picture_layer_impl.h"
10 #include "cc/trees/layer_tree_impl.h" 10 #include "cc/trees/layer_tree_impl.h"
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 29
30 scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { 30 scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) {
31 return PictureLayerImpl::Create(tree_impl, id()); 31 return PictureLayerImpl::Create(tree_impl, id());
32 } 32 }
33 33
34 void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) { 34 void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) {
35 Layer::PushPropertiesTo(base_layer); 35 Layer::PushPropertiesTo(base_layer);
36 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); 36 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer);
37 37
38 if (layer_impl->bounds().IsEmpty()) { 38 int source_frame_number = layer_tree_host()->source_frame_number();
39 // Update may not get called for an empty layer, so resize here instead. 39 gfx::Size impl_bounds = layer_impl->bounds();
40 // Using layer_impl because either bounds() or paint_properties().bounds 40 gfx::Size pile_bounds = pile_.tiling_size();
41 // may disagree and either one could have been pushed to layer_impl. 41
42 // If update called, then pile size must match bounds pushed to impl layer.
43 DCHECK_IMPLIES(update_source_frame_number_ == source_frame_number,
44 impl_bounds == pile_bounds)
45 << " bounds " << impl_bounds.ToString() << " pile "
46 << pile_bounds.ToString();
47
48 if (update_source_frame_number_ != source_frame_number &&
49 pile_bounds != impl_bounds) {
50 // Update may not get called for the layer (if it's not in the viewport
51 // for example, even though it has resized making the pile no longer
52 // valid. In this case just destroy the pile.
42 pile_.SetEmptyBounds(); 53 pile_.SetEmptyBounds();
43 } else {
44 // If update called, then pile size must match bounds pushed to impl layer.
45 DCHECK_IMPLIES(
46 update_source_frame_number_ == layer_tree_host()->source_frame_number(),
47 layer_impl->bounds().ToString() == pile_.tiling_size().ToString());
48 } 54 }
49 55
50 // Unlike other properties, invalidation must always be set on layer_impl. 56 // Unlike other properties, invalidation must always be set on layer_impl.
51 // See PictureLayerImpl::PushPropertiesTo for more details. 57 // See PictureLayerImpl::PushPropertiesTo for more details.
52 layer_impl->invalidation_.Clear(); 58 layer_impl->invalidation_.Clear();
53 layer_impl->invalidation_.Swap(&pile_invalidation_); 59 layer_impl->invalidation_.Swap(&pile_invalidation_);
54 layer_impl->UpdatePile(PicturePileImpl::CreateFromOther(&pile_)); 60 layer_impl->UpdatePile(PicturePileImpl::CreateFromOther(&pile_));
55 } 61 }
56 62
57 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { 63 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 195
190 bool PictureLayer::HasDrawableContent() const { 196 bool PictureLayer::HasDrawableContent() const {
191 return client_ && Layer::HasDrawableContent(); 197 return client_ && Layer::HasDrawableContent();
192 } 198 }
193 199
194 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { 200 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) {
195 benchmark->RunOnLayer(this); 201 benchmark->RunOnLayer(this);
196 } 202 }
197 203
198 } // namespace cc 204 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl_unittest.cc ('k') | cc/layers/picture_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698