| OLD | NEW |
| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 property_tree_sequence_number_(-1), | 86 property_tree_sequence_number_(-1), |
| 87 should_flatten_transform_from_property_tree_(false), | 87 should_flatten_transform_from_property_tree_(false), |
| 88 draws_content_(false), | 88 draws_content_(false), |
| 89 use_local_transform_for_backface_visibility_(false), | 89 use_local_transform_for_backface_visibility_(false), |
| 90 should_check_backface_visibility_(false), | 90 should_check_backface_visibility_(false), |
| 91 force_render_surface_for_testing_(false), | 91 force_render_surface_for_testing_(false), |
| 92 subtree_property_changed_(false), | 92 subtree_property_changed_(false), |
| 93 may_contain_video_(false), | 93 may_contain_video_(false), |
| 94 is_scroll_clip_layer_(false), | 94 is_scroll_clip_layer_(false), |
| 95 needs_show_scrollbars_(false), | 95 needs_show_scrollbars_(false), |
| 96 subtree_has_copy_request_(false), |
| 96 safe_opaque_background_color_(0), | 97 safe_opaque_background_color_(0), |
| 97 num_unclipped_descendants_(0) {} | 98 num_unclipped_descendants_(0) {} |
| 98 | 99 |
| 99 Layer::~Layer() { | 100 Layer::~Layer() { |
| 100 // Our parent should be holding a reference to us so there should be no | 101 // Our parent should be holding a reference to us so there should be no |
| 101 // way for us to be destroyed while we still have a parent. | 102 // way for us to be destroyed while we still have a parent. |
| 102 DCHECK(!parent()); | 103 DCHECK(!parent()); |
| 103 // Similarly we shouldn't have a layer tree host since it also keeps a | 104 // Similarly we shouldn't have a layer tree host since it also keeps a |
| 104 // reference to us. | 105 // reference to us. |
| 105 DCHECK(!layer_tree_host()); | 106 DCHECK(!layer_tree_host()); |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 }); | 356 }); |
| 356 if (it != inputs_.copy_requests.end()) | 357 if (it != inputs_.copy_requests.end()) |
| 357 inputs_.copy_requests.erase(it); | 358 inputs_.copy_requests.erase(it); |
| 358 } | 359 } |
| 359 if (request->IsEmpty()) | 360 if (request->IsEmpty()) |
| 360 return; | 361 return; |
| 361 inputs_.copy_requests.push_back(std::move(request)); | 362 inputs_.copy_requests.push_back(std::move(request)); |
| 362 SetSubtreePropertyChanged(); | 363 SetSubtreePropertyChanged(); |
| 363 SetPropertyTreesNeedRebuild(); | 364 SetPropertyTreesNeedRebuild(); |
| 364 SetNeedsCommit(); | 365 SetNeedsCommit(); |
| 366 if (layer_tree_host_) |
| 367 layer_tree_host_->SetHasCopyRequest(true); |
| 368 } |
| 369 |
| 370 void Layer::SetSubtreeHasCopyRequest(bool subtree_has_copy_request) { |
| 371 subtree_has_copy_request_ = subtree_has_copy_request; |
| 372 } |
| 373 |
| 374 bool Layer::SubtreeHasCopyRequest() const { |
| 375 DCHECK(layer_tree_host_); |
| 376 // When the copy request is pushed to effect tree, we reset layer tree host's |
| 377 // has_copy_request but do not clear subtree_has_copy_request on individual |
| 378 // layers. |
| 379 return layer_tree_host_->has_copy_request() && subtree_has_copy_request_; |
| 365 } | 380 } |
| 366 | 381 |
| 367 void Layer::SetBackgroundColor(SkColor background_color) { | 382 void Layer::SetBackgroundColor(SkColor background_color) { |
| 368 DCHECK(IsPropertyChangeAllowed()); | 383 DCHECK(IsPropertyChangeAllowed()); |
| 369 if (inputs_.background_color == background_color) | 384 if (inputs_.background_color == background_color) |
| 370 return; | 385 return; |
| 371 inputs_.background_color = background_color; | 386 inputs_.background_color = background_color; |
| 372 SetPropertyTreesNeedRebuild(); | 387 SetPropertyTreesNeedRebuild(); |
| 373 SetNeedsCommit(); | 388 SetNeedsCommit(); |
| 374 } | 389 } |
| (...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1429 void Layer::SetMutableProperties(uint32_t properties) { | 1444 void Layer::SetMutableProperties(uint32_t properties) { |
| 1430 DCHECK(IsPropertyChangeAllowed()); | 1445 DCHECK(IsPropertyChangeAllowed()); |
| 1431 if (inputs_.mutable_properties == properties) | 1446 if (inputs_.mutable_properties == properties) |
| 1432 return; | 1447 return; |
| 1433 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), | 1448 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), |
| 1434 "Layer::SetMutableProperties", "properties", properties); | 1449 "Layer::SetMutableProperties", "properties", properties); |
| 1435 inputs_.mutable_properties = properties; | 1450 inputs_.mutable_properties = properties; |
| 1436 SetNeedsCommit(); | 1451 SetNeedsCommit(); |
| 1437 } | 1452 } |
| 1438 | 1453 |
| 1439 int Layer::num_copy_requests_in_target_subtree() { | 1454 bool Layer::has_copy_requests_in_target_subtree() { |
| 1440 return layer_tree_host_->property_trees() | 1455 return layer_tree_host_->property_trees() |
| 1441 ->effect_tree.Node(effect_tree_index()) | 1456 ->effect_tree.Node(effect_tree_index()) |
| 1442 ->num_copy_requests_in_subtree; | 1457 ->subtree_has_copy_request; |
| 1443 } | 1458 } |
| 1444 | 1459 |
| 1445 gfx::Transform Layer::ScreenSpaceTransform() const { | 1460 gfx::Transform Layer::ScreenSpaceTransform() const { |
| 1446 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); | 1461 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); |
| 1447 return draw_property_utils::ScreenSpaceTransform( | 1462 return draw_property_utils::ScreenSpaceTransform( |
| 1448 this, layer_tree_host_->property_trees()->transform_tree); | 1463 this, layer_tree_host_->property_trees()->transform_tree); |
| 1449 } | 1464 } |
| 1450 | 1465 |
| 1451 } // namespace cc | 1466 } // namespace cc |
| OLD | NEW |