| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 PostSetNeedsCommitToMainThread(); | 897 PostSetNeedsCommitToMainThread(); |
| 898 client_.set_bounds(root_layer_->bounds()); | 898 client_.set_bounds(root_layer_->bounds()); |
| 899 } | 899 } |
| 900 | 900 |
| 901 void InitializeSettings(LayerTreeSettings* settings) override { | 901 void InitializeSettings(LayerTreeSettings* settings) override { |
| 902 settings->gpu_rasterization_enabled = true; | 902 settings->gpu_rasterization_enabled = true; |
| 903 settings->gpu_rasterization_forced = true; | 903 settings->gpu_rasterization_forced = true; |
| 904 } | 904 } |
| 905 | 905 |
| 906 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 906 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
| 907 if (num_draws_ < 2) | 907 if (num_draws_ < 2) { |
| 908 PostSetNeedsRedrawRectToMainThread(invalid_rect_); | 908 PostSetNeedsRedrawRectToMainThread(invalid_rect_); |
| 909 num_draws_++; | 909 num_draws_++; |
| 910 } |
| 910 } | 911 } |
| 911 | 912 |
| 912 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 913 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
| 913 if (num_draws_ == 2) { | 914 if (num_draws_ == 2) { |
| 914 auto pending_tree = host_impl->pending_tree(); | 915 auto pending_tree = host_impl->pending_tree(); |
| 915 auto pending_layer_impl = | 916 auto pending_layer_impl = |
| 916 static_cast<FakePictureLayerImpl*>(pending_tree->root_layer()); | 917 static_cast<FakePictureLayerImpl*>(pending_tree->root_layer()); |
| 917 EXPECT_NE(pending_layer_impl, nullptr); | 918 EXPECT_NE(pending_layer_impl, nullptr); |
| 918 | 919 |
| 919 auto active_tree = host_impl->pending_tree(); | 920 auto active_tree = host_impl->pending_tree(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 944 private: | 945 private: |
| 945 int num_draws_; | 946 int num_draws_; |
| 946 const gfx::Size bounds_; | 947 const gfx::Size bounds_; |
| 947 const gfx::Rect invalid_rect_; | 948 const gfx::Rect invalid_rect_; |
| 948 FakeContentLayerClient client_; | 949 FakeContentLayerClient client_; |
| 949 scoped_refptr<FakePictureLayer> root_layer_; | 950 scoped_refptr<FakePictureLayer> root_layer_; |
| 950 }; | 951 }; |
| 951 | 952 |
| 952 // As there's no pending tree in single-threaded case, this test should run | 953 // As there's no pending tree in single-threaded case, this test should run |
| 953 // only for multi-threaded case. | 954 // only for multi-threaded case. |
| 954 // Multi-thread case is flaky too. Disabling pending resolution on | 955 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterDeviceSizeChanged); |
| 955 // crbug.com/598491 | |
| 956 // MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterDeviceSizeChanged); | |
| 957 | 956 |
| 958 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest { | 957 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest { |
| 959 public: | 958 public: |
| 960 void InitializeSettings(LayerTreeSettings* settings) override { | 959 void InitializeSettings(LayerTreeSettings* settings) override { |
| 961 settings->layer_transforms_should_scale_layer_contents = true; | 960 settings->layer_transforms_should_scale_layer_contents = true; |
| 962 } | 961 } |
| 963 | 962 |
| 964 void SetupTree() override { | 963 void SetupTree() override { |
| 965 root_layer_ = Layer::Create(); | 964 root_layer_ = Layer::Create(); |
| 966 root_layer_->SetBounds(gfx::Size(10, 20)); | 965 root_layer_->SetBounds(gfx::Size(10, 20)); |
| (...skipping 5714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6681 EndTest(); | 6680 EndTest(); |
| 6682 } | 6681 } |
| 6683 | 6682 |
| 6684 void AfterTest() override {} | 6683 void AfterTest() override {} |
| 6685 }; | 6684 }; |
| 6686 | 6685 |
| 6687 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); | 6686 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); |
| 6688 | 6687 |
| 6689 } // namespace | 6688 } // namespace |
| 6690 } // namespace cc | 6689 } // namespace cc |
| OLD | NEW |