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

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

Issue 13445009: cc: Move video upload to VideoResourceUpdater. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: consume textures that were produced Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « cc/test/test_web_graphics_context_3d.cc ('k') | content/common/cc_messages.h » ('j') | 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 "cc/layers/delegated_renderer_layer.h" 7 #include "cc/layers/delegated_renderer_layer.h"
8 #include "cc/layers/delegated_renderer_layer_impl.h" 8 #include "cc/layers/delegated_renderer_layer_impl.h"
9 #include "cc/output/delegated_frame_data.h" 9 #include "cc/output/delegated_frame_data.h"
10 #include "cc/quads/shared_quad_state.h" 10 #include "cc/quads/shared_quad_state.h"
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 EXPECT_EQ(2u, delegated_impl->Resources().size()); 1102 EXPECT_EQ(2u, delegated_impl->Resources().size());
1103 EXPECT_EQ(1u, delegated_impl->Resources().count(map.find(999)->second)); 1103 EXPECT_EQ(1u, delegated_impl->Resources().count(map.find(999)->second));
1104 EXPECT_EQ(1u, delegated_impl->Resources().count(map.find(555)->second)); 1104 EXPECT_EQ(1u, delegated_impl->Resources().count(map.find(555)->second));
1105 1105
1106 // The 999 resource is sent to a grandparent compositor. 1106 // The 999 resource is sent to a grandparent compositor.
1107 ResourceProvider::ResourceIdArray resources_for_parent; 1107 ResourceProvider::ResourceIdArray resources_for_parent;
1108 resources_for_parent.push_back(map.find(999)->second); 1108 resources_for_parent.push_back(map.find(999)->second);
1109 TransferableResourceArray transferable_resources; 1109 TransferableResourceArray transferable_resources;
1110 host_impl->resource_provider()->PrepareSendToParent( 1110 host_impl->resource_provider()->PrepareSendToParent(
1111 resources_for_parent, &transferable_resources); 1111 resources_for_parent, &transferable_resources);
1112
1113 resource_in_grandparent = transferable_resources[0];
1114 EXPECT_EQ(map.find(999)->second, resource_in_grandparent.id);
1112 break; 1115 break;
1113 } 1116 }
1114 case 2: { 1117 case 2: {
1115 EXPECT_EQ(2u, map.size()); 1118 EXPECT_EQ(2u, map.size());
1116 EXPECT_EQ(1u, map.count(999)); 1119 EXPECT_EQ(1u, map.count(999));
1117 EXPECT_EQ(1u, map.count(555)); 1120 EXPECT_EQ(1u, map.count(555));
1118 1121
1119 /// 999 is in the parent, so not held by delegated renderer layer. 1122 /// 999 is in the parent, so not held by delegated renderer layer.
1120 EXPECT_EQ(1u, delegated_impl->Resources().size()); 1123 EXPECT_EQ(1u, delegated_impl->Resources().size());
1121 EXPECT_EQ(1u, delegated_impl->Resources().count(map.find(555)->second)); 1124 EXPECT_EQ(1u, delegated_impl->Resources().count(map.find(555)->second));
1122 1125
1123 // Receive 999 back from the grandparent. 1126 // Receive 999 back from the grandparent.
1124 TransferableResource resource; 1127 EXPECT_EQ(map.find(999)->second, resource_in_grandparent.id);
1125 resource.id = map.find(999)->second;
1126 TransferableResourceArray transferable_resources; 1128 TransferableResourceArray transferable_resources;
1127 transferable_resources.push_back(resource); 1129 transferable_resources.push_back(resource_in_grandparent);
1130
1128 host_impl->resource_provider()->ReceiveFromParent( 1131 host_impl->resource_provider()->ReceiveFromParent(
1129 transferable_resources); 1132 transferable_resources);
1130 break; 1133 break;
1131 } 1134 }
1132 case 3: 1135 case 3:
1133 // 999 should be released. 1136 // 999 should be released.
1134 EXPECT_EQ(1u, map.size()); 1137 EXPECT_EQ(1u, map.size());
1135 EXPECT_EQ(1u, map.count(555)); 1138 EXPECT_EQ(1u, map.count(555));
1136 1139
1137 EXPECT_EQ(1u, delegated_impl->Resources().size()); 1140 EXPECT_EQ(1u, delegated_impl->Resources().size());
1138 EXPECT_EQ(1u, delegated_impl->Resources().count(map.find(555)->second)); 1141 EXPECT_EQ(1u, delegated_impl->Resources().count(map.find(555)->second));
1139 } 1142 }
1140 } 1143 }
1141 1144
1142 virtual void AfterTest() OVERRIDE {} 1145 virtual void AfterTest() OVERRIDE {}
1146
1147 TransferableResource resource_in_grandparent;
1143 }; 1148 };
1144 1149
1145 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestResourceSentToParent); 1150 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestResourceSentToParent);
1146 1151
1147 class LayerTreeHostDelegatedTestCommitWithoutTake 1152 class LayerTreeHostDelegatedTestCommitWithoutTake
1148 : public LayerTreeHostDelegatedTestCaseSingleDelegatedLayer { 1153 : public LayerTreeHostDelegatedTestCaseSingleDelegatedLayer {
1149 public: 1154 public:
1150 virtual void BeginTest() OVERRIDE { 1155 virtual void BeginTest() OVERRIDE {
1151 // Prevent drawing with resources that are sent to the grandparent. 1156 // Prevent drawing with resources that are sent to the grandparent.
1152 layer_tree_host()->SetViewportSize(gfx::Size(10, 10), gfx::Size()); 1157 layer_tree_host()->SetViewportSize(gfx::Size(10, 10), gfx::Size());
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 } 1243 }
1239 } 1244 }
1240 1245
1241 virtual void AfterTest() OVERRIDE {} 1246 virtual void AfterTest() OVERRIDE {}
1242 }; 1247 };
1243 1248
1244 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCommitWithoutTake); 1249 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCommitWithoutTake);
1245 1250
1246 } // namespace 1251 } // namespace
1247 } // namespace cc 1252 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/test_web_graphics_context_3d.cc ('k') | content/common/cc_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698