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

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

Issue 2159513003: Setup LayerTree class, refactor 2 functions from LayerTreeHost to it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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/layer.h" 5 #include "cc/layers/layer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 208
209 void Layer::SetNextCommitWaitsForActivation() { 209 void Layer::SetNextCommitWaitsForActivation() {
210 if (!layer_tree_host_) 210 if (!layer_tree_host_)
211 return; 211 return;
212 212
213 layer_tree_host_->SetNextCommitWaitsForActivation(); 213 layer_tree_host_->SetNextCommitWaitsForActivation();
214 } 214 }
215 215
216 void Layer::SetNeedsPushProperties() { 216 void Layer::SetNeedsPushProperties() {
217 if (layer_tree_host_) 217 if (layer_tree_host_)
218 layer_tree_host_->AddLayerShouldPushProperties(this); 218 layer_tree_host_->layer_tree()->AddLayerShouldPushProperties(this);
Khushal 2016/07/18 16:59:32 I would suggest add a public method to Layer to ac
xingliu 2016/07/19 22:47:37 Done. Good idea.
219 } 219 }
220 220
221 void Layer::ResetNeedsPushPropertiesForTesting() { 221 void Layer::ResetNeedsPushPropertiesForTesting() {
222 layer_tree_host_->RemoveLayerShouldPushProperties(this); 222 layer_tree_host_->layer_tree()->RemoveLayerShouldPushProperties(this);
223 } 223 }
224 224
225 bool Layer::IsPropertyChangeAllowed() const { 225 bool Layer::IsPropertyChangeAllowed() const {
226 if (!layer_tree_host_) 226 if (!layer_tree_host_)
227 return true; 227 return true;
228 228
229 return !layer_tree_host_->in_paint_layer_contents(); 229 return !layer_tree_host_->in_paint_layer_contents();
230 } 230 }
231 231
232 sk_sp<SkPicture> Layer::GetPicture() const { 232 sk_sp<SkPicture> Layer::GetPicture() const {
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 layer->SetUpdateRect(inputs_.update_rect); 1188 layer->SetUpdateRect(inputs_.update_rect);
1189 1189
1190 layer->SetHasWillChangeTransformHint(has_will_change_transform_hint()); 1190 layer->SetHasWillChangeTransformHint(has_will_change_transform_hint());
1191 layer->SetNeedsPushProperties(); 1191 layer->SetNeedsPushProperties();
1192 1192
1193 // Reset any state that should be cleared for the next update. 1193 // Reset any state that should be cleared for the next update.
1194 subtree_property_changed_ = false; 1194 subtree_property_changed_ = false;
1195 layer_property_changed_ = false; 1195 layer_property_changed_ = false;
1196 inputs_.update_rect = gfx::Rect(); 1196 inputs_.update_rect = gfx::Rect();
1197 1197
1198 layer_tree_host()->RemoveLayerShouldPushProperties(this); 1198 layer_tree_host_->layer_tree()->RemoveLayerShouldPushProperties(this);
1199 } 1199 }
1200 1200
1201 void Layer::TakeCopyRequests( 1201 void Layer::TakeCopyRequests(
1202 std::vector<std::unique_ptr<CopyOutputRequest>>* requests) { 1202 std::vector<std::unique_ptr<CopyOutputRequest>>* requests) {
1203 for (auto& it : inputs_.copy_requests) { 1203 for (auto& it : inputs_.copy_requests) {
1204 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner = 1204 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner =
1205 layer_tree_host()->task_runner_provider()->MainThreadTaskRunner(); 1205 layer_tree_host()->task_runner_provider()->MainThreadTaskRunner();
1206 std::unique_ptr<CopyOutputRequest> original_request = std::move(it); 1206 std::unique_ptr<CopyOutputRequest> original_request = std::move(it);
1207 const CopyOutputRequest& original_request_ref = *original_request; 1207 const CopyOutputRequest& original_request_ref = *original_request;
1208 std::unique_ptr<CopyOutputRequest> main_thread_request = 1208 std::unique_ptr<CopyOutputRequest> main_thread_request =
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
1843 ->num_copy_requests_in_subtree; 1843 ->num_copy_requests_in_subtree;
1844 } 1844 }
1845 1845
1846 gfx::Transform Layer::screen_space_transform() const { 1846 gfx::Transform Layer::screen_space_transform() const {
1847 DCHECK_NE(transform_tree_index_, -1); 1847 DCHECK_NE(transform_tree_index_, -1);
1848 return draw_property_utils::ScreenSpaceTransform( 1848 return draw_property_utils::ScreenSpaceTransform(
1849 this, layer_tree_host_->property_trees()->transform_tree); 1849 this, layer_tree_host_->property_trees()->transform_tree);
1850 } 1850 }
1851 1851
1852 } // namespace cc 1852 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698