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

Side by Side Diff: cc/layers/surface_layer_unittest.cc

Issue 2905533002: cc : Store surface layer ids on LayerTreeHost and push them at commit (Closed)
Patch Set: comments Created 3 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // Verify tha the primary SurfaceInfo is pushed through and that there is 166 // Verify tha the primary SurfaceInfo is pushed through and that there is
167 // no valid fallback SurfaceInfo. 167 // no valid fallback SurfaceInfo.
168 EXPECT_EQ(primary_info, layer_impl->primary_surface_info()); 168 EXPECT_EQ(primary_info, layer_impl->primary_surface_info());
169 EXPECT_EQ(SurfaceInfo(), layer_impl->fallback_surface_info()); 169 EXPECT_EQ(SurfaceInfo(), layer_impl->fallback_surface_info());
170 170
171 SurfaceInfo fallback_info( 171 SurfaceInfo fallback_info(
172 SurfaceId(kArbitraryFrameSinkId, 172 SurfaceId(kArbitraryFrameSinkId,
173 LocalSurfaceId(2, base::UnguessableToken::Create())), 173 LocalSurfaceId(2, base::UnguessableToken::Create())),
174 2.f, gfx::Size(10, 10)); 174 2.f, gfx::Size(10, 10));
175 layer->SetFallbackSurfaceInfo(fallback_info); 175 layer->SetFallbackSurfaceInfo(fallback_info);
176 layer->PushPropertiesTo(layer_impl.get()); 176
177 // Verify that surface layer ids are recorded on the layer tree host and need
178 // to be pushed.
179 EXPECT_TRUE(layer_tree_host_->needs_surface_ids_sync());
180 EXPECT_EQ(layer_tree_host_->SurfaceLayerIds().size(), 1u);
181
182 // Verify that pending tree has no surface ids already.
183 EXPECT_FALSE(host_impl_.pending_tree()->needs_surface_ids_sync());
184 EXPECT_EQ(host_impl_.pending_tree()->SurfaceLayerIds().size(), 0u);
185
186 TreeSynchronizer::PushLayerProperties(layer_tree_host_.get(),
187 host_impl_.pending_tree());
188
189 // Verify that pending tree received the surface ids and also has
190 // needs_surface_ids_sync set to true as it needs to sync with active tree.
191 EXPECT_TRUE(host_impl_.pending_tree()->needs_surface_ids_sync());
192 EXPECT_EQ(host_impl_.pending_tree()->SurfaceLayerIds().size(), 1u);
193
194 // Verify we have reset the state on layer tree host.
195 EXPECT_FALSE(layer_tree_host_->needs_surface_ids_sync());
177 196
178 // Verify that the primary SurfaceInfo stays the same and the new fallback 197 // Verify that the primary SurfaceInfo stays the same and the new fallback
179 // SurfaceInfo is pushed through. 198 // SurfaceInfo is pushed through.
180 EXPECT_EQ(primary_info, layer_impl->primary_surface_info()); 199 EXPECT_EQ(primary_info, layer_impl->primary_surface_info());
181 EXPECT_EQ(fallback_info, layer_impl->fallback_surface_info()); 200 EXPECT_EQ(fallback_info, layer_impl->fallback_surface_info());
182 } 201 }
183 202
184 // Check that SurfaceSequence is sent through swap promise. 203 // Check that SurfaceSequence is sent through swap promise.
185 class SurfaceLayerSwapPromise : public LayerTreeTest { 204 class SurfaceLayerSwapPromise : public LayerTreeTest {
186 public: 205 public:
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 EndTest(); 317 EndTest();
299 break; 318 break;
300 } 319 }
301 } 320 }
302 }; 321 };
303 322
304 MULTI_THREAD_TEST_F(SurfaceLayerSwapPromiseWithoutDraw); 323 MULTI_THREAD_TEST_F(SurfaceLayerSwapPromiseWithoutDraw);
305 324
306 } // namespace 325 } // namespace
307 } // namespace cc 326 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698