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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 LayerTreeSettings layer_tree_settings = LayerTreeSettings(); | 282 LayerTreeSettings layer_tree_settings = LayerTreeSettings(); |
283 layer_tree_settings.image_decode_tasks_enabled = true; | 283 layer_tree_settings.image_decode_tasks_enabled = true; |
284 FakeLayerTreeHostImpl host_impl(layer_tree_settings, | 284 FakeLayerTreeHostImpl host_impl(layer_tree_settings, |
285 &impl_task_runner_provider, | 285 &impl_task_runner_provider, |
286 &shared_bitmap_manager, &task_graph_runner); | 286 &shared_bitmap_manager, &task_graph_runner); |
287 host_impl.SetVisible(true); | 287 host_impl.SetVisible(true); |
288 host_impl.InitializeRenderer(output_surface.get()); | 288 host_impl.InitializeRenderer(output_surface.get()); |
289 host_impl.CreatePendingTree(); | 289 host_impl.CreatePendingTree(); |
290 host_impl.pending_tree()->SetRootLayerForTesting( | 290 host_impl.pending_tree()->SetRootLayerForTesting( |
291 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); | 291 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); |
| 292 host_impl.pending_tree()->BuildLayerListForTesting(); |
292 FakePictureLayerImpl* layer_impl = static_cast<FakePictureLayerImpl*>( | 293 FakePictureLayerImpl* layer_impl = static_cast<FakePictureLayerImpl*>( |
293 host_impl.pending_tree()->root_layer_for_testing()); | 294 host_impl.pending_tree()->root_layer_for_testing()); |
294 layer->PushPropertiesTo(layer_impl); | 295 layer->PushPropertiesTo(layer_impl); |
295 | 296 |
296 EXPECT_EQ(invalidation_bounds, | 297 EXPECT_EQ(invalidation_bounds, |
297 layer_impl->GetPendingInvalidation()->bounds()); | 298 layer_impl->GetPendingInvalidation()->bounds()); |
298 } | 299 } |
299 | 300 |
300 TEST(PictureLayerTest, InvalidateRasterWithoutUpdate) { | 301 TEST(PictureLayerTest, InvalidateRasterWithoutUpdate) { |
301 gfx::Size layer_size(50, 50); | 302 gfx::Size layer_size(50, 50); |
(...skipping 22 matching lines...) Expand all Loading... |
324 LayerTreeSettings layer_tree_settings = LayerTreeSettings(); | 325 LayerTreeSettings layer_tree_settings = LayerTreeSettings(); |
325 layer_tree_settings.image_decode_tasks_enabled = true; | 326 layer_tree_settings.image_decode_tasks_enabled = true; |
326 FakeLayerTreeHostImpl host_impl(layer_tree_settings, | 327 FakeLayerTreeHostImpl host_impl(layer_tree_settings, |
327 &impl_task_runner_provider, | 328 &impl_task_runner_provider, |
328 &shared_bitmap_manager, &task_graph_runner); | 329 &shared_bitmap_manager, &task_graph_runner); |
329 host_impl.SetVisible(true); | 330 host_impl.SetVisible(true); |
330 host_impl.InitializeRenderer(output_surface.get()); | 331 host_impl.InitializeRenderer(output_surface.get()); |
331 host_impl.CreatePendingTree(); | 332 host_impl.CreatePendingTree(); |
332 host_impl.pending_tree()->SetRootLayerForTesting( | 333 host_impl.pending_tree()->SetRootLayerForTesting( |
333 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); | 334 FakePictureLayerImpl::Create(host_impl.pending_tree(), 1)); |
| 335 host_impl.pending_tree()->BuildLayerListForTesting(); |
334 FakePictureLayerImpl* layer_impl = static_cast<FakePictureLayerImpl*>( | 336 FakePictureLayerImpl* layer_impl = static_cast<FakePictureLayerImpl*>( |
335 host_impl.pending_tree()->root_layer_for_testing()); | 337 host_impl.pending_tree()->root_layer_for_testing()); |
336 layer->PushPropertiesTo(layer_impl); | 338 layer->PushPropertiesTo(layer_impl); |
337 | 339 |
338 EXPECT_EQ(gfx::Rect(), layer_impl->GetPendingInvalidation()->bounds()); | 340 EXPECT_EQ(gfx::Rect(), layer_impl->GetPendingInvalidation()->bounds()); |
339 } | 341 } |
340 | 342 |
341 TEST(PictureLayerTest, ClearVisibleRectWhenNoTiling) { | 343 TEST(PictureLayerTest, ClearVisibleRectWhenNoTiling) { |
342 gfx::Size layer_size(50, 50); | 344 gfx::Size layer_size(50, 50); |
343 FakeContentLayerClient client; | 345 FakeContentLayerClient client; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 // Do a main frame, record the picture layers. The frame number has changed | 522 // Do a main frame, record the picture layers. The frame number has changed |
521 // non-monotonically. | 523 // non-monotonically. |
522 layer->SetNeedsDisplay(); | 524 layer->SetNeedsDisplay(); |
523 host2->Composite(base::TimeTicks::Now()); | 525 host2->Composite(base::TimeTicks::Now()); |
524 EXPECT_EQ(3, layer->update_count()); | 526 EXPECT_EQ(3, layer->update_count()); |
525 EXPECT_EQ(1, host2->source_frame_number()); | 527 EXPECT_EQ(1, host2->source_frame_number()); |
526 } | 528 } |
527 | 529 |
528 } // namespace | 530 } // namespace |
529 } // namespace cc | 531 } // namespace cc |
OLD | NEW |