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 virtual void SetClient(RasterizerClient* client) override {} |
41 virtual void Shutdown() OVERRIDE {} | 41 virtual void Shutdown() override {} |
42 virtual void ScheduleTasks(RasterTaskQueue* queue) OVERRIDE { | 42 virtual 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 virtual 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 virtual 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 virtual void ReleaseBufferForRaster( |
77 scoped_ptr<RasterBuffer> buffer) OVERRIDE {} | 77 scoped_ptr<RasterBuffer> buffer) override {} |
78 | 78 |
79 private: | 79 private: |
80 RasterTask::Vector completed_tasks_; | 80 RasterTask::Vector completed_tasks_; |
81 }; | 81 }; |
82 base::LazyInstance<FakeRasterizerImpl> g_fake_rasterizer = | 82 base::LazyInstance<FakeRasterizerImpl> g_fake_rasterizer = |
83 LAZY_INSTANCE_INITIALIZER; | 83 LAZY_INSTANCE_INITIALIZER; |
84 | 84 |
85 class TileManagerPerfTest : public testing::Test { | 85 class TileManagerPerfTest : public testing::Test { |
86 public: | 86 public: |
87 TileManagerPerfTest() | 87 TileManagerPerfTest() |
(...skipping 17 matching lines...) Expand all Loading... |
105 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes * 2; | 105 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes * 2; |
106 state.memory_limit_policy = memory_limit_policy_; | 106 state.memory_limit_policy = memory_limit_policy_; |
107 state.tree_priority = tree_priority; | 107 state.tree_priority = tree_priority; |
108 | 108 |
109 global_state_ = state; | 109 global_state_ = state; |
110 host_impl_.resource_pool()->SetResourceUsageLimits( | 110 host_impl_.resource_pool()->SetResourceUsageLimits( |
111 state.soft_memory_limit_in_bytes, 0, state.num_resources_limit); | 111 state.soft_memory_limit_in_bytes, 0, state.num_resources_limit); |
112 host_impl_.tile_manager()->SetGlobalStateForTesting(state); | 112 host_impl_.tile_manager()->SetGlobalStateForTesting(state); |
113 } | 113 } |
114 | 114 |
115 virtual void SetUp() OVERRIDE { | 115 virtual void SetUp() override { |
116 picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile(); | 116 picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile(); |
117 InitializeRenderer(); | 117 InitializeRenderer(); |
118 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); | 118 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); |
119 } | 119 } |
120 | 120 |
121 virtual void InitializeRenderer() { | 121 virtual void InitializeRenderer() { |
122 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d().Pass()); | 122 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d().Pass()); |
123 tile_manager()->SetRasterizerForTesting(g_fake_rasterizer.Pointer()); | 123 tile_manager()->SetRasterizerForTesting(g_fake_rasterizer.Pointer()); |
124 } | 124 } |
125 | 125 |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); | 487 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); |
488 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); | 488 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); |
489 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); | 489 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); |
490 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); | 490 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); |
491 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); | 491 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); |
492 } | 492 } |
493 | 493 |
494 } // namespace | 494 } // namespace |
495 | 495 |
496 } // namespace cc | 496 } // namespace cc |
OLD | NEW |