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

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

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « cc/layers/picture_image_layer_impl_unittest.cc ('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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // Update may not get called for the layer (if it's not in the viewport 64 // Update may not get called for the layer (if it's not in the viewport
65 // for example, even though it has resized making the recording source no 65 // for example, even though it has resized making the recording source no
66 // longer valid. In this case just destroy the recording source. 66 // longer valid. In this case just destroy the recording source.
67 recording_source_->SetEmptyBounds(); 67 recording_source_->SetEmptyBounds();
68 } 68 }
69 69
70 layer_impl->SetNearestNeighbor(nearest_neighbor_); 70 layer_impl->SetNearestNeighbor(nearest_neighbor_);
71 71
72 scoped_refptr<RasterSource> raster_source = 72 scoped_refptr<RasterSource> raster_source =
73 recording_source_->CreateRasterSource(); 73 recording_source_->CreateRasterSource();
74 raster_source->SetBackgoundColor(SafeOpaqueBackgroundColor());
75 raster_source->SetRequiresClear(!contents_opaque() &&
76 !client_->FillsBoundsCompletely());
77 layer_impl->UpdateRasterSource(raster_source, &recording_invalidation_, 74 layer_impl->UpdateRasterSource(raster_source, &recording_invalidation_,
78 nullptr); 75 nullptr);
79 DCHECK(recording_invalidation_.IsEmpty()); 76 DCHECK(recording_invalidation_.IsEmpty());
80 } 77 }
81 78
82 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { 79 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) {
83 Layer::SetLayerTreeHost(host); 80 Layer::SetLayerTreeHost(host);
84 if (host) { 81 if (host) {
85 if (!recording_source_) { 82 if (!recording_source_) {
86 if (host->settings().use_display_lists) { 83 if (host->settings().use_display_lists) {
(...skipping 29 matching lines...) Expand all
116 visible_content_rect(), 1.f / contents_scale_x()); 113 visible_content_rect(), 1.f / contents_scale_x());
117 gfx::Size layer_size = paint_properties().bounds; 114 gfx::Size layer_size = paint_properties().bounds;
118 115
119 if (last_updated_visible_content_rect_ == visible_content_rect() && 116 if (last_updated_visible_content_rect_ == visible_content_rect() &&
120 recording_source_->GetSize() == layer_size && !can_use_lcd_text_changed && 117 recording_source_->GetSize() == layer_size && !can_use_lcd_text_changed &&
121 pending_invalidation_.IsEmpty()) { 118 pending_invalidation_.IsEmpty()) {
122 // Only early out if the visible content rect of this layer hasn't changed. 119 // Only early out if the visible content rect of this layer hasn't changed.
123 return updated; 120 return updated;
124 } 121 }
125 122
123 recording_source_->SetBackgroundColor(SafeOpaqueBackgroundColor());
124 recording_source_->SetRequiresClear(!contents_opaque() &&
125 !client_->FillsBoundsCompletely());
126
126 TRACE_EVENT1("cc", "PictureLayer::Update", 127 TRACE_EVENT1("cc", "PictureLayer::Update",
127 "source_frame_number", 128 "source_frame_number",
128 layer_tree_host()->source_frame_number()); 129 layer_tree_host()->source_frame_number());
129 devtools_instrumentation::ScopedLayerTreeTask update_layer( 130 devtools_instrumentation::ScopedLayerTreeTask update_layer(
130 devtools_instrumentation::kUpdateLayer, id(), layer_tree_host()->id()); 131 devtools_instrumentation::kUpdateLayer, id(), layer_tree_host()->id());
131 132
132 // Calling paint in WebKit can sometimes cause invalidations, so save 133 // Calling paint in WebKit can sometimes cause invalidations, so save
133 // off the invalidation prior to calling update. 134 // off the invalidation prior to calling update.
134 pending_invalidation_.Swap(&recording_invalidation_); 135 pending_invalidation_.Swap(&recording_invalidation_);
135 pending_invalidation_.Clear(); 136 pending_invalidation_.Clear();
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 218
218 bool PictureLayer::HasDrawableContent() const { 219 bool PictureLayer::HasDrawableContent() const {
219 return client_ && Layer::HasDrawableContent(); 220 return client_ && Layer::HasDrawableContent();
220 } 221 }
221 222
222 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { 223 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) {
223 benchmark->RunOnLayer(this); 224 benchmark->RunOnLayer(this);
224 } 225 }
225 226
226 } // namespace cc 227 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_image_layer_impl_unittest.cc ('k') | cc/layers/picture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698