| 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/layer.h" | 5 #include "cc/layers/layer.h" |
| 6 | 6 |
| 7 #include "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
| 8 #include "cc/debug/lap_timer.h" | 8 #include "cc/debug/lap_timer.h" |
| 9 #include "cc/test/fake_impl_proxy.h" | 9 #include "cc/test/fake_impl_task_runner_provider.h" |
| 10 #include "cc/test/fake_layer_tree_host.h" | 10 #include "cc/test/fake_layer_tree_host.h" |
| 11 #include "cc/test/fake_layer_tree_host_client.h" | 11 #include "cc/test/fake_layer_tree_host_client.h" |
| 12 #include "cc/test/fake_layer_tree_host_impl.h" | 12 #include "cc/test/fake_layer_tree_host_impl.h" |
| 13 #include "cc/test/test_task_graph_runner.h" | 13 #include "cc/test/test_task_graph_runner.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "testing/perf/perf_test.h" | 15 #include "testing/perf/perf_test.h" |
| 16 | 16 |
| 17 namespace cc { | 17 namespace cc { |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 static const int kTimeLimitMillis = 3000; | 20 static const int kTimeLimitMillis = 3000; |
| 21 static const int kWarmupRuns = 5; | 21 static const int kWarmupRuns = 5; |
| 22 static const int kTimeCheckInterval = 10; | 22 static const int kTimeCheckInterval = 10; |
| 23 | 23 |
| 24 class LayerPerfTest : public testing::Test { | 24 class LayerPerfTest : public testing::Test { |
| 25 public: | 25 public: |
| 26 LayerPerfTest() | 26 LayerPerfTest() |
| 27 : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_), | 27 : host_impl_(&task_runner_provider_, |
| 28 &shared_bitmap_manager_, |
| 29 &task_graph_runner_), |
| 28 fake_client_(FakeLayerTreeHostClient::DIRECT_3D), | 30 fake_client_(FakeLayerTreeHostClient::DIRECT_3D), |
| 29 timer_(kWarmupRuns, | 31 timer_(kWarmupRuns, |
| 30 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 32 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
| 31 kTimeCheckInterval) {} | 33 kTimeCheckInterval) {} |
| 32 | 34 |
| 33 protected: | 35 protected: |
| 34 void SetUp() override { | 36 void SetUp() override { |
| 35 layer_tree_host_ = | 37 layer_tree_host_ = |
| 36 FakeLayerTreeHost::Create(&fake_client_, &task_graph_runner_); | 38 FakeLayerTreeHost::Create(&fake_client_, &task_graph_runner_); |
| 37 layer_tree_host_->InitializeSingleThreaded( | 39 layer_tree_host_->InitializeSingleThreaded( |
| 38 &fake_client_, base::ThreadTaskRunnerHandle::Get(), nullptr); | 40 &fake_client_, base::ThreadTaskRunnerHandle::Get(), nullptr); |
| 39 } | 41 } |
| 40 | 42 |
| 41 void TearDown() override { | 43 void TearDown() override { |
| 42 layer_tree_host_->SetRootLayer(nullptr); | 44 layer_tree_host_->SetRootLayer(nullptr); |
| 43 layer_tree_host_ = nullptr; | 45 layer_tree_host_ = nullptr; |
| 44 } | 46 } |
| 45 | 47 |
| 46 FakeImplProxy proxy_; | 48 FakeImplTaskRunnerProvider task_runner_provider_; |
| 47 TestSharedBitmapManager shared_bitmap_manager_; | 49 TestSharedBitmapManager shared_bitmap_manager_; |
| 48 TestTaskGraphRunner task_graph_runner_; | 50 TestTaskGraphRunner task_graph_runner_; |
| 49 FakeLayerTreeHostImpl host_impl_; | 51 FakeLayerTreeHostImpl host_impl_; |
| 50 | 52 |
| 51 FakeLayerTreeHostClient fake_client_; | 53 FakeLayerTreeHostClient fake_client_; |
| 52 scoped_ptr<FakeLayerTreeHost> layer_tree_host_; | 54 scoped_ptr<FakeLayerTreeHost> layer_tree_host_; |
| 53 LapTimer timer_; | 55 LapTimer timer_; |
| 54 }; | 56 }; |
| 55 | 57 |
| 56 TEST_F(LayerPerfTest, PushPropertiesTo) { | 58 TEST_F(LayerPerfTest, PushPropertiesTo) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 "", | 110 "", |
| 109 "props_didnt_change", | 111 "props_didnt_change", |
| 110 timer_.LapsPerSecond(), | 112 timer_.LapsPerSecond(), |
| 111 "runs/s", | 113 "runs/s", |
| 112 true); | 114 true); |
| 113 } | 115 } |
| 114 | 116 |
| 115 | 117 |
| 116 } // namespace | 118 } // namespace |
| 117 } // namespace cc | 119 } // namespace cc |
| OLD | NEW |