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

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

Issue 2100353002: cc: DCHECK that the OutputSurface was released in ~LayerTreeHostImpl(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: released-outputsurface: rebase 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_impl_test_properties.h" 5 #include "cc/layers/layer_impl_test_properties.h"
6 6
7 #include "cc/layers/layer_impl.h" 7 #include "cc/layers/layer_impl.h"
8 #include "cc/output/copy_output_request.h" 8 #include "cc/output/copy_output_request.h"
9 #include "cc/trees/layer_tree_impl.h" 9 #include "cc/trees/layer_tree_impl.h"
10 10
(...skipping 15 matching lines...) Expand all
26 mask_layer(nullptr), 26 mask_layer(nullptr),
27 replica_layer(nullptr), 27 replica_layer(nullptr),
28 parent(nullptr) {} 28 parent(nullptr) {}
29 29
30 LayerImplTestProperties::~LayerImplTestProperties() {} 30 LayerImplTestProperties::~LayerImplTestProperties() {}
31 31
32 void LayerImplTestProperties::AddChild(std::unique_ptr<LayerImpl> child) { 32 void LayerImplTestProperties::AddChild(std::unique_ptr<LayerImpl> child) {
33 child->test_properties()->parent = owning_layer; 33 child->test_properties()->parent = owning_layer;
34 children.push_back(child.get()); 34 children.push_back(child.get());
35 owning_layer->layer_tree_impl()->AddLayer(std::move(child)); 35 owning_layer->layer_tree_impl()->AddLayer(std::move(child));
36 owning_layer->layer_tree_impl()->BuildLayerListForTesting();
36 } 37 }
37 38
38 std::unique_ptr<LayerImpl> LayerImplTestProperties::RemoveChild( 39 std::unique_ptr<LayerImpl> LayerImplTestProperties::RemoveChild(
39 LayerImpl* child) { 40 LayerImpl* child) {
40 auto it = std::find(children.begin(), children.end(), child); 41 auto it = std::find(children.begin(), children.end(), child);
41 if (it != children.end()) 42 if (it != children.end())
42 children.erase(it); 43 children.erase(it);
43 owning_layer->layer_tree_impl()->property_trees()->RemoveIdFromIdToIndexMaps( 44 owning_layer->layer_tree_impl()->property_trees()->RemoveIdFromIdToIndexMaps(
44 child->id()); 45 child->id());
45 return owning_layer->layer_tree_impl()->RemoveLayer(child->id()); 46 auto layer = owning_layer->layer_tree_impl()->RemoveLayer(child->id());
47 owning_layer->layer_tree_impl()->BuildLayerListForTesting();
48 return layer;
46 } 49 }
47 50
48 void LayerImplTestProperties::SetMaskLayer(std::unique_ptr<LayerImpl> mask) { 51 void LayerImplTestProperties::SetMaskLayer(std::unique_ptr<LayerImpl> mask) {
49 if (mask_layer) 52 if (mask_layer)
50 owning_layer->layer_tree_impl()->RemoveLayer(mask_layer->id()); 53 owning_layer->layer_tree_impl()->RemoveLayer(mask_layer->id());
51 mask_layer = mask.get(); 54 mask_layer = mask.get();
52 if (mask) 55 if (mask)
53 owning_layer->layer_tree_impl()->AddLayer(std::move(mask)); 56 owning_layer->layer_tree_impl()->AddLayer(std::move(mask));
54 } 57 }
55 58
56 void LayerImplTestProperties::SetReplicaLayer( 59 void LayerImplTestProperties::SetReplicaLayer(
57 std::unique_ptr<LayerImpl> replica) { 60 std::unique_ptr<LayerImpl> replica) {
58 if (replica_layer) { 61 if (replica_layer) {
59 replica_layer->test_properties()->SetMaskLayer(nullptr); 62 replica_layer->test_properties()->SetMaskLayer(nullptr);
60 owning_layer->layer_tree_impl()->RemoveLayer(replica_layer->id()); 63 owning_layer->layer_tree_impl()->RemoveLayer(replica_layer->id());
61 } 64 }
62 replica_layer = replica.get(); 65 replica_layer = replica.get();
63 if (replica) { 66 if (replica) {
64 replica->test_properties()->parent = owning_layer; 67 replica->test_properties()->parent = owning_layer;
65 owning_layer->layer_tree_impl()->AddLayer(std::move(replica)); 68 owning_layer->layer_tree_impl()->AddLayer(std::move(replica));
66 } 69 }
67 } 70 }
68 71
69 } // namespace cc 72 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/picture_layer_unittest.cc » ('j') | cc/trees/layer_tree_host_impl_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698