| 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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 frame->render_pass_list.push_back(root_pass.Pass()); | 131 frame->render_pass_list.push_back(root_pass.Pass()); |
| 132 return frame.Pass(); | 132 return frame.Pass(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void AddTransferableResource(DelegatedFrameData* frame, | 135 void AddTransferableResource(DelegatedFrameData* frame, |
| 136 ResourceProvider::ResourceId resource_id) { | 136 ResourceProvider::ResourceId resource_id) { |
| 137 TransferableResource resource; | 137 TransferableResource resource; |
| 138 resource.id = resource_id; | 138 resource.id = resource_id; |
| 139 resource.target = GL_TEXTURE_2D; | 139 resource.target = GL_TEXTURE_2D; |
| 140 resource.mailbox.name[0] = 1; |
| 140 frame->resource_list.push_back(resource); | 141 frame->resource_list.push_back(resource); |
| 141 } | 142 } |
| 142 | 143 |
| 143 void AddTextureQuad(DelegatedFrameData* frame, | 144 void AddTextureQuad(DelegatedFrameData* frame, |
| 144 ResourceProvider::ResourceId resource_id) { | 145 ResourceProvider::ResourceId resource_id) { |
| 145 scoped_ptr<SharedQuadState> sqs = SharedQuadState::Create(); | 146 scoped_ptr<SharedQuadState> sqs = SharedQuadState::Create(); |
| 146 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); | 147 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); |
| 147 float vertex_opacity[4] = { 1.f, 1.f, 1.f, 1.f }; | 148 float vertex_opacity[4] = { 1.f, 1.f, 1.f, 1.f }; |
| 148 quad->SetNew(sqs.get(), | 149 quad->SetNew(sqs.get(), |
| 149 gfx::Rect(0, 0, 10, 10), | 150 gfx::Rect(0, 0, 10, 10), |
| (...skipping 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2211 EXPECT_EQ(0u, resources.size()); | 2212 EXPECT_EQ(0u, resources.size()); |
| 2212 EXPECT_FALSE(TestAndResetAvailable()); | 2213 EXPECT_FALSE(TestAndResetAvailable()); |
| 2213 | 2214 |
| 2214 // Destroy the frame provider. Resources should be returned. | 2215 // Destroy the frame provider. Resources should be returned. |
| 2215 frame_provider_ = NULL; | 2216 frame_provider_ = NULL; |
| 2216 | 2217 |
| 2217 resource_collection_->TakeUnusedResourcesForChildCompositor(&resources); | 2218 resource_collection_->TakeUnusedResourcesForChildCompositor(&resources); |
| 2218 { | 2219 { |
| 2219 unsigned expected[] = {777, 888}; | 2220 unsigned expected[] = {777, 888}; |
| 2220 EXPECT_RESOURCES(expected, resources); | 2221 EXPECT_RESOURCES(expected, resources); |
| 2222 // Those resources should not be lost. |
| 2223 EXPECT_FALSE(resources[0].lost); |
| 2224 EXPECT_FALSE(resources[1].lost); |
| 2221 EXPECT_TRUE(TestAndResetAvailable()); | 2225 EXPECT_TRUE(TestAndResetAvailable()); |
| 2222 } | 2226 } |
| 2223 EndTest(); | 2227 EndTest(); |
| 2224 break; | 2228 break; |
| 2225 } | 2229 } |
| 2226 } | 2230 } |
| 2227 | 2231 |
| 2228 virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, | 2232 virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, |
| 2229 bool result) OVERRIDE { | 2233 bool result) OVERRIDE { |
| 2230 ReturnUnusedResourcesFromParent(host_impl); | 2234 ReturnUnusedResourcesFromParent(host_impl); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2313 } | 2317 } |
| 2314 | 2318 |
| 2315 scoped_refptr<DelegatedRendererLayer> delegated_thief_; | 2319 scoped_refptr<DelegatedRendererLayer> delegated_thief_; |
| 2316 }; | 2320 }; |
| 2317 | 2321 |
| 2318 SINGLE_AND_MULTI_THREAD_TEST_F( | 2322 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 2319 LayerTreeHostDelegatedTestRemoveAndChangeResources); | 2323 LayerTreeHostDelegatedTestRemoveAndChangeResources); |
| 2320 | 2324 |
| 2321 } // namespace | 2325 } // namespace |
| 2322 } // namespace cc | 2326 } // namespace cc |
| OLD | NEW |