OLD | NEW |
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 new testing::NiceMock<MockSurfaceReferenceFactory>(); | 152 new testing::NiceMock<MockSurfaceReferenceFactory>(); |
153 | 153 |
154 scoped_refptr<SurfaceLayer> layer = SurfaceLayer::Create(ref_factory); | 154 scoped_refptr<SurfaceLayer> layer = SurfaceLayer::Create(ref_factory); |
155 layer_tree_host_->SetRootLayer(layer); | 155 layer_tree_host_->SetRootLayer(layer); |
156 SurfaceInfo primary_info( | 156 SurfaceInfo primary_info( |
157 SurfaceId(kArbitraryFrameSinkId, | 157 SurfaceId(kArbitraryFrameSinkId, |
158 LocalSurfaceId(1, base::UnguessableToken::Create())), | 158 LocalSurfaceId(1, base::UnguessableToken::Create())), |
159 1.f, gfx::Size(1, 1)); | 159 1.f, gfx::Size(1, 1)); |
160 layer->SetPrimarySurfaceInfo(primary_info); | 160 layer->SetPrimarySurfaceInfo(primary_info); |
161 | 161 |
| 162 // Verify that the primary surface id is recorded on the layer tree host and |
| 163 // needs to be pushed. |
| 164 EXPECT_TRUE(layer_tree_host_->needs_surface_ids_sync()); |
| 165 EXPECT_EQ(layer_tree_host_->SurfaceLayerIds().size(), 1u); |
| 166 |
| 167 // Verify that pending tree has no surface ids already. |
| 168 EXPECT_FALSE(host_impl_.pending_tree()->needs_surface_ids_sync()); |
| 169 EXPECT_EQ(host_impl_.pending_tree()->SurfaceLayerIds().size(), 0u); |
| 170 |
162 std::unique_ptr<SurfaceLayerImpl> layer_impl = | 171 std::unique_ptr<SurfaceLayerImpl> layer_impl = |
163 SurfaceLayerImpl::Create(host_impl_.pending_tree(), layer->id()); | 172 SurfaceLayerImpl::Create(host_impl_.pending_tree(), layer->id()); |
164 layer->PushPropertiesTo(layer_impl.get()); | 173 TreeSynchronizer::PushLayerProperties(layer_tree_host_.get(), |
| 174 host_impl_.pending_tree()); |
| 175 layer_tree_host_->PushSurfaceIdsTo(host_impl_.pending_tree()); |
165 | 176 |
166 // Verify tha the primary SurfaceInfo is pushed through and that there is | 177 // Verify that pending tree received the primary surface id and also has |
| 178 // needs_surface_ids_sync set to true as it needs to sync with active tree. |
| 179 EXPECT_TRUE(host_impl_.pending_tree()->needs_surface_ids_sync()); |
| 180 EXPECT_EQ(host_impl_.pending_tree()->SurfaceLayerIds().size(), 1u); |
| 181 |
| 182 // Verify we have reset the state on layer tree host. |
| 183 EXPECT_FALSE(layer_tree_host_->needs_surface_ids_sync()); |
| 184 |
| 185 // Verify that the primary SurfaceInfo is pushed through and that there is |
167 // no valid fallback SurfaceInfo. | 186 // no valid fallback SurfaceInfo. |
168 EXPECT_EQ(primary_info, layer_impl->primary_surface_info()); | 187 EXPECT_EQ(primary_info, layer_impl->primary_surface_info()); |
169 EXPECT_EQ(SurfaceInfo(), layer_impl->fallback_surface_info()); | 188 EXPECT_EQ(SurfaceInfo(), layer_impl->fallback_surface_info()); |
170 | 189 |
171 SurfaceInfo fallback_info( | 190 SurfaceInfo fallback_info( |
172 SurfaceId(kArbitraryFrameSinkId, | 191 SurfaceId(kArbitraryFrameSinkId, |
173 LocalSurfaceId(2, base::UnguessableToken::Create())), | 192 LocalSurfaceId(2, base::UnguessableToken::Create())), |
174 2.f, gfx::Size(10, 10)); | 193 2.f, gfx::Size(10, 10)); |
175 layer->SetFallbackSurfaceInfo(fallback_info); | 194 layer->SetFallbackSurfaceInfo(fallback_info); |
176 layer->PushPropertiesTo(layer_impl.get()); | 195 |
| 196 // Verify that fallback surface id is recorded on the layer tree host and need |
| 197 // to be pushed. |
| 198 EXPECT_TRUE(layer_tree_host_->needs_surface_ids_sync()); |
| 199 EXPECT_EQ(layer_tree_host_->SurfaceLayerIds().size(), 2u); |
| 200 |
| 201 // Verify that pending tree has only primary surface id. |
| 202 EXPECT_EQ(host_impl_.pending_tree()->SurfaceLayerIds().size(), 1u); |
| 203 |
| 204 TreeSynchronizer::PushLayerProperties(layer_tree_host_.get(), |
| 205 host_impl_.pending_tree()); |
| 206 layer_tree_host_->PushSurfaceIdsTo(host_impl_.pending_tree()); |
| 207 |
| 208 // Verify that pending tree received the fallback surface id and also has |
| 209 // needs_surface_ids_sync set to true as it needs to sync with active tree. |
| 210 EXPECT_TRUE(host_impl_.pending_tree()->needs_surface_ids_sync()); |
| 211 EXPECT_EQ(host_impl_.pending_tree()->SurfaceLayerIds().size(), 2u); |
| 212 |
| 213 // Verify we have reset the state on layer tree host. |
| 214 EXPECT_FALSE(layer_tree_host_->needs_surface_ids_sync()); |
177 | 215 |
178 // Verify that the primary SurfaceInfo stays the same and the new fallback | 216 // Verify that the primary SurfaceInfo stays the same and the new fallback |
179 // SurfaceInfo is pushed through. | 217 // SurfaceInfo is pushed through. |
180 EXPECT_EQ(primary_info, layer_impl->primary_surface_info()); | 218 EXPECT_EQ(primary_info, layer_impl->primary_surface_info()); |
181 EXPECT_EQ(fallback_info, layer_impl->fallback_surface_info()); | 219 EXPECT_EQ(fallback_info, layer_impl->fallback_surface_info()); |
182 } | 220 } |
183 | 221 |
184 // Check that SurfaceSequence is sent through swap promise. | 222 // Check that SurfaceSequence is sent through swap promise. |
185 class SurfaceLayerSwapPromise : public LayerTreeTest { | 223 class SurfaceLayerSwapPromise : public LayerTreeTest { |
186 public: | 224 public: |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 EndTest(); | 336 EndTest(); |
299 break; | 337 break; |
300 } | 338 } |
301 } | 339 } |
302 }; | 340 }; |
303 | 341 |
304 MULTI_THREAD_TEST_F(SurfaceLayerSwapPromiseWithoutDraw); | 342 MULTI_THREAD_TEST_F(SurfaceLayerSwapPromiseWithoutDraw); |
305 | 343 |
306 } // namespace | 344 } // namespace |
307 } // namespace cc | 345 } // namespace cc |
OLD | NEW |