| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 #include "cc/output/copy_output_request.h" | 40 #include "cc/output/copy_output_request.h" |
| 41 #include "cc/output/copy_output_result.h" | 41 #include "cc/output/copy_output_result.h" |
| 42 #include "cc/output/gl_renderer.h" | 42 #include "cc/output/gl_renderer.h" |
| 43 #include "cc/output/latency_info_swap_promise.h" | 43 #include "cc/output/latency_info_swap_promise.h" |
| 44 #include "cc/quads/render_pass_draw_quad.h" | 44 #include "cc/quads/render_pass_draw_quad.h" |
| 45 #include "cc/quads/solid_color_draw_quad.h" | 45 #include "cc/quads/solid_color_draw_quad.h" |
| 46 #include "cc/quads/texture_draw_quad.h" | 46 #include "cc/quads/texture_draw_quad.h" |
| 47 #include "cc/quads/tile_draw_quad.h" | 47 #include "cc/quads/tile_draw_quad.h" |
| 48 #include "cc/test/animation_test_common.h" | 48 #include "cc/test/animation_test_common.h" |
| 49 #include "cc/test/begin_frame_args_test.h" | 49 #include "cc/test/begin_frame_args_test.h" |
| 50 #include "cc/test/fake_display_list_raster_source.h" | |
| 51 #include "cc/test/fake_layer_tree_host_impl.h" | 50 #include "cc/test/fake_layer_tree_host_impl.h" |
| 52 #include "cc/test/fake_mask_layer_impl.h" | 51 #include "cc/test/fake_mask_layer_impl.h" |
| 53 #include "cc/test/fake_output_surface.h" | 52 #include "cc/test/fake_output_surface.h" |
| 54 #include "cc/test/fake_output_surface_client.h" | 53 #include "cc/test/fake_output_surface_client.h" |
| 55 #include "cc/test/fake_picture_layer_impl.h" | 54 #include "cc/test/fake_picture_layer_impl.h" |
| 55 #include "cc/test/fake_raster_source.h" |
| 56 #include "cc/test/fake_video_frame_provider.h" | 56 #include "cc/test/fake_video_frame_provider.h" |
| 57 #include "cc/test/geometry_test_utils.h" | 57 #include "cc/test/geometry_test_utils.h" |
| 58 #include "cc/test/gpu_rasterization_enabled_settings.h" | 58 #include "cc/test/gpu_rasterization_enabled_settings.h" |
| 59 #include "cc/test/layer_test_common.h" | 59 #include "cc/test/layer_test_common.h" |
| 60 #include "cc/test/layer_tree_test.h" | 60 #include "cc/test/layer_tree_test.h" |
| 61 #include "cc/test/test_gpu_memory_buffer_manager.h" | 61 #include "cc/test/test_gpu_memory_buffer_manager.h" |
| 62 #include "cc/test/test_shared_bitmap_manager.h" | 62 #include "cc/test/test_shared_bitmap_manager.h" |
| 63 #include "cc/test/test_task_graph_runner.h" | 63 #include "cc/test/test_task_graph_runner.h" |
| 64 #include "cc/test/test_web_graphics_context_3d.h" | 64 #include "cc/test/test_web_graphics_context_3d.h" |
| 65 #include "cc/trees/layer_tree_impl.h" | 65 #include "cc/trees/layer_tree_impl.h" |
| (...skipping 7217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7283 root->SetForceRenderSurface(true); | 7283 root->SetForceRenderSurface(true); |
| 7284 | 7284 |
| 7285 host_impl_->pending_tree()->SetRootLayer(std::move(scoped_root)); | 7285 host_impl_->pending_tree()->SetRootLayer(std::move(scoped_root)); |
| 7286 | 7286 |
| 7287 scoped_ptr<LayerImpl> scoped_scrolling_layer = | 7287 scoped_ptr<LayerImpl> scoped_scrolling_layer = |
| 7288 LayerImpl::Create(host_impl_->pending_tree(), 2); | 7288 LayerImpl::Create(host_impl_->pending_tree(), 2); |
| 7289 LayerImpl* scrolling_layer = scoped_scrolling_layer.get(); | 7289 LayerImpl* scrolling_layer = scoped_scrolling_layer.get(); |
| 7290 root->AddChild(std::move(scoped_scrolling_layer)); | 7290 root->AddChild(std::move(scoped_scrolling_layer)); |
| 7291 | 7291 |
| 7292 gfx::Size content_layer_bounds(100000, 100); | 7292 gfx::Size content_layer_bounds(100000, 100); |
| 7293 scoped_refptr<FakeDisplayListRasterSource> raster_source( | 7293 scoped_refptr<FakeRasterSource> raster_source( |
| 7294 FakeDisplayListRasterSource::CreateFilled(content_layer_bounds)); | 7294 FakeRasterSource::CreateFilled(content_layer_bounds)); |
| 7295 | 7295 |
| 7296 scoped_ptr<FakePictureLayerImpl> scoped_content_layer = | 7296 scoped_ptr<FakePictureLayerImpl> scoped_content_layer = |
| 7297 FakePictureLayerImpl::CreateWithRasterSource(host_impl_->pending_tree(), | 7297 FakePictureLayerImpl::CreateWithRasterSource(host_impl_->pending_tree(), |
| 7298 3, raster_source); | 7298 3, raster_source); |
| 7299 LayerImpl* content_layer = scoped_content_layer.get(); | 7299 LayerImpl* content_layer = scoped_content_layer.get(); |
| 7300 scrolling_layer->AddChild(std::move(scoped_content_layer)); | 7300 scrolling_layer->AddChild(std::move(scoped_content_layer)); |
| 7301 content_layer->SetBounds(content_layer_bounds); | 7301 content_layer->SetBounds(content_layer_bounds); |
| 7302 content_layer->SetDrawsContent(true); | 7302 content_layer->SetDrawsContent(true); |
| 7303 | 7303 |
| 7304 root->SetBounds(root_size); | 7304 root->SetBounds(root_size); |
| (...skipping 1936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9241 resourceless_software_draw); | 9241 resourceless_software_draw); |
| 9242 EXPECT_FALSE(last_on_draw_frame_->has_no_damage); | 9242 EXPECT_FALSE(last_on_draw_frame_->has_no_damage); |
| 9243 } | 9243 } |
| 9244 | 9244 |
| 9245 TEST_F(ResourcelessSoftwareLayerTreeHostImplTest, | 9245 TEST_F(ResourcelessSoftwareLayerTreeHostImplTest, |
| 9246 ResourcelessSoftwareDrawSkipsUpdateTiles) { | 9246 ResourcelessSoftwareDrawSkipsUpdateTiles) { |
| 9247 const gfx::Size viewport_size(100, 100); | 9247 const gfx::Size viewport_size(100, 100); |
| 9248 host_impl_->SetViewportSize(viewport_size); | 9248 host_impl_->SetViewportSize(viewport_size); |
| 9249 | 9249 |
| 9250 host_impl_->CreatePendingTree(); | 9250 host_impl_->CreatePendingTree(); |
| 9251 scoped_refptr<FakeDisplayListRasterSource> raster_source( | 9251 scoped_refptr<FakeRasterSource> raster_source( |
| 9252 FakeDisplayListRasterSource::CreateFilled(viewport_size)); | 9252 FakeRasterSource::CreateFilled(viewport_size)); |
| 9253 scoped_ptr<FakePictureLayerImpl> layer( | 9253 scoped_ptr<FakePictureLayerImpl> layer( |
| 9254 FakePictureLayerImpl::CreateWithRasterSource(host_impl_->pending_tree(), | 9254 FakePictureLayerImpl::CreateWithRasterSource(host_impl_->pending_tree(), |
| 9255 11, raster_source)); | 9255 11, raster_source)); |
| 9256 layer->SetBounds(viewport_size); | 9256 layer->SetBounds(viewport_size); |
| 9257 layer->SetDrawsContent(true); | 9257 layer->SetDrawsContent(true); |
| 9258 host_impl_->pending_tree()->SetRootLayer(std::move(layer)); | 9258 host_impl_->pending_tree()->SetRootLayer(std::move(layer)); |
| 9259 | 9259 |
| 9260 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); | 9260 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); |
| 9261 host_impl_->ActivateSyncTree(); | 9261 host_impl_->ActivateSyncTree(); |
| 9262 | 9262 |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9772 EXPECT_VECTOR_EQ(gfx::ScrollOffset(0, 100), | 9772 EXPECT_VECTOR_EQ(gfx::ScrollOffset(0, 100), |
| 9773 scrolling_layer->CurrentScrollOffset()); | 9773 scrolling_layer->CurrentScrollOffset()); |
| 9774 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); | 9774 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); |
| 9775 host_impl_->DidFinishImplFrame(); | 9775 host_impl_->DidFinishImplFrame(); |
| 9776 } | 9776 } |
| 9777 | 9777 |
| 9778 TEST_F(LayerTreeHostImplTest, InvalidLayerNotAddedToRasterQueue) { | 9778 TEST_F(LayerTreeHostImplTest, InvalidLayerNotAddedToRasterQueue) { |
| 9779 host_impl_->CreatePendingTree(); | 9779 host_impl_->CreatePendingTree(); |
| 9780 | 9780 |
| 9781 Region empty_invalidation; | 9781 Region empty_invalidation; |
| 9782 scoped_refptr<DisplayListRasterSource> raster_source_with_tiles( | 9782 scoped_refptr<RasterSource> raster_source_with_tiles( |
| 9783 FakeDisplayListRasterSource::CreateFilled(gfx::Size(10, 10))); | 9783 FakeRasterSource::CreateFilled(gfx::Size(10, 10))); |
| 9784 | 9784 |
| 9785 scoped_ptr<FakePictureLayerImpl> layer = | 9785 scoped_ptr<FakePictureLayerImpl> layer = |
| 9786 FakePictureLayerImpl::Create(host_impl_->pending_tree(), 11); | 9786 FakePictureLayerImpl::Create(host_impl_->pending_tree(), 11); |
| 9787 layer->SetBounds(gfx::Size(10, 10)); | 9787 layer->SetBounds(gfx::Size(10, 10)); |
| 9788 layer->set_gpu_raster_max_texture_size(host_impl_->device_viewport_size()); | 9788 layer->set_gpu_raster_max_texture_size(host_impl_->device_viewport_size()); |
| 9789 layer->SetDrawsContent(true); | 9789 layer->SetDrawsContent(true); |
| 9790 layer->tilings()->AddTiling(1.0f, raster_source_with_tiles); | 9790 layer->tilings()->AddTiling(1.0f, raster_source_with_tiles); |
| 9791 layer->UpdateRasterSource(raster_source_with_tiles, &empty_invalidation, | 9791 layer->UpdateRasterSource(raster_source_with_tiles, &empty_invalidation, |
| 9792 nullptr); | 9792 nullptr); |
| 9793 layer->tilings()->tiling_at(0)->set_resolution( | 9793 layer->tilings()->tiling_at(0)->set_resolution( |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10379 // There should not be any jitter measured till we hit the fixed point hits | 10379 // There should not be any jitter measured till we hit the fixed point hits |
| 10380 // threshold. | 10380 // threshold. |
| 10381 float expected_jitter = | 10381 float expected_jitter = |
| 10382 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; | 10382 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; |
| 10383 EXPECT_EQ(jitter, expected_jitter); | 10383 EXPECT_EQ(jitter, expected_jitter); |
| 10384 } | 10384 } |
| 10385 } | 10385 } |
| 10386 | 10386 |
| 10387 } // namespace | 10387 } // namespace |
| 10388 } // namespace cc | 10388 } // namespace cc |
| OLD | NEW |