| 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_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
| 14 #include "cc/base/math_util.h" | 14 #include "cc/base/math_util.h" |
| 15 #include "cc/layers/append_quads_data.h" | 15 #include "cc/layers/append_quads_data.h" |
| 16 #include "cc/layers/picture_layer.h" | 16 #include "cc/layers/picture_layer.h" |
| 17 #include "cc/quads/draw_quad.h" | 17 #include "cc/quads/draw_quad.h" |
| 18 #include "cc/quads/tile_draw_quad.h" | 18 #include "cc/quads/tile_draw_quad.h" |
| 19 #include "cc/test/begin_frame_args_test.h" | 19 #include "cc/test/begin_frame_args_test.h" |
| 20 #include "cc/test/fake_content_layer_client.h" | 20 #include "cc/test/fake_content_layer_client.h" |
| 21 #include "cc/test/fake_display_list_raster_source.h" | 21 #include "cc/test/fake_display_list_raster_source.h" |
| 22 #include "cc/test/fake_display_list_recording_source.h" | 22 #include "cc/test/fake_display_list_recording_source.h" |
| 23 #include "cc/test/fake_impl_proxy.h" | 23 #include "cc/test/fake_impl_task_runner_provider.h" |
| 24 #include "cc/test/fake_layer_tree_host_impl.h" | 24 #include "cc/test/fake_layer_tree_host_impl.h" |
| 25 #include "cc/test/fake_output_surface.h" | 25 #include "cc/test/fake_output_surface.h" |
| 26 #include "cc/test/fake_picture_layer_impl.h" | 26 #include "cc/test/fake_picture_layer_impl.h" |
| 27 #include "cc/test/geometry_test_utils.h" | 27 #include "cc/test/geometry_test_utils.h" |
| 28 #include "cc/test/gpu_rasterization_enabled_settings.h" | 28 #include "cc/test/gpu_rasterization_enabled_settings.h" |
| 29 #include "cc/test/layer_test_common.h" | 29 #include "cc/test/layer_test_common.h" |
| 30 #include "cc/test/test_shared_bitmap_manager.h" | 30 #include "cc/test/test_shared_bitmap_manager.h" |
| 31 #include "cc/test/test_task_graph_runner.h" | 31 #include "cc/test/test_task_graph_runner.h" |
| 32 #include "cc/test/test_web_graphics_context_3d.h" | 32 #include "cc/test/test_web_graphics_context_3d.h" |
| 33 #include "cc/tiles/tiling_set_raster_queue_all.h" | 33 #include "cc/tiles/tiling_set_raster_queue_all.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 class NoLowResTilingsSettings : public PictureLayerImplTestSettings {}; | 86 class NoLowResTilingsSettings : public PictureLayerImplTestSettings {}; |
| 87 | 87 |
| 88 class LowResTilingsSettings : public PictureLayerImplTestSettings { | 88 class LowResTilingsSettings : public PictureLayerImplTestSettings { |
| 89 public: | 89 public: |
| 90 LowResTilingsSettings() { create_low_res_tiling = true; } | 90 LowResTilingsSettings() { create_low_res_tiling = true; } |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 class PictureLayerImplTest : public testing::Test { | 93 class PictureLayerImplTest : public testing::Test { |
| 94 public: | 94 public: |
| 95 PictureLayerImplTest() | 95 PictureLayerImplTest() |
| 96 : proxy_(base::ThreadTaskRunnerHandle::Get()), | 96 : task_runner_provider_(base::ThreadTaskRunnerHandle::Get()), |
| 97 output_surface_(FakeOutputSurface::Create3d()), | 97 output_surface_(FakeOutputSurface::Create3d()), |
| 98 host_impl_(LowResTilingsSettings(), | 98 host_impl_(LowResTilingsSettings(), |
| 99 &proxy_, | 99 &task_runner_provider_, |
| 100 &shared_bitmap_manager_, | 100 &shared_bitmap_manager_, |
| 101 &task_graph_runner_), | 101 &task_graph_runner_), |
| 102 root_id_(6), | 102 root_id_(6), |
| 103 id_(7), | 103 id_(7), |
| 104 pending_layer_(nullptr), | 104 pending_layer_(nullptr), |
| 105 old_pending_layer_(nullptr), | 105 old_pending_layer_(nullptr), |
| 106 active_layer_(nullptr) { | 106 active_layer_(nullptr) { |
| 107 host_impl_.SetViewportSize(gfx::Size(10000, 10000)); | 107 host_impl_.SetViewportSize(gfx::Size(10000, 10000)); |
| 108 } | 108 } |
| 109 | 109 |
| 110 explicit PictureLayerImplTest(const LayerTreeSettings& settings) | 110 explicit PictureLayerImplTest(const LayerTreeSettings& settings) |
| 111 : proxy_(base::ThreadTaskRunnerHandle::Get()), | 111 : task_runner_provider_(base::ThreadTaskRunnerHandle::Get()), |
| 112 output_surface_(FakeOutputSurface::Create3d()), | 112 output_surface_(FakeOutputSurface::Create3d()), |
| 113 host_impl_(settings, | 113 host_impl_(settings, |
| 114 &proxy_, | 114 &task_runner_provider_, |
| 115 &shared_bitmap_manager_, | 115 &shared_bitmap_manager_, |
| 116 &task_graph_runner_), | 116 &task_graph_runner_), |
| 117 root_id_(6), | 117 root_id_(6), |
| 118 id_(7) { | 118 id_(7) { |
| 119 host_impl_.SetViewportSize(gfx::Size(10000, 10000)); | 119 host_impl_.SetViewportSize(gfx::Size(10000, 10000)); |
| 120 } | 120 } |
| 121 | 121 |
| 122 ~PictureLayerImplTest() override {} | 122 ~PictureLayerImplTest() override {} |
| 123 | 123 |
| 124 void SetUp() override { InitializeRenderer(); } | 124 void SetUp() override { InitializeRenderer(); } |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 // created, and setting it after SetupPendingTreeInternal is too late, since | 364 // created, and setting it after SetupPendingTreeInternal is too late, since |
| 365 // draw properties will already have been updated on the tree. To handle | 365 // draw properties will already have been updated on the tree. To handle |
| 366 // this, we initially set only the active tree's device scale factor, and we | 366 // this, we initially set only the active tree's device scale factor, and we |
| 367 // copy this over to the pending tree inside SetupPendingTreeInternal. | 367 // copy this over to the pending tree inside SetupPendingTreeInternal. |
| 368 host_impl_.active_tree()->SetDeviceScaleFactor(device_scale_factor); | 368 host_impl_.active_tree()->SetDeviceScaleFactor(device_scale_factor); |
| 369 } | 369 } |
| 370 | 370 |
| 371 protected: | 371 protected: |
| 372 void TestQuadsForSolidColor(bool test_for_solid); | 372 void TestQuadsForSolidColor(bool test_for_solid); |
| 373 | 373 |
| 374 FakeImplProxy proxy_; | 374 FakeImplTaskRunnerProvider task_runner_provider_; |
| 375 TestSharedBitmapManager shared_bitmap_manager_; | 375 TestSharedBitmapManager shared_bitmap_manager_; |
| 376 TestTaskGraphRunner task_graph_runner_; | 376 TestTaskGraphRunner task_graph_runner_; |
| 377 scoped_ptr<OutputSurface> output_surface_; | 377 scoped_ptr<OutputSurface> output_surface_; |
| 378 FakeLayerTreeHostImpl host_impl_; | 378 FakeLayerTreeHostImpl host_impl_; |
| 379 int root_id_; | 379 int root_id_; |
| 380 int id_; | 380 int id_; |
| 381 FakePictureLayerImpl* pending_layer_; | 381 FakePictureLayerImpl* pending_layer_; |
| 382 FakePictureLayerImpl* old_pending_layer_; | 382 FakePictureLayerImpl* old_pending_layer_; |
| 383 FakePictureLayerImpl* active_layer_; | 383 FakePictureLayerImpl* active_layer_; |
| 384 LayerSettings layer_settings_; | 384 LayerSettings layer_settings_; |
| (...skipping 4641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5026 // New low res tiling. | 5026 // New low res tiling. |
| 5027 EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles()); | 5027 EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles()); |
| 5028 | 5028 |
| 5029 // This tiling will be high res now, it won't contain low res content since it | 5029 // This tiling will be high res now, it won't contain low res content since it |
| 5030 // was all destroyed. | 5030 // was all destroyed. |
| 5031 EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles()); | 5031 EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles()); |
| 5032 } | 5032 } |
| 5033 | 5033 |
| 5034 } // namespace | 5034 } // namespace |
| 5035 } // namespace cc | 5035 } // namespace cc |
| OLD | NEW |