| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
| 31 #include "testing/perf/perf_test.h" | 31 #include "testing/perf/perf_test.h" |
| 32 | 32 |
| 33 namespace cc { | 33 namespace cc { |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| 36 static const int kTimeLimitMillis = 2000; | 36 static const int kTimeLimitMillis = 2000; |
| 37 static const int kWarmupRuns = 5; | 37 static const int kWarmupRuns = 5; |
| 38 static const int kTimeCheckInterval = 10; | 38 static const int kTimeCheckInterval = 10; |
| 39 | 39 |
| 40 class FakeTileTaskRunnerImpl : public TileTaskRunner, | 40 class FakeTileTaskWorkerPoolImpl : public TileTaskWorkerPool, |
| 41 public RasterBufferProvider { | 41 public RasterBufferProvider { |
| 42 public: | 42 public: |
| 43 // Overridden from TileTaskRunner: | 43 // Overridden from TileTaskWorkerPool: |
| 44 void Shutdown() override {} | 44 void Shutdown() override {} |
| 45 void ScheduleTasks(TaskGraph* graph) override { | 45 void ScheduleTasks(TaskGraph* graph) override { |
| 46 for (auto& node : graph->nodes) { | 46 for (auto& node : graph->nodes) { |
| 47 TileTask* task = static_cast<TileTask*>(node.task); | 47 TileTask* task = static_cast<TileTask*>(node.task); |
| 48 | 48 |
| 49 task->WillSchedule(); | 49 task->WillSchedule(); |
| 50 task->ScheduleOnOriginThread(this); | 50 task->ScheduleOnOriginThread(this); |
| 51 task->DidSchedule(); | 51 task->DidSchedule(); |
| 52 | 52 |
| 53 completed_tasks_.push_back(task); | 53 completed_tasks_.push_back(task); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 77 const Resource* resource, | 77 const Resource* resource, |
| 78 uint64_t new_content_id, | 78 uint64_t new_content_id, |
| 79 uint64_t previous_content_id) override { | 79 uint64_t previous_content_id) override { |
| 80 return nullptr; | 80 return nullptr; |
| 81 } | 81 } |
| 82 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override {} | 82 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override {} |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 TileTask::Vector completed_tasks_; | 85 TileTask::Vector completed_tasks_; |
| 86 }; | 86 }; |
| 87 base::LazyInstance<FakeTileTaskRunnerImpl> g_fake_tile_task_runner = | 87 base::LazyInstance<FakeTileTaskWorkerPoolImpl> g_fake_tile_task_worker_pool = |
| 88 LAZY_INSTANCE_INITIALIZER; | 88 LAZY_INSTANCE_INITIALIZER; |
| 89 | 89 |
| 90 class TileManagerPerfTest : public testing::Test { | 90 class TileManagerPerfTest : public testing::Test { |
| 91 public: | 91 public: |
| 92 TileManagerPerfTest() | 92 TileManagerPerfTest() |
| 93 : memory_limit_policy_(ALLOW_ANYTHING), | 93 : memory_limit_policy_(ALLOW_ANYTHING), |
| 94 max_tiles_(10000), | 94 max_tiles_(10000), |
| 95 id_(7), | 95 id_(7), |
| 96 task_runner_provider_(base::ThreadTaskRunnerHandle::Get()), | 96 task_runner_provider_(base::ThreadTaskRunnerHandle::Get()), |
| 97 output_surface_(FakeOutputSurface::Create3d()), | 97 output_surface_(FakeOutputSurface::Create3d()), |
| (...skipping 22 matching lines...) Expand all Loading... |
| 120 } | 120 } |
| 121 | 121 |
| 122 void SetUp() override { | 122 void SetUp() override { |
| 123 InitializeRenderer(); | 123 InitializeRenderer(); |
| 124 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); | 124 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); |
| 125 } | 125 } |
| 126 | 126 |
| 127 virtual void InitializeRenderer() { | 127 virtual void InitializeRenderer() { |
| 128 host_impl_.SetVisible(true); | 128 host_impl_.SetVisible(true); |
| 129 host_impl_.InitializeRenderer(output_surface_.get()); | 129 host_impl_.InitializeRenderer(output_surface_.get()); |
| 130 tile_manager()->SetTileTaskRunnerForTesting( | 130 tile_manager()->SetTileTaskWorkerPoolForTesting( |
| 131 g_fake_tile_task_runner.Pointer()); | 131 g_fake_tile_task_worker_pool.Pointer()); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void SetupDefaultTrees(const gfx::Size& layer_bounds) { | 134 void SetupDefaultTrees(const gfx::Size& layer_bounds) { |
| 135 scoped_refptr<FakeRasterSource> pending_raster_source = | 135 scoped_refptr<FakeRasterSource> pending_raster_source = |
| 136 FakeRasterSource::CreateFilled(layer_bounds); | 136 FakeRasterSource::CreateFilled(layer_bounds); |
| 137 scoped_refptr<FakeRasterSource> active_raster_source = | 137 scoped_refptr<FakeRasterSource> active_raster_source = |
| 138 FakeRasterSource::CreateFilled(layer_bounds); | 138 FakeRasterSource::CreateFilled(layer_bounds); |
| 139 | 139 |
| 140 SetupTrees(pending_raster_source, active_raster_source); | 140 SetupTrees(pending_raster_source, active_raster_source); |
| 141 } | 141 } |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); | 478 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); |
| 479 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); | 479 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); |
| 480 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); | 480 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); |
| 481 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); | 481 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); |
| 482 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); | 482 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); |
| 483 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); | 483 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); |
| 484 } | 484 } |
| 485 | 485 |
| 486 } // namespace | 486 } // namespace |
| 487 } // namespace cc | 487 } // namespace cc |
| OLD | NEW |