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

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: Fix software compositing 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
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 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 EXPECT_EQ(2u, delegated_impl->Resources().size()); 1096 EXPECT_EQ(2u, delegated_impl->Resources().size());
1097 EXPECT_EQ(1u, delegated_impl->Resources().count(map.find(999)->second)); 1097 EXPECT_EQ(1u, delegated_impl->Resources().count(map.find(999)->second));
1098 EXPECT_EQ(1u, delegated_impl->Resources().count(map.find(555)->second)); 1098 EXPECT_EQ(1u, delegated_impl->Resources().count(map.find(555)->second));
1099 1099
1100 // The 999 resource is sent to a grandparent compositor. 1100 // The 999 resource is sent to a grandparent compositor.
1101 ResourceProvider::ResourceIdArray resources_for_parent; 1101 ResourceProvider::ResourceIdArray resources_for_parent;
1102 resources_for_parent.push_back(map.find(999)->second); 1102 resources_for_parent.push_back(map.find(999)->second);
1103 TransferableResourceArray transferable_resources; 1103 TransferableResourceArray transferable_resources;
1104 host_impl->resource_provider()->PrepareSendToParent( 1104 host_impl->resource_provider()->PrepareSendToParent(
1105 resources_for_parent, &transferable_resources); 1105 resources_for_parent, &transferable_resources);
1106
1107 resource_in_grandparent = transferable_resources[0];
1108 EXPECT_EQ(map.find(999)->second, resource_in_grandparent.id);
1106 break; 1109 break;
1107 } 1110 }
1108 case 2: { 1111 case 2: {
1109 EXPECT_EQ(2u, map.size()); 1112 EXPECT_EQ(2u, map.size());
1110 EXPECT_EQ(1u, map.count(999)); 1113 EXPECT_EQ(1u, map.count(999));
1111 EXPECT_EQ(1u, map.count(555)); 1114 EXPECT_EQ(1u, map.count(555));
1112 1115
1113 /// 999 is in the parent, so not held by delegated renderer layer. 1116 /// 999 is in the parent, so not held by delegated renderer layer.
1114 EXPECT_EQ(1u, delegated_impl->Resources().size()); 1117 EXPECT_EQ(1u, delegated_impl->Resources().size());
1115 EXPECT_EQ(1u, delegated_impl->Resources().count(map.find(555)->second)); 1118 EXPECT_EQ(1u, delegated_impl->Resources().count(map.find(555)->second));
1116 1119
1117 // Receive 999 back from the grandparent. 1120 // Receive 999 back from the grandparent.
1118 TransferableResource resource; 1121 EXPECT_EQ(map.find(999)->second, resource_in_grandparent.id);
1119 resource.id = map.find(999)->second;
1120 TransferableResourceArray transferable_resources; 1122 TransferableResourceArray transferable_resources;
1121 transferable_resources.push_back(resource); 1123 transferable_resources.push_back(resource_in_grandparent);
1124
1122 host_impl->resource_provider()->ReceiveFromParent( 1125 host_impl->resource_provider()->ReceiveFromParent(
1123 transferable_resources); 1126 transferable_resources);
1124 break; 1127 break;
1125 } 1128 }
1126 case 3: 1129 case 3:
1127 // 999 should be released. 1130 // 999 should be released.
1128 EXPECT_EQ(1u, map.size()); 1131 EXPECT_EQ(1u, map.size());
1129 EXPECT_EQ(1u, map.count(555)); 1132 EXPECT_EQ(1u, map.count(555));
1130 1133
1131 EXPECT_EQ(1u, delegated_impl->Resources().size()); 1134 EXPECT_EQ(1u, delegated_impl->Resources().size());
1132 EXPECT_EQ(1u, delegated_impl->Resources().count(map.find(555)->second)); 1135 EXPECT_EQ(1u, delegated_impl->Resources().count(map.find(555)->second));
1133 } 1136 }
1134 } 1137 }
1135 1138
1136 virtual void AfterTest() OVERRIDE {} 1139 virtual void AfterTest() OVERRIDE {}
1140
1141 TransferableResource resource_in_grandparent;
1137 }; 1142 };
1138 1143
1139 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestResourceSentToParent); 1144 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestResourceSentToParent);
1140 1145
1141 class LayerTreeHostDelegatedTestCommitWithoutTake 1146 class LayerTreeHostDelegatedTestCommitWithoutTake
1142 : public LayerTreeHostDelegatedTestCaseSingleDelegatedLayer { 1147 : public LayerTreeHostDelegatedTestCaseSingleDelegatedLayer {
1143 public: 1148 public:
1144 virtual void BeginTest() OVERRIDE { 1149 virtual void BeginTest() OVERRIDE {
1145 // Prevent drawing with resources that are sent to the grandparent. 1150 // Prevent drawing with resources that are sent to the grandparent.
1146 layer_tree_host()->SetViewportSize(gfx::Size(10, 10), gfx::Size()); 1151 layer_tree_host()->SetViewportSize(gfx::Size(10, 10), gfx::Size());
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 } 1237 }
1233 } 1238 }
1234 1239
1235 virtual void AfterTest() OVERRIDE {} 1240 virtual void AfterTest() OVERRIDE {}
1236 }; 1241 };
1237 1242
1238 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCommitWithoutTake); 1243 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCommitWithoutTake);
1239 1244
1240 } // namespace 1245 } // namespace
1241 } // namespace cc 1246 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698