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

Side by Side Diff: cc/trees/layer_tree_host_unittest_delegated.cc

Issue 69343011: cc: Rationalize sync points and lost status for returned resources (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « cc/resources/transferable_resource.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « cc/resources/transferable_resource.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698