OLD | NEW |
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/layers/picture_layer.h" | 5 #include "cc/layers/picture_layer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 ~TestSerializationPictureLayer() override {} | 122 ~TestSerializationPictureLayer() override {} |
123 | 123 |
124 gfx::Size recording_source_viewport_; | 124 gfx::Size recording_source_viewport_; |
125 | 125 |
126 DISALLOW_COPY_AND_ASSIGN(TestSerializationPictureLayer); | 126 DISALLOW_COPY_AND_ASSIGN(TestSerializationPictureLayer); |
127 }; | 127 }; |
128 | 128 |
129 namespace { | 129 namespace { |
130 | 130 |
131 TEST(PictureLayerTest, TestSetAllPropsSerializationDeserialization) { | 131 TEST(PictureLayerTest, TestSetAllPropsSerializationDeserialization) { |
132 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 132 FakeLayerTreeHostClient host_client; |
133 TestTaskGraphRunner task_graph_runner; | 133 TestTaskGraphRunner task_graph_runner; |
134 LayerTreeSettings settings; | 134 LayerTreeSettings settings; |
135 std::unique_ptr<FakeImageSerializationProcessor> | 135 std::unique_ptr<FakeImageSerializationProcessor> |
136 fake_image_serialization_processor = | 136 fake_image_serialization_processor = |
137 base::WrapUnique(new FakeImageSerializationProcessor); | 137 base::WrapUnique(new FakeImageSerializationProcessor); |
138 std::unique_ptr<FakeLayerTreeHost> host = | 138 std::unique_ptr<FakeLayerTreeHost> host = |
139 FakeLayerTreeHost::Create(&host_client, &task_graph_runner, settings, | 139 FakeLayerTreeHost::Create(&host_client, &task_graph_runner, settings, |
140 CompositorMode::SINGLE_THREADED, | 140 CompositorMode::SINGLE_THREADED, |
141 fake_image_serialization_processor.get()); | 141 fake_image_serialization_processor.get()); |
142 host->InitializePictureCacheForTesting(); | 142 host->InitializePictureCacheForTesting(); |
(...skipping 13 matching lines...) Expand all Loading... |
156 layer->recording_source()->SetDisplayListUsesCachedPicture(false); | 156 layer->recording_source()->SetDisplayListUsesCachedPicture(false); |
157 layer->recording_source()->add_draw_rect( | 157 layer->recording_source()->add_draw_rect( |
158 gfx::Rect(recording_source_viewport)); | 158 gfx::Rect(recording_source_viewport)); |
159 layer->recording_source()->SetGenerateDiscardableImagesMetadata(true); | 159 layer->recording_source()->SetGenerateDiscardableImagesMetadata(true); |
160 layer->recording_source()->Rerecord(); | 160 layer->recording_source()->Rerecord(); |
161 layer->ValidateSerialization(fake_image_serialization_processor.get(), | 161 layer->ValidateSerialization(fake_image_serialization_processor.get(), |
162 host.get()); | 162 host.get()); |
163 } | 163 } |
164 | 164 |
165 TEST(PictureLayerTest, TestSerializationDeserialization) { | 165 TEST(PictureLayerTest, TestSerializationDeserialization) { |
166 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 166 FakeLayerTreeHostClient host_client; |
167 TestTaskGraphRunner task_graph_runner; | 167 TestTaskGraphRunner task_graph_runner; |
168 std::unique_ptr<FakeImageSerializationProcessor> | 168 std::unique_ptr<FakeImageSerializationProcessor> |
169 fake_image_serialization_processor = | 169 fake_image_serialization_processor = |
170 base::WrapUnique(new FakeImageSerializationProcessor); | 170 base::WrapUnique(new FakeImageSerializationProcessor); |
171 std::unique_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create( | 171 std::unique_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create( |
172 &host_client, &task_graph_runner, LayerTreeSettings(), | 172 &host_client, &task_graph_runner, LayerTreeSettings(), |
173 CompositorMode::SINGLE_THREADED, | 173 CompositorMode::SINGLE_THREADED, |
174 fake_image_serialization_processor.get()); | 174 fake_image_serialization_processor.get()); |
175 host->InitializePictureCacheForTesting(); | 175 host->InitializePictureCacheForTesting(); |
176 | 176 |
(...skipping 10 matching lines...) Expand all Loading... |
187 layer->recording_source()->SetGenerateDiscardableImagesMetadata(true); | 187 layer->recording_source()->SetGenerateDiscardableImagesMetadata(true); |
188 layer->recording_source()->Rerecord(); | 188 layer->recording_source()->Rerecord(); |
189 layer->ValidateSerialization(fake_image_serialization_processor.get(), | 189 layer->ValidateSerialization(fake_image_serialization_processor.get(), |
190 host.get()); | 190 host.get()); |
191 } | 191 } |
192 | 192 |
193 TEST(PictureLayerTest, TestEmptySerializationDeserialization) { | 193 TEST(PictureLayerTest, TestEmptySerializationDeserialization) { |
194 std::unique_ptr<FakeImageSerializationProcessor> | 194 std::unique_ptr<FakeImageSerializationProcessor> |
195 fake_image_serialization_processor = | 195 fake_image_serialization_processor = |
196 base::WrapUnique(new FakeImageSerializationProcessor); | 196 base::WrapUnique(new FakeImageSerializationProcessor); |
197 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 197 FakeLayerTreeHostClient host_client; |
198 TestTaskGraphRunner task_graph_runner; | 198 TestTaskGraphRunner task_graph_runner; |
199 std::unique_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create( | 199 std::unique_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create( |
200 &host_client, &task_graph_runner, LayerTreeSettings(), | 200 &host_client, &task_graph_runner, LayerTreeSettings(), |
201 CompositorMode::SINGLE_THREADED, | 201 CompositorMode::SINGLE_THREADED, |
202 fake_image_serialization_processor.get()); | 202 fake_image_serialization_processor.get()); |
203 host->InitializePictureCacheForTesting(); | 203 host->InitializePictureCacheForTesting(); |
204 | 204 |
205 gfx::Size recording_source_viewport(256, 256); | 205 gfx::Size recording_source_viewport(256, 256); |
206 scoped_refptr<TestSerializationPictureLayer> layer = | 206 scoped_refptr<TestSerializationPictureLayer> layer = |
207 TestSerializationPictureLayer::Create(recording_source_viewport); | 207 TestSerializationPictureLayer::Create(recording_source_viewport); |
208 host->SetRootLayer(layer); | 208 host->SetRootLayer(layer); |
209 layer->ValidateSerialization(fake_image_serialization_processor.get(), | 209 layer->ValidateSerialization(fake_image_serialization_processor.get(), |
210 host.get()); | 210 host.get()); |
211 } | 211 } |
212 | 212 |
213 TEST(PictureLayerTest, NoTilesIfEmptyBounds) { | 213 TEST(PictureLayerTest, NoTilesIfEmptyBounds) { |
214 ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); | 214 ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); |
215 scoped_refptr<PictureLayer> layer = PictureLayer::Create(client); | 215 scoped_refptr<PictureLayer> layer = PictureLayer::Create(client); |
216 layer->SetBounds(gfx::Size(10, 10)); | 216 layer->SetBounds(gfx::Size(10, 10)); |
217 | 217 |
218 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 218 FakeLayerTreeHostClient host_client; |
219 TestTaskGraphRunner task_graph_runner; | 219 TestTaskGraphRunner task_graph_runner; |
220 std::unique_ptr<FakeLayerTreeHost> host = | 220 std::unique_ptr<FakeLayerTreeHost> host = |
221 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); | 221 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); |
222 host->SetRootLayer(layer); | 222 host->SetRootLayer(layer); |
223 layer->SetIsDrawable(true); | 223 layer->SetIsDrawable(true); |
224 layer->SavePaintProperties(); | 224 layer->SavePaintProperties(); |
225 layer->Update(); | 225 layer->Update(); |
226 | 226 |
227 EXPECT_EQ(0, host->source_frame_number()); | 227 EXPECT_EQ(0, host->source_frame_number()); |
228 host->CommitComplete(); | 228 host->CommitComplete(); |
(...skipping 25 matching lines...) Expand all Loading... |
254 EXPECT_FALSE(layer_impl->raster_source()->HasRecordings()); | 254 EXPECT_FALSE(layer_impl->raster_source()->HasRecordings()); |
255 } | 255 } |
256 | 256 |
257 TEST(PictureLayerTest, InvalidateRasterAfterUpdate) { | 257 TEST(PictureLayerTest, InvalidateRasterAfterUpdate) { |
258 gfx::Size layer_size(50, 50); | 258 gfx::Size layer_size(50, 50); |
259 FakeContentLayerClient client; | 259 FakeContentLayerClient client; |
260 client.set_bounds(layer_size); | 260 client.set_bounds(layer_size); |
261 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); | 261 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
262 layer->SetBounds(gfx::Size(50, 50)); | 262 layer->SetBounds(gfx::Size(50, 50)); |
263 | 263 |
264 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 264 FakeLayerTreeHostClient host_client; |
265 TestTaskGraphRunner task_graph_runner; | 265 TestTaskGraphRunner task_graph_runner; |
266 std::unique_ptr<FakeLayerTreeHost> host = | 266 std::unique_ptr<FakeLayerTreeHost> host = |
267 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); | 267 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); |
268 host->SetRootLayer(layer); | 268 host->SetRootLayer(layer); |
269 layer->SetIsDrawable(true); | 269 layer->SetIsDrawable(true); |
270 layer->SavePaintProperties(); | 270 layer->SavePaintProperties(); |
271 | 271 |
272 gfx::Rect invalidation_bounds(layer_size); | 272 gfx::Rect invalidation_bounds(layer_size); |
273 | 273 |
274 // The important two lines are the following: | 274 // The important two lines are the following: |
275 layer->SetNeedsDisplayRect(invalidation_bounds); | 275 layer->SetNeedsDisplayRect(invalidation_bounds); |
276 layer->Update(); | 276 layer->Update(); |
277 | 277 |
278 host->CommitComplete(); | 278 host->CommitComplete(); |
279 FakeImplTaskRunnerProvider impl_task_runner_provider; | 279 FakeImplTaskRunnerProvider impl_task_runner_provider; |
280 TestSharedBitmapManager shared_bitmap_manager; | 280 TestSharedBitmapManager shared_bitmap_manager; |
281 std::unique_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d()); | 281 std::unique_ptr<OutputSurface> output_surface( |
| 282 FakeOutputSurface::CreateDelegating3d()); |
282 LayerTreeSettings layer_tree_settings = LayerTreeSettings(); | 283 LayerTreeSettings layer_tree_settings = LayerTreeSettings(); |
283 layer_tree_settings.image_decode_tasks_enabled = true; | 284 layer_tree_settings.image_decode_tasks_enabled = true; |
284 FakeLayerTreeHostImpl host_impl(layer_tree_settings, | 285 FakeLayerTreeHostImpl host_impl(layer_tree_settings, |
285 &impl_task_runner_provider, | 286 &impl_task_runner_provider, |
286 &shared_bitmap_manager, &task_graph_runner); | 287 &shared_bitmap_manager, &task_graph_runner); |
287 host_impl.SetVisible(true); | 288 host_impl.SetVisible(true); |
288 host_impl.InitializeRenderer(output_surface.get()); | 289 host_impl.InitializeRenderer(output_surface.get()); |
289 host_impl.CreatePendingTree(); | 290 host_impl.CreatePendingTree(); |
290 host_impl.pending_tree()->SetRootLayerForTesting( | 291 host_impl.pending_tree()->SetRootLayerForTesting( |
291 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); | 292 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); |
292 host_impl.pending_tree()->BuildLayerListForTesting(); | 293 host_impl.pending_tree()->BuildLayerListForTesting(); |
293 FakePictureLayerImpl* layer_impl = static_cast<FakePictureLayerImpl*>( | 294 FakePictureLayerImpl* layer_impl = static_cast<FakePictureLayerImpl*>( |
294 host_impl.pending_tree()->root_layer_for_testing()); | 295 host_impl.pending_tree()->root_layer_for_testing()); |
295 layer->PushPropertiesTo(layer_impl); | 296 layer->PushPropertiesTo(layer_impl); |
296 | 297 |
297 EXPECT_EQ(invalidation_bounds, | 298 EXPECT_EQ(invalidation_bounds, |
298 layer_impl->GetPendingInvalidation()->bounds()); | 299 layer_impl->GetPendingInvalidation()->bounds()); |
299 } | 300 } |
300 | 301 |
301 TEST(PictureLayerTest, InvalidateRasterWithoutUpdate) { | 302 TEST(PictureLayerTest, InvalidateRasterWithoutUpdate) { |
302 gfx::Size layer_size(50, 50); | 303 gfx::Size layer_size(50, 50); |
303 FakeContentLayerClient client; | 304 FakeContentLayerClient client; |
304 client.set_bounds(layer_size); | 305 client.set_bounds(layer_size); |
305 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); | 306 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
306 layer->SetBounds(gfx::Size(50, 50)); | 307 layer->SetBounds(gfx::Size(50, 50)); |
307 | 308 |
308 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 309 FakeLayerTreeHostClient host_client; |
309 TestTaskGraphRunner task_graph_runner; | 310 TestTaskGraphRunner task_graph_runner; |
310 std::unique_ptr<FakeLayerTreeHost> host = | 311 std::unique_ptr<FakeLayerTreeHost> host = |
311 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); | 312 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); |
312 host->SetRootLayer(layer); | 313 host->SetRootLayer(layer); |
313 layer->SetIsDrawable(true); | 314 layer->SetIsDrawable(true); |
314 layer->SavePaintProperties(); | 315 layer->SavePaintProperties(); |
315 | 316 |
316 gfx::Rect invalidation_bounds(layer_size); | 317 gfx::Rect invalidation_bounds(layer_size); |
317 | 318 |
318 // The important line is the following (note that we do not call Update): | 319 // The important line is the following (note that we do not call Update): |
319 layer->SetNeedsDisplayRect(invalidation_bounds); | 320 layer->SetNeedsDisplayRect(invalidation_bounds); |
320 | 321 |
321 host->CommitComplete(); | 322 host->CommitComplete(); |
322 FakeImplTaskRunnerProvider impl_task_runner_provider; | 323 FakeImplTaskRunnerProvider impl_task_runner_provider; |
323 TestSharedBitmapManager shared_bitmap_manager; | 324 TestSharedBitmapManager shared_bitmap_manager; |
324 std::unique_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d()); | 325 std::unique_ptr<OutputSurface> output_surface( |
| 326 FakeOutputSurface::CreateDelegating3d()); |
325 LayerTreeSettings layer_tree_settings = LayerTreeSettings(); | 327 LayerTreeSettings layer_tree_settings = LayerTreeSettings(); |
326 layer_tree_settings.image_decode_tasks_enabled = true; | 328 layer_tree_settings.image_decode_tasks_enabled = true; |
327 FakeLayerTreeHostImpl host_impl(layer_tree_settings, | 329 FakeLayerTreeHostImpl host_impl(layer_tree_settings, |
328 &impl_task_runner_provider, | 330 &impl_task_runner_provider, |
329 &shared_bitmap_manager, &task_graph_runner); | 331 &shared_bitmap_manager, &task_graph_runner); |
330 host_impl.SetVisible(true); | 332 host_impl.SetVisible(true); |
331 host_impl.InitializeRenderer(output_surface.get()); | 333 host_impl.InitializeRenderer(output_surface.get()); |
332 host_impl.CreatePendingTree(); | 334 host_impl.CreatePendingTree(); |
333 host_impl.pending_tree()->SetRootLayerForTesting( | 335 host_impl.pending_tree()->SetRootLayerForTesting( |
334 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); | 336 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); |
335 host_impl.pending_tree()->BuildLayerListForTesting(); | 337 host_impl.pending_tree()->BuildLayerListForTesting(); |
336 FakePictureLayerImpl* layer_impl = static_cast<FakePictureLayerImpl*>( | 338 FakePictureLayerImpl* layer_impl = static_cast<FakePictureLayerImpl*>( |
337 host_impl.pending_tree()->root_layer_for_testing()); | 339 host_impl.pending_tree()->root_layer_for_testing()); |
338 layer->PushPropertiesTo(layer_impl); | 340 layer->PushPropertiesTo(layer_impl); |
339 | 341 |
340 EXPECT_EQ(gfx::Rect(), layer_impl->GetPendingInvalidation()->bounds()); | 342 EXPECT_EQ(gfx::Rect(), layer_impl->GetPendingInvalidation()->bounds()); |
341 } | 343 } |
342 | 344 |
343 TEST(PictureLayerTest, ClearVisibleRectWhenNoTiling) { | 345 TEST(PictureLayerTest, ClearVisibleRectWhenNoTiling) { |
344 gfx::Size layer_size(50, 50); | 346 gfx::Size layer_size(50, 50); |
345 FakeContentLayerClient client; | 347 FakeContentLayerClient client; |
346 client.set_bounds(layer_size); | 348 client.set_bounds(layer_size); |
347 client.add_draw_image(CreateDiscardableImage(layer_size), gfx::Point(), | 349 client.add_draw_image(CreateDiscardableImage(layer_size), gfx::Point(), |
348 SkPaint()); | 350 SkPaint()); |
349 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); | 351 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
350 layer->SetBounds(gfx::Size(10, 10)); | 352 layer->SetBounds(gfx::Size(10, 10)); |
351 | 353 |
352 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 354 FakeLayerTreeHostClient host_client; |
353 TestTaskGraphRunner task_graph_runner; | 355 TestTaskGraphRunner task_graph_runner; |
354 std::unique_ptr<FakeLayerTreeHost> host = | 356 std::unique_ptr<FakeLayerTreeHost> host = |
355 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); | 357 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); |
356 host->SetRootLayer(layer); | 358 host->SetRootLayer(layer); |
357 layer->SetIsDrawable(true); | 359 layer->SetIsDrawable(true); |
358 layer->SavePaintProperties(); | 360 layer->SavePaintProperties(); |
359 layer->Update(); | 361 layer->Update(); |
360 | 362 |
361 EXPECT_EQ(0, host->source_frame_number()); | 363 EXPECT_EQ(0, host->source_frame_number()); |
362 host->CommitComplete(); | 364 host->CommitComplete(); |
363 EXPECT_EQ(1, host->source_frame_number()); | 365 EXPECT_EQ(1, host->source_frame_number()); |
364 | 366 |
365 layer->SavePaintProperties(); | 367 layer->SavePaintProperties(); |
366 layer->Update(); | 368 layer->Update(); |
367 | 369 |
368 FakeImplTaskRunnerProvider impl_task_runner_provider; | 370 FakeImplTaskRunnerProvider impl_task_runner_provider; |
369 | 371 |
370 TestSharedBitmapManager shared_bitmap_manager; | 372 TestSharedBitmapManager shared_bitmap_manager; |
371 std::unique_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d()); | 373 std::unique_ptr<OutputSurface> output_surface( |
| 374 FakeOutputSurface::CreateDelegating3d()); |
372 LayerTreeSettings layer_tree_settings = LayerTreeSettingsForTesting(); | 375 LayerTreeSettings layer_tree_settings = LayerTreeSettingsForTesting(); |
373 layer_tree_settings.image_decode_tasks_enabled = true; | 376 layer_tree_settings.image_decode_tasks_enabled = true; |
374 FakeLayerTreeHostImpl host_impl(layer_tree_settings, | 377 FakeLayerTreeHostImpl host_impl(layer_tree_settings, |
375 &impl_task_runner_provider, | 378 &impl_task_runner_provider, |
376 &shared_bitmap_manager, &task_graph_runner); | 379 &shared_bitmap_manager, &task_graph_runner); |
377 host_impl.SetVisible(true); | 380 host_impl.SetVisible(true); |
378 EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get())); | 381 EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get())); |
379 | 382 |
380 host_impl.CreatePendingTree(); | 383 host_impl.CreatePendingTree(); |
381 host_impl.pending_tree()->SetRootLayerForTesting( | 384 host_impl.pending_tree()->SetRootLayerForTesting( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 TEST(PictureLayerTest, SuitableForGpuRasterization) { | 426 TEST(PictureLayerTest, SuitableForGpuRasterization) { |
424 std::unique_ptr<FakeRecordingSource> recording_source_owned( | 427 std::unique_ptr<FakeRecordingSource> recording_source_owned( |
425 new FakeRecordingSource); | 428 new FakeRecordingSource); |
426 FakeRecordingSource* recording_source = recording_source_owned.get(); | 429 FakeRecordingSource* recording_source = recording_source_owned.get(); |
427 | 430 |
428 ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); | 431 ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); |
429 scoped_refptr<FakePictureLayer> layer = | 432 scoped_refptr<FakePictureLayer> layer = |
430 FakePictureLayer::CreateWithRecordingSource( | 433 FakePictureLayer::CreateWithRecordingSource( |
431 client, std::move(recording_source_owned)); | 434 client, std::move(recording_source_owned)); |
432 | 435 |
433 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 436 FakeLayerTreeHostClient host_client; |
434 TestTaskGraphRunner task_graph_runner; | 437 TestTaskGraphRunner task_graph_runner; |
435 std::unique_ptr<FakeLayerTreeHost> host = | 438 std::unique_ptr<FakeLayerTreeHost> host = |
436 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); | 439 FakeLayerTreeHost::Create(&host_client, &task_graph_runner); |
437 host->SetRootLayer(layer); | 440 host->SetRootLayer(layer); |
438 | 441 |
439 // Update layers to initialize the recording source. | 442 // Update layers to initialize the recording source. |
440 gfx::Size layer_bounds(200, 200); | 443 gfx::Size layer_bounds(200, 200); |
441 gfx::Rect layer_rect(layer_bounds); | 444 gfx::Rect layer_rect(layer_bounds); |
442 Region invalidation(layer_rect); | 445 Region invalidation(layer_rect); |
443 recording_source->UpdateAndExpandInvalidation( | 446 recording_source->UpdateAndExpandInvalidation( |
(...skipping 13 matching lines...) Expand all Loading... |
457 // frequency. When a pile moves between compositors, the frame number increases | 460 // frequency. When a pile moves between compositors, the frame number increases |
458 // non-monotonically. This executes that code path under this scenario allowing | 461 // non-monotonically. This executes that code path under this scenario allowing |
459 // for the code to verify correctness with DCHECKs. | 462 // for the code to verify correctness with DCHECKs. |
460 TEST(PictureLayerTest, NonMonotonicSourceFrameNumber) { | 463 TEST(PictureLayerTest, NonMonotonicSourceFrameNumber) { |
461 LayerTreeSettings settings; | 464 LayerTreeSettings settings; |
462 settings.single_thread_proxy_scheduler = false; | 465 settings.single_thread_proxy_scheduler = false; |
463 settings.use_zero_copy = true; | 466 settings.use_zero_copy = true; |
464 settings.verify_clip_tree_calculations = true; | 467 settings.verify_clip_tree_calculations = true; |
465 settings.verify_transform_tree_calculations = true; | 468 settings.verify_transform_tree_calculations = true; |
466 | 469 |
467 FakeLayerTreeHostClient host_client1(FakeLayerTreeHostClient::DIRECT_3D); | 470 FakeLayerTreeHostClient host_client1; |
468 FakeLayerTreeHostClient host_client2(FakeLayerTreeHostClient::DIRECT_3D); | 471 FakeLayerTreeHostClient host_client2; |
469 TestSharedBitmapManager shared_bitmap_manager; | 472 TestSharedBitmapManager shared_bitmap_manager; |
470 TestTaskGraphRunner task_graph_runner; | 473 TestTaskGraphRunner task_graph_runner; |
471 | 474 |
472 ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); | 475 ContentLayerClient* client = EmptyContentLayerClient::GetInstance(); |
473 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(client); | 476 scoped_refptr<FakePictureLayer> layer = FakePictureLayer::Create(client); |
474 | 477 |
475 LayerTreeHost::InitParams params; | 478 LayerTreeHost::InitParams params; |
476 params.client = &host_client1; | 479 params.client = &host_client1; |
477 params.shared_bitmap_manager = &shared_bitmap_manager; | 480 params.shared_bitmap_manager = &shared_bitmap_manager; |
478 params.settings = &settings; | 481 params.settings = &settings; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 // Do a main frame, record the picture layers. The frame number has changed | 524 // Do a main frame, record the picture layers. The frame number has changed |
522 // non-monotonically. | 525 // non-monotonically. |
523 layer->SetNeedsDisplay(); | 526 layer->SetNeedsDisplay(); |
524 host2->Composite(base::TimeTicks::Now()); | 527 host2->Composite(base::TimeTicks::Now()); |
525 EXPECT_EQ(3, layer->update_count()); | 528 EXPECT_EQ(3, layer->update_count()); |
526 EXPECT_EQ(1, host2->source_frame_number()); | 529 EXPECT_EQ(1, host2->source_frame_number()); |
527 } | 530 } |
528 | 531 |
529 } // namespace | 532 } // namespace |
530 } // namespace cc | 533 } // namespace cc |
OLD | NEW |