OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" |
6 #include "platform/scheduler/Scheduler.h" | 6 #include "platform/scheduler/Scheduler.h" |
7 | 7 |
8 #include "platform/RuntimeEnabledFeatures.h" | 8 #include "platform/RuntimeEnabledFeatures.h" |
9 #include "platform/TestingPlatformSupport.h" | 9 #include "platform/TestingPlatformSupport.h" |
10 #include "public/platform/Platform.h" | 10 #include "public/platform/Platform.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 void runLatestIdleTask(double deadlineSeconds) | 56 void runLatestIdleTask(double deadlineSeconds) |
57 { | 57 { |
58 m_latestIdleTask->run(deadlineSeconds); | 58 m_latestIdleTask->run(deadlineSeconds); |
59 m_latestIdleTask.clear(); | 59 m_latestIdleTask.clear(); |
60 } | 60 } |
61 | 61 |
62 protected: | 62 protected: |
63 bool m_shouldYieldForHighPriorityWork; | 63 bool m_shouldYieldForHighPriorityWork; |
64 | 64 |
65 OwnPtr<WebScheduler::IdleTask> m_latestIdleTask; | 65 OwnPtr<blink::WebThread::IdleTask> m_latestIdleTask; |
66 }; | 66 }; |
67 | 67 |
68 class SchedulerTest : public testing::Test { | 68 class SchedulerTest : public testing::Test { |
69 public: | 69 public: |
70 SchedulerTest() | 70 SchedulerTest() |
71 { | 71 { |
72 blink::RuntimeEnabledFeatures::setBlinkSchedulerEnabled(true); | 72 blink::RuntimeEnabledFeatures::setBlinkSchedulerEnabled(true); |
73 m_webScheduler = adoptPtr(new WebSchedulerForTest()); | 73 m_webScheduler = adoptPtr(new WebSchedulerForTest()); |
74 m_scheduler = adoptPtr(new SchedulerForTest(m_webScheduler.get())); | 74 m_scheduler = adoptPtr(new SchedulerForTest(m_webScheduler.get())); |
75 } | 75 } |
(...skipping 16 matching lines...) Expand all Loading... |
92 } | 92 } |
93 | 93 |
94 TEST_F(SchedulerTest, TestIdleTasks) | 94 TEST_F(SchedulerTest, TestIdleTasks) |
95 { | 95 { |
96 double deadline = 1.1; | 96 double deadline = 1.1; |
97 m_scheduler->postIdleTask(FROM_HERE, WTF::bind<double>(&idleTestTask, deadli
ne)); | 97 m_scheduler->postIdleTask(FROM_HERE, WTF::bind<double>(&idleTestTask, deadli
ne)); |
98 m_webScheduler->runLatestIdleTask(deadline); | 98 m_webScheduler->runLatestIdleTask(deadline); |
99 } | 99 } |
100 | 100 |
101 } // namespace | 101 } // namespace |
OLD | NEW |