| 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.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "cc/test/fake_layer_tree_host_client.h" | 36 #include "cc/test/fake_layer_tree_host_client.h" |
| 37 #include "cc/test/fake_output_surface.h" | 37 #include "cc/test/fake_output_surface.h" |
| 38 #include "cc/test/fake_painted_scrollbar_layer.h" | 38 #include "cc/test/fake_painted_scrollbar_layer.h" |
| 39 #include "cc/test/fake_picture_layer.h" | 39 #include "cc/test/fake_picture_layer.h" |
| 40 #include "cc/test/fake_picture_layer_impl.h" | 40 #include "cc/test/fake_picture_layer_impl.h" |
| 41 #include "cc/test/fake_picture_pile.h" | 41 #include "cc/test/fake_picture_pile.h" |
| 42 #include "cc/test/fake_proxy.h" | 42 #include "cc/test/fake_proxy.h" |
| 43 #include "cc/test/fake_scoped_ui_resource.h" | 43 #include "cc/test/fake_scoped_ui_resource.h" |
| 44 #include "cc/test/fake_video_frame_provider.h" | 44 #include "cc/test/fake_video_frame_provider.h" |
| 45 #include "cc/test/geometry_test_utils.h" | 45 #include "cc/test/geometry_test_utils.h" |
| 46 #include "cc/test/impl_side_painting_settings.h" |
| 46 #include "cc/test/layer_tree_test.h" | 47 #include "cc/test/layer_tree_test.h" |
| 47 #include "cc/test/test_shared_bitmap_manager.h" | 48 #include "cc/test/test_shared_bitmap_manager.h" |
| 48 #include "cc/test/test_web_graphics_context_3d.h" | 49 #include "cc/test/test_web_graphics_context_3d.h" |
| 49 #include "cc/trees/layer_tree_host_impl.h" | 50 #include "cc/trees/layer_tree_host_impl.h" |
| 50 #include "cc/trees/layer_tree_impl.h" | 51 #include "cc/trees/layer_tree_impl.h" |
| 51 #include "cc/trees/single_thread_proxy.h" | 52 #include "cc/trees/single_thread_proxy.h" |
| 52 #include "cc/trees/thread_proxy.h" | 53 #include "cc/trees/thread_proxy.h" |
| 53 #include "gpu/GLES2/gl2extchromium.h" | 54 #include "gpu/GLES2/gl2extchromium.h" |
| 54 #include "skia/ext/refptr.h" | 55 #include "skia/ext/refptr.h" |
| 55 #include "testing/gmock/include/gmock/gmock.h" | 56 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 5510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5566 | 5567 |
| 5567 scoped_refptr<Layer> root = Layer::Create(); | 5568 scoped_refptr<Layer> root = Layer::Create(); |
| 5568 root->SetBounds(gfx::Size(500, 500)); | 5569 root->SetBounds(gfx::Size(500, 500)); |
| 5569 | 5570 |
| 5570 scoped_refptr<Layer> pinch = Layer::Create(); | 5571 scoped_refptr<Layer> pinch = Layer::Create(); |
| 5571 pinch->SetBounds(gfx::Size(500, 500)); | 5572 pinch->SetBounds(gfx::Size(500, 500)); |
| 5572 pinch->SetScrollClipLayerId(root->id()); | 5573 pinch->SetScrollClipLayerId(root->id()); |
| 5573 pinch->SetIsContainerForFixedPositionLayers(true); | 5574 pinch->SetIsContainerForFixedPositionLayers(true); |
| 5574 root->AddChild(pinch); | 5575 root->AddChild(pinch); |
| 5575 | 5576 |
| 5576 scoped_ptr<FakePicturePile> pile(new FakePicturePile); | 5577 scoped_ptr<FakePicturePile> pile( |
| 5578 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, |
| 5579 ImplSidePaintingSettings().default_tile_grid_size)); |
| 5577 pile->SetPlaybackAllowedEvent(&playback_allowed_event_); | 5580 pile->SetPlaybackAllowedEvent(&playback_allowed_event_); |
| 5578 scoped_refptr<FakePictureLayer> layer = | 5581 scoped_refptr<FakePictureLayer> layer = |
| 5579 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); | 5582 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); |
| 5580 layer->SetBounds(gfx::Size(500, 500)); | 5583 layer->SetBounds(gfx::Size(500, 500)); |
| 5581 layer->SetContentsOpaque(true); | 5584 layer->SetContentsOpaque(true); |
| 5582 // Avoid LCD text on the layer so we don't cause extra commits when we | 5585 // Avoid LCD text on the layer so we don't cause extra commits when we |
| 5583 // pinch. | 5586 // pinch. |
| 5584 layer->disable_lcd_text(); | 5587 layer->disable_lcd_text(); |
| 5585 pinch->AddChild(layer); | 5588 pinch->AddChild(layer); |
| 5586 | 5589 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5769 settings->impl_side_painting = true; | 5772 settings->impl_side_painting = true; |
| 5770 settings->gpu_rasterization_forced = true; | 5773 settings->gpu_rasterization_forced = true; |
| 5771 } | 5774 } |
| 5772 | 5775 |
| 5773 void SetupTree() override { | 5776 void SetupTree() override { |
| 5774 client_.set_fill_with_nonsolid_color(true); | 5777 client_.set_fill_with_nonsolid_color(true); |
| 5775 | 5778 |
| 5776 scoped_refptr<Layer> root = Layer::Create(); | 5779 scoped_refptr<Layer> root = Layer::Create(); |
| 5777 root->SetBounds(gfx::Size(500, 500)); | 5780 root->SetBounds(gfx::Size(500, 500)); |
| 5778 | 5781 |
| 5779 scoped_ptr<FakePicturePile> pile(new FakePicturePile); | 5782 scoped_ptr<FakePicturePile> pile( |
| 5783 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, |
| 5784 ImplSidePaintingSettings().default_tile_grid_size)); |
| 5780 scoped_refptr<FakePictureLayer> layer = | 5785 scoped_refptr<FakePictureLayer> layer = |
| 5781 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); | 5786 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); |
| 5782 layer->SetBounds(gfx::Size(500, 500)); | 5787 layer->SetBounds(gfx::Size(500, 500)); |
| 5783 layer->SetContentsOpaque(true); | 5788 layer->SetContentsOpaque(true); |
| 5784 root->AddChild(layer); | 5789 root->AddChild(layer); |
| 5785 | 5790 |
| 5786 layer_tree_host()->SetRootLayer(root); | 5791 layer_tree_host()->SetRootLayer(root); |
| 5787 LayerTreeHostTest::SetupTree(); | 5792 LayerTreeHostTest::SetupTree(); |
| 5788 } | 5793 } |
| 5789 | 5794 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 5809 | 5814 |
| 5810 void InitializeSettings(LayerTreeSettings* settings) override { | 5815 void InitializeSettings(LayerTreeSettings* settings) override { |
| 5811 settings->impl_side_painting = true; | 5816 settings->impl_side_painting = true; |
| 5812 settings->gpu_rasterization_enabled = true; | 5817 settings->gpu_rasterization_enabled = true; |
| 5813 settings->gpu_rasterization_forced = true; | 5818 settings->gpu_rasterization_forced = true; |
| 5814 } | 5819 } |
| 5815 | 5820 |
| 5816 void SetupTree() override { | 5821 void SetupTree() override { |
| 5817 client_.set_fill_with_nonsolid_color(true); | 5822 client_.set_fill_with_nonsolid_color(true); |
| 5818 | 5823 |
| 5819 scoped_ptr<FakePicturePile> pile(new FakePicturePile); | 5824 scoped_ptr<FakePicturePile> pile( |
| 5825 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, |
| 5826 ImplSidePaintingSettings().default_tile_grid_size)); |
| 5820 scoped_refptr<FakePictureLayer> root = | 5827 scoped_refptr<FakePictureLayer> root = |
| 5821 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); | 5828 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); |
| 5822 root->SetBounds(gfx::Size(viewport_size_.width(), 10000)); | 5829 root->SetBounds(gfx::Size(viewport_size_.width(), 10000)); |
| 5823 root->SetContentsOpaque(true); | 5830 root->SetContentsOpaque(true); |
| 5824 | 5831 |
| 5825 layer_tree_host()->SetRootLayer(root); | 5832 layer_tree_host()->SetRootLayer(root); |
| 5826 LayerTreeHostTest::SetupTree(); | 5833 LayerTreeHostTest::SetupTree(); |
| 5827 layer_tree_host()->SetViewportSize(viewport_size_); | 5834 layer_tree_host()->SetViewportSize(viewport_size_); |
| 5828 } | 5835 } |
| 5829 | 5836 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5879 | 5886 |
| 5880 scoped_refptr<Layer> root = Layer::Create(); | 5887 scoped_refptr<Layer> root = Layer::Create(); |
| 5881 root->SetBounds(gfx::Size(500, 500)); | 5888 root->SetBounds(gfx::Size(500, 500)); |
| 5882 | 5889 |
| 5883 scoped_refptr<Layer> pinch = Layer::Create(); | 5890 scoped_refptr<Layer> pinch = Layer::Create(); |
| 5884 pinch->SetBounds(gfx::Size(500, 500)); | 5891 pinch->SetBounds(gfx::Size(500, 500)); |
| 5885 pinch->SetScrollClipLayerId(root->id()); | 5892 pinch->SetScrollClipLayerId(root->id()); |
| 5886 pinch->SetIsContainerForFixedPositionLayers(true); | 5893 pinch->SetIsContainerForFixedPositionLayers(true); |
| 5887 root->AddChild(pinch); | 5894 root->AddChild(pinch); |
| 5888 | 5895 |
| 5889 scoped_ptr<FakePicturePile> pile(new FakePicturePile); | 5896 scoped_ptr<FakePicturePile> pile( |
| 5897 new FakePicturePile(ImplSidePaintingSettings().minimum_contents_scale, |
| 5898 ImplSidePaintingSettings().default_tile_grid_size)); |
| 5890 pile->SetPlaybackAllowedEvent(&playback_allowed_event_); | 5899 pile->SetPlaybackAllowedEvent(&playback_allowed_event_); |
| 5891 scoped_refptr<FakePictureLayer> layer = | 5900 scoped_refptr<FakePictureLayer> layer = |
| 5892 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); | 5901 FakePictureLayer::CreateWithRecordingSource(&client_, pile.Pass()); |
| 5893 layer->SetBounds(gfx::Size(500, 500)); | 5902 layer->SetBounds(gfx::Size(500, 500)); |
| 5894 layer->SetContentsOpaque(true); | 5903 layer->SetContentsOpaque(true); |
| 5895 // Avoid LCD text on the layer so we don't cause extra commits when we | 5904 // Avoid LCD text on the layer so we don't cause extra commits when we |
| 5896 // pinch. | 5905 // pinch. |
| 5897 layer->disable_lcd_text(); | 5906 layer->disable_lcd_text(); |
| 5898 pinch->AddChild(layer); | 5907 pinch->AddChild(layer); |
| 5899 | 5908 |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6170 | 6179 |
| 6171 void AfterTest() override { EXPECT_TRUE(did_commit_); } | 6180 void AfterTest() override { EXPECT_TRUE(did_commit_); } |
| 6172 | 6181 |
| 6173 private: | 6182 private: |
| 6174 bool did_commit_; | 6183 bool did_commit_; |
| 6175 }; | 6184 }; |
| 6176 | 6185 |
| 6177 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); | 6186 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoTasksBetweenWillAndDidCommit); |
| 6178 | 6187 |
| 6179 } // namespace cc | 6188 } // namespace cc |
| OLD | NEW |