OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui_resource_layer.h" | 5 #include "cc/layers/ui_resource_layer.h" |
6 | 6 |
7 #include "cc/resources/prioritized_resource_manager.h" | 7 #include "cc/resources/prioritized_resource_manager.h" |
8 #include "cc/resources/resource_provider.h" | 8 #include "cc/resources/resource_provider.h" |
9 #include "cc/resources/resource_update_queue.h" | 9 #include "cc/resources/resource_update_queue.h" |
10 #include "cc/resources/scoped_ui_resource.h" | 10 #include "cc/resources/scoped_ui_resource.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 EXPECT_FALSE(test_layer->DrawsContent()); | 96 EXPECT_FALSE(test_layer->DrawsContent()); |
97 | 97 |
98 bool is_opaque = false; | 98 bool is_opaque = false; |
99 scoped_ptr<ScopedUIResource> resource = ScopedUIResource::Create( | 99 scoped_ptr<ScopedUIResource> resource = ScopedUIResource::Create( |
100 layer_tree_host_.get(), UIResourceBitmap(gfx::Size(10, 10), is_opaque)); | 100 layer_tree_host_.get(), UIResourceBitmap(gfx::Size(10, 10), is_opaque)); |
101 test_layer->SetUIResourceId(resource->id()); | 101 test_layer->SetUIResourceId(resource->id()); |
102 test_layer->Update(&queue, &occlusion_tracker); | 102 test_layer->Update(&queue, &occlusion_tracker); |
103 | 103 |
104 EXPECT_TRUE(test_layer->DrawsContent()); | 104 EXPECT_TRUE(test_layer->DrawsContent()); |
| 105 |
| 106 // ID is preserved even when you set ID first and attach it to the tree. |
| 107 scoped_refptr<UIResourceLayer> new_test_layer = UIResourceLayer::Create(); |
| 108 scoped_ptr<ScopedUIResource> new_resource = ScopedUIResource::Create( |
| 109 layer_tree_host_.get(), UIResourceBitmap(gfx::Size(5, 5), is_opaque)); |
| 110 new_test_layer->SetUIResourceId(new_resource->id()); |
| 111 test_layer->AddChild(new_test_layer); |
| 112 EXPECT_EQ(new_resource->id(), new_test_layer->GetUIResourceId()); |
105 } | 113 } |
106 | 114 |
107 } // namespace | 115 } // namespace |
108 } // namespace cc | 116 } // namespace cc |
OLD | NEW |