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, public TileTaskClient { | 40 class FakeTileTaskRunnerImpl : public TileTaskRunner, |
| 41 public RasterBufferProvider { |
41 public: | 42 public: |
42 // Overridden from TileTaskRunner: | 43 // Overridden from TileTaskRunner: |
43 void Shutdown() override {} | 44 void Shutdown() override {} |
44 void ScheduleTasks(TaskGraph* graph) override { | 45 void ScheduleTasks(TaskGraph* graph) override { |
45 for (auto& node : graph->nodes) { | 46 for (auto& node : graph->nodes) { |
46 TileTask* task = static_cast<TileTask*>(node.task); | 47 TileTask* task = static_cast<TileTask*>(node.task); |
47 | 48 |
48 task->WillSchedule(); | 49 task->WillSchedule(); |
49 task->ScheduleOnOriginThread(this); | 50 task->ScheduleOnOriginThread(this); |
50 task->DidSchedule(); | 51 task->DidSchedule(); |
(...skipping 11 matching lines...) Expand all Loading... |
62 task->DidComplete(); | 63 task->DidComplete(); |
63 } | 64 } |
64 completed_tasks_.clear(); | 65 completed_tasks_.clear(); |
65 } | 66 } |
66 ResourceFormat GetResourceFormat(bool must_support_alpha) const override { | 67 ResourceFormat GetResourceFormat(bool must_support_alpha) const override { |
67 return RGBA_8888; | 68 return RGBA_8888; |
68 } | 69 } |
69 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override { | 70 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override { |
70 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha)); | 71 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha)); |
71 } | 72 } |
| 73 RasterBufferProvider* AsRasterBufferProvider() override { return this; } |
72 | 74 |
73 // Overridden from TileTaskClient: | 75 // Overridden from RasterBufferProvider: |
74 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( | 76 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( |
75 const Resource* resource, | 77 const Resource* resource, |
76 uint64_t new_content_id, | 78 uint64_t new_content_id, |
77 uint64_t previous_content_id) override { | 79 uint64_t previous_content_id) override { |
78 return nullptr; | 80 return nullptr; |
79 } | 81 } |
80 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override {} | 82 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override {} |
81 | 83 |
82 private: | 84 private: |
83 TileTask::Vector completed_tasks_; | 85 TileTask::Vector completed_tasks_; |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); | 478 RunEvictionQueueConstructAndIterateTest("10_64", 10, 64); |
477 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); | 479 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); |
478 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); | 480 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); |
479 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); | 481 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); |
480 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); | 482 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); |
481 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); | 483 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); |
482 } | 484 } |
483 | 485 |
484 } // namespace | 486 } // namespace |
485 } // namespace cc | 487 } // namespace cc |
OLD | NEW |