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

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

Issue 640063010: cc: Don't swap PictureLayerTilingSet on activate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: noswap: rebase Created 6 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 unified diff | Download patch
« no previous file with comments | « cc/layers/picture_layer.h ('k') | cc/layers/picture_layer_impl.h » ('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/resources/display_list_recording_source.h" 10 #include "cc/resources/display_list_recording_source.h"
(...skipping 19 matching lines...) Expand all
30 PictureLayer::PictureLayer(ContentLayerClient* client, 30 PictureLayer::PictureLayer(ContentLayerClient* client,
31 scoped_ptr<RecordingSource> source) 31 scoped_ptr<RecordingSource> source)
32 : PictureLayer(client) { 32 : PictureLayer(client) {
33 recording_source_ = source.Pass(); 33 recording_source_ = source.Pass();
34 } 34 }
35 35
36 PictureLayer::~PictureLayer() { 36 PictureLayer::~PictureLayer() {
37 } 37 }
38 38
39 scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { 39 scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) {
40 return PictureLayerImpl::Create(tree_impl, id()); 40 return PictureLayerImpl::Create(tree_impl, id(), is_mask_);
41 } 41 }
42 42
43 void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) { 43 void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) {
44 Layer::PushPropertiesTo(base_layer); 44 Layer::PushPropertiesTo(base_layer);
45 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); 45 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer);
46 // TODO(danakj): Make is_mask_ a constructor parameter for PictureLayer.
47 DCHECK_EQ(layer_impl->is_mask_, is_mask_);
46 48
47 int source_frame_number = layer_tree_host()->source_frame_number(); 49 int source_frame_number = layer_tree_host()->source_frame_number();
48 gfx::Size impl_bounds = layer_impl->bounds(); 50 gfx::Size impl_bounds = layer_impl->bounds();
49 gfx::Size recording_source_bounds = recording_source_->GetSize(); 51 gfx::Size recording_source_bounds = recording_source_->GetSize();
50 52
51 // If update called, then recording source size must match bounds pushed to 53 // If update called, then recording source size must match bounds pushed to
52 // impl layer. 54 // impl layer.
53 DCHECK_IMPLIES(update_source_frame_number_ == source_frame_number, 55 DCHECK_IMPLIES(update_source_frame_number_ == source_frame_number,
54 impl_bounds == recording_source_bounds) 56 impl_bounds == recording_source_bounds)
55 << " bounds " << impl_bounds.ToString() << " recording source " 57 << " bounds " << impl_bounds.ToString() << " recording source "
56 << recording_source_bounds.ToString(); 58 << recording_source_bounds.ToString();
57 59
58 if (update_source_frame_number_ != source_frame_number && 60 if (update_source_frame_number_ != source_frame_number &&
59 recording_source_bounds != impl_bounds) { 61 recording_source_bounds != impl_bounds) {
60 // Update may not get called for the layer (if it's not in the viewport 62 // Update may not get called for the layer (if it's not in the viewport
61 // for example, even though it has resized making the recording source no 63 // for example, even though it has resized making the recording source no
62 // longer valid. In this case just destroy the recording source. 64 // longer valid. In this case just destroy the recording source.
63 recording_source_->SetEmptyBounds(); 65 recording_source_->SetEmptyBounds();
64 } 66 }
65 67
66 // Unlike other properties, invalidation must always be set on layer_impl.
67 // See PictureLayerImpl::PushPropertiesTo for more details.
68 layer_impl->invalidation_.Clear();
69 layer_impl->invalidation_.Swap(&recording_invalidation_);
70 layer_impl->set_is_mask(is_mask_);
71 scoped_refptr<RasterSource> raster_source = 68 scoped_refptr<RasterSource> raster_source =
72 recording_source_->CreateRasterSource(); 69 recording_source_->CreateRasterSource();
73 raster_source->SetBackgoundColor(SafeOpaqueBackgroundColor()); 70 raster_source->SetBackgoundColor(SafeOpaqueBackgroundColor());
74 raster_source->SetRequiresClear(!contents_opaque() && 71 raster_source->SetRequiresClear(!contents_opaque() &&
75 !client_->FillsBoundsCompletely()); 72 !client_->FillsBoundsCompletely());
76 layer_impl->UpdateRasterSource(raster_source); 73 layer_impl->UpdateRasterSource(raster_source, &recording_invalidation_,
74 nullptr);
75 DCHECK(recording_invalidation_.IsEmpty());
77 } 76 }
78 77
79 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { 78 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) {
80 Layer::SetLayerTreeHost(host); 79 Layer::SetLayerTreeHost(host);
81 if (host) { 80 if (host) {
82 if (!recording_source_) { 81 if (!recording_source_) {
83 if (host->settings().use_display_lists) { 82 if (host->settings().use_display_lists) {
84 recording_source_.reset(new DisplayListRecordingSource); 83 recording_source_.reset(new DisplayListRecordingSource);
85 } else { 84 } else {
86 recording_source_.reset(new PicturePile); 85 recording_source_.reset(new PicturePile);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 207
209 bool PictureLayer::HasDrawableContent() const { 208 bool PictureLayer::HasDrawableContent() const {
210 return client_ && Layer::HasDrawableContent(); 209 return client_ && Layer::HasDrawableContent();
211 } 210 }
212 211
213 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { 212 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) {
214 benchmark->RunOnLayer(this); 213 benchmark->RunOnLayer(this);
215 } 214 }
216 215
217 } // namespace cc 216 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer.h ('k') | cc/layers/picture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698