OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "platform/Timer.h" | 5 #include "platform/Timer.h" |
6 | 6 |
7 #include "platform/testing/TestingPlatformSupport.h" | 7 #include "platform/testing/TestingPlatformSupport.h" |
8 #include "public/platform/Platform.h" | 8 #include "public/platform/Platform.h" |
9 #include "public/platform/WebScheduler.h" | 9 #include "public/platform/WebScheduler.h" |
10 #include "public/platform/WebThread.h" | 10 #include "public/platform/WebThread.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 { | 104 { |
105 NOTREACHED(); | 105 NOTREACHED(); |
106 return 0.0; | 106 return 0.0; |
107 } | 107 } |
108 | 108 |
109 double monotonicallyIncreasingVirtualTimeSeconds() const override | 109 double monotonicallyIncreasingVirtualTimeSeconds() const override |
110 { | 110 { |
111 return gCurrentTimeSecs; | 111 return gCurrentTimeSecs; |
112 } | 112 } |
113 | 113 |
| 114 base::SingleThreadTaskRunner* taskRunner() override |
| 115 { |
| 116 ASSERT_NOT_REACHED(); |
| 117 return nullptr; |
| 118 } |
| 119 |
114 std::priority_queue<DelayedTask>* m_timerTasks; // NOT OWNED | 120 std::priority_queue<DelayedTask>* m_timerTasks; // NOT OWNED |
115 }; | 121 }; |
116 | 122 |
117 class MockWebScheduler : public WebScheduler { | 123 class MockWebScheduler : public WebScheduler { |
118 public: | 124 public: |
119 MockWebScheduler() : m_timerWebTaskRunner(&m_timerTasks) { } | 125 MockWebScheduler() : m_timerWebTaskRunner(&m_timerTasks) { } |
120 ~MockWebScheduler() override { } | 126 ~MockWebScheduler() override { } |
121 | 127 |
122 bool shouldYieldForHighPriorityWork() override | 128 bool shouldYieldForHighPriorityWork() override |
123 { | 129 { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 return m_timerTasks.size() == 1; | 193 return m_timerTasks.size() == 1; |
188 } | 194 } |
189 | 195 |
190 double nextTimerTaskDelaySecs() const | 196 double nextTimerTaskDelaySecs() const |
191 { | 197 { |
192 ASSERT(hasOneTimerTask()); | 198 ASSERT(hasOneTimerTask()); |
193 return m_timerTasks.top().delaySeconds(); | 199 return m_timerTasks.top().delaySeconds(); |
194 } | 200 } |
195 | 201 |
196 void shutdown() override {} | 202 void shutdown() override {} |
197 std::unique_ptr<WebViewScheduler> createWebViewScheduler(blink::WebView*) ov
erride { return nullptr; } | 203 std::unique_ptr<WebViewScheduler> createWebViewScheduler(InterventionReporte
r*) override { return nullptr; } |
198 void suspendTimerQueue() override { } | 204 void suspendTimerQueue() override { } |
199 void resumeTimerQueue() override { } | 205 void resumeTimerQueue() override { } |
200 void addPendingNavigation(WebScheduler::NavigatingFrameType) override { } | 206 void addPendingNavigation(WebScheduler::NavigatingFrameType) override { } |
201 void removePendingNavigation(WebScheduler::NavigatingFrameType) override { } | 207 void removePendingNavigation(WebScheduler::NavigatingFrameType) override { } |
202 void onNavigationStarted() override { } | 208 void onNavigationStarted() override { } |
203 | 209 |
204 private: | 210 private: |
205 std::priority_queue<DelayedTask> m_timerTasks; | 211 std::priority_queue<DelayedTask> m_timerTasks; |
206 MockWebTaskRunner m_timerWebTaskRunner; | 212 MockWebTaskRunner m_timerWebTaskRunner; |
207 }; | 213 }; |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 TimerForTest<TimerTest> timer(&taskRunner, this, &TimerTest::countingTask); | 790 TimerForTest<TimerTest> timer(&taskRunner, this, &TimerTest::countingTask); |
785 timer.startOneShot(0, BLINK_FROM_HERE); | 791 timer.startOneShot(0, BLINK_FROM_HERE); |
786 | 792 |
787 // Make sure the task was posted on taskRunner. | 793 // Make sure the task was posted on taskRunner. |
788 EXPECT_FALSE(timerTasks.empty()); | 794 EXPECT_FALSE(timerTasks.empty()); |
789 } | 795 } |
790 | 796 |
791 | 797 |
792 } // namespace | 798 } // namespace |
793 } // namespace blink | 799 } // namespace blink |
OLD | NEW |