Chromium Code Reviews| 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 348 bool Layer::HasAncestor(const Layer* ancestor) const { | 348 bool Layer::HasAncestor(const Layer* ancestor) const { |
| 349 for (const Layer* layer = parent(); layer; layer = layer->parent()) { | 349 for (const Layer* layer = parent(); layer; layer = layer->parent()) { |
| 350 if (layer == ancestor) | 350 if (layer == ancestor) |
| 351 return true; | 351 return true; |
| 352 } | 352 } |
| 353 return false; | 353 return false; |
| 354 } | 354 } |
| 355 | 355 |
| 356 void Layer::RequestCopyOfOutput(std::unique_ptr<CopyOutputRequest> request) { | 356 void Layer::RequestCopyOfOutput(std::unique_ptr<CopyOutputRequest> request) { |
| 357 DCHECK(IsPropertyChangeAllowed()); | 357 DCHECK(IsPropertyChangeAllowed()); |
| 358 if (void* source = request->source()) { | 358 if (request->has_source()) { |
| 359 auto source = request->source(); | |
|
Fady Samuel
2017/01/26 21:49:34
const base::UnguessableToken& instead of auto?
Saman Sami
2017/01/26 22:23:22
Done.
| |
| 359 auto it = | 360 auto it = |
| 360 std::find_if(inputs_.copy_requests.begin(), inputs_.copy_requests.end(), | 361 std::find_if(inputs_.copy_requests.begin(), inputs_.copy_requests.end(), |
| 361 [source](const std::unique_ptr<CopyOutputRequest>& x) { | 362 [source](const std::unique_ptr<CopyOutputRequest>& x) { |
| 362 return x->source() == source; | 363 return x->has_source() && x->source() == source; |
| 363 }); | 364 }); |
| 364 if (it != inputs_.copy_requests.end()) | 365 if (it != inputs_.copy_requests.end()) |
| 365 inputs_.copy_requests.erase(it); | 366 inputs_.copy_requests.erase(it); |
| 366 } | 367 } |
| 367 if (request->IsEmpty()) | 368 if (request->IsEmpty()) |
| 368 return; | 369 return; |
| 369 inputs_.copy_requests.push_back(std::move(request)); | 370 inputs_.copy_requests.push_back(std::move(request)); |
| 370 SetSubtreePropertyChanged(); | 371 SetSubtreePropertyChanged(); |
| 371 SetNeedsCommit(); | 372 SetNeedsCommit(); |
| 372 } | 373 } |
| (...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1578 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); | 1579 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); |
| 1579 return draw_property_utils::ScreenSpaceTransform( | 1580 return draw_property_utils::ScreenSpaceTransform( |
| 1580 this, layer_tree_->property_trees()->transform_tree); | 1581 this, layer_tree_->property_trees()->transform_tree); |
| 1581 } | 1582 } |
| 1582 | 1583 |
| 1583 LayerTree* Layer::GetLayerTree() const { | 1584 LayerTree* Layer::GetLayerTree() const { |
| 1584 return layer_tree_; | 1585 return layer_tree_; |
| 1585 } | 1586 } |
| 1586 | 1587 |
| 1587 } // namespace cc | 1588 } // namespace cc |
| OLD | NEW |