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 "base/time/time.h" | 5 #include "base/time/time.h" |
6 #include "cc/debug/lap_timer.h" | 6 #include "cc/debug/lap_timer.h" |
7 #include "cc/resources/raster_buffer.h" | 7 #include "cc/resources/raster_buffer.h" |
8 #include "cc/resources/tile.h" | 8 #include "cc/resources/tile.h" |
9 #include "cc/resources/tile_priority.h" | 9 #include "cc/resources/tile_priority.h" |
10 #include "cc/test/begin_frame_args_test.h" | 10 #include "cc/test/begin_frame_args_test.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 namespace { | 31 namespace { |
32 | 32 |
33 static const int kTimeLimitMillis = 2000; | 33 static const int kTimeLimitMillis = 2000; |
34 static const int kWarmupRuns = 5; | 34 static const int kWarmupRuns = 5; |
35 static const int kTimeCheckInterval = 10; | 35 static const int kTimeCheckInterval = 10; |
36 | 36 |
37 class FakeRasterizerImpl : public Rasterizer, public RasterizerTaskClient { | 37 class FakeRasterizerImpl : public Rasterizer, public RasterizerTaskClient { |
38 public: | 38 public: |
39 // Overridden from Rasterizer: | 39 // Overridden from Rasterizer: |
40 virtual void SetClient(RasterizerClient* client) override {} | 40 void SetClient(RasterizerClient* client) override {} |
41 virtual void Shutdown() override {} | 41 void Shutdown() override {} |
42 virtual void ScheduleTasks(RasterTaskQueue* queue) override { | 42 void ScheduleTasks(RasterTaskQueue* queue) override { |
43 for (RasterTaskQueue::Item::Vector::const_iterator it = | 43 for (RasterTaskQueue::Item::Vector::const_iterator it = |
44 queue->items.begin(); | 44 queue->items.begin(); |
45 it != queue->items.end(); | 45 it != queue->items.end(); |
46 ++it) { | 46 ++it) { |
47 RasterTask* task = it->task; | 47 RasterTask* task = it->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); |
54 } | 54 } |
55 } | 55 } |
56 virtual void CheckForCompletedTasks() override { | 56 void CheckForCompletedTasks() override { |
57 for (RasterTask::Vector::iterator it = completed_tasks_.begin(); | 57 for (RasterTask::Vector::iterator it = completed_tasks_.begin(); |
58 it != completed_tasks_.end(); | 58 it != completed_tasks_.end(); |
59 ++it) { | 59 ++it) { |
60 RasterTask* task = it->get(); | 60 RasterTask* task = it->get(); |
61 | 61 |
62 task->WillComplete(); | 62 task->WillComplete(); |
63 task->CompleteOnOriginThread(this); | 63 task->CompleteOnOriginThread(this); |
64 task->DidComplete(); | 64 task->DidComplete(); |
65 | 65 |
66 task->RunReplyOnOriginThread(); | 66 task->RunReplyOnOriginThread(); |
67 } | 67 } |
68 completed_tasks_.clear(); | 68 completed_tasks_.clear(); |
69 } | 69 } |
70 | 70 |
71 // Overridden from RasterizerTaskClient: | 71 // Overridden from RasterizerTaskClient: |
72 virtual scoped_ptr<RasterBuffer> AcquireBufferForRaster( | 72 scoped_ptr<RasterBuffer> AcquireBufferForRaster( |
73 const Resource* resource) override { | 73 const Resource* resource) override { |
74 return nullptr; | 74 return nullptr; |
75 } | 75 } |
76 virtual void ReleaseBufferForRaster( | 76 void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override {} |
77 scoped_ptr<RasterBuffer> buffer) override {} | |
78 | 77 |
79 private: | 78 private: |
80 RasterTask::Vector completed_tasks_; | 79 RasterTask::Vector completed_tasks_; |
81 }; | 80 }; |
82 base::LazyInstance<FakeRasterizerImpl> g_fake_rasterizer = | 81 base::LazyInstance<FakeRasterizerImpl> g_fake_rasterizer = |
83 LAZY_INSTANCE_INITIALIZER; | 82 LAZY_INSTANCE_INITIALIZER; |
84 | 83 |
85 class TileManagerPerfTest : public testing::Test { | 84 class TileManagerPerfTest : public testing::Test { |
86 public: | 85 public: |
87 TileManagerPerfTest() | 86 TileManagerPerfTest() |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); | 486 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); |
488 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); | 487 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); |
489 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); | 488 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); |
490 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); | 489 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); |
491 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); | 490 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); |
492 } | 491 } |
493 | 492 |
494 } // namespace | 493 } // namespace |
495 | 494 |
496 } // namespace cc | 495 } // namespace cc |
OLD | NEW |