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 21 matching lines...) Expand all Loading... |
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 void SetClient(RasterizerClient* client) override {} | 40 void SetClient(RasterizerClient* client) override {} |
41 void Shutdown() override {} | 41 void Shutdown() override {} |
42 void ScheduleTasks(RasterTaskQueue* queue) override { | 42 void RunTasks(RasterTaskQueue* queue) override { |
43 for (RasterTaskQueue::Item::Vector::const_iterator it = | 43 for (auto& item : queue->items) { |
44 queue->items.begin(); | 44 RasterTask* task = item.task; |
45 it != queue->items.end(); | |
46 ++it) { | |
47 RasterTask* task = it->task; | |
48 | 45 |
49 task->WillSchedule(); | 46 task->WillSchedule(); |
50 task->ScheduleOnOriginThread(this); | 47 task->ScheduleOnOriginThread(this); |
| 48 task->DidSchedule(); |
| 49 |
| 50 task->WillRun(); |
| 51 task->RunOnWorkerThread(); |
| 52 task->DidRun(); |
| 53 |
| 54 completed_tasks_.push_back(task); |
| 55 } |
| 56 } |
| 57 void ScheduleTasks(RasterTaskQueue* queue) override { |
| 58 for (auto& item : queue->items) { |
| 59 RasterTask* task = item.task; |
| 60 |
| 61 task->WillSchedule(); |
| 62 task->ScheduleOnOriginThread(this); |
51 task->DidSchedule(); | 63 task->DidSchedule(); |
52 | 64 |
53 completed_tasks_.push_back(task); | 65 completed_tasks_.push_back(task); |
54 } | 66 } |
55 } | 67 } |
56 void CheckForCompletedTasks() override { | 68 void CheckForCompletedTasks() override { |
57 for (RasterTask::Vector::iterator it = completed_tasks_.begin(); | 69 for (auto& task : completed_tasks_) { |
58 it != completed_tasks_.end(); | |
59 ++it) { | |
60 RasterTask* task = it->get(); | |
61 | |
62 task->WillComplete(); | 70 task->WillComplete(); |
63 task->CompleteOnOriginThread(this); | 71 task->CompleteOnOriginThread(this); |
64 task->DidComplete(); | 72 task->DidComplete(); |
65 | 73 |
66 task->RunReplyOnOriginThread(); | 74 task->RunReplyOnOriginThread(); |
67 } | 75 } |
68 completed_tasks_.clear(); | 76 completed_tasks_.clear(); |
69 } | 77 } |
70 | 78 |
71 // Overridden from RasterizerTaskClient: | 79 // Overridden from RasterizerTaskClient: |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); | 496 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); |
489 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); | 497 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); |
490 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); | 498 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); |
491 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); | 499 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); |
492 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); | 500 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); |
493 } | 501 } |
494 | 502 |
495 } // namespace | 503 } // namespace |
496 | 504 |
497 } // namespace cc | 505 } // namespace cc |
OLD | NEW |