Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: third_party/WebKit/Source/platform/TimerTest.cpp

Issue 1402103002: Revert of Revert "Post loading tasks on the appropriate WebFrameScheduler's queue." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "config.h" 5 #include "config.h"
6 #include "platform/Timer.h" 6 #include "platform/Timer.h"
7 7
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 RefPtr<RefCountedTaskContainer> m_task; 70 RefPtr<RefCountedTaskContainer> m_task;
71 double m_runTimeSeconds; 71 double m_runTimeSeconds;
72 double m_delaySeconds; 72 double m_delaySeconds;
73 }; 73 };
74 74
75 class MockWebTaskRunner : public WebTaskRunner { 75 class MockWebTaskRunner : public WebTaskRunner {
76 public: 76 public:
77 explicit MockWebTaskRunner(std::priority_queue<DelayedTask>* timerTasks) : m _timerTasks(timerTasks) { } 77 explicit MockWebTaskRunner(std::priority_queue<DelayedTask>* timerTasks) : m _timerTasks(timerTasks) { }
78 ~MockWebTaskRunner() override { } 78 ~MockWebTaskRunner() override { }
79 79
80 virtual void postTask(const WebTraceLocation&, Task* task) 80 void postTask(const WebTraceLocation&, Task* task) override
81 { 81 {
82 m_timerTasks->push(DelayedTask(task, 0)); 82 m_timerTasks->push(DelayedTask(task, 0));
83 } 83 }
84 84
85 void postDelayedTask(const WebTraceLocation&, Task* task, double delayMs) ov erride 85 void postDelayedTask(const WebTraceLocation&, Task* task, double delayMs) ov erride
86 { 86 {
87 m_timerTasks->push(DelayedTask(task, delayMs * 0.001)); 87 m_timerTasks->push(DelayedTask(task, delayMs * 0.001));
88 } 88 }
89 89
90 WebTaskRunner* clone() override
91 {
92 ASSERT_NOT_REACHED();
93 return nullptr;
94 }
95
90 std::priority_queue<DelayedTask>* m_timerTasks; // NOT OWNED 96 std::priority_queue<DelayedTask>* m_timerTasks; // NOT OWNED
91 }; 97 };
92 98
93 class MockWebScheduler : public WebScheduler { 99 class MockWebScheduler : public WebScheduler {
94 public: 100 public:
95 MockWebScheduler() : m_timerWebTaskRunner(&m_timerTasks) { } 101 MockWebScheduler() : m_timerWebTaskRunner(&m_timerTasks) { }
96 ~MockWebScheduler() override { } 102 ~MockWebScheduler() override { }
97 103
98 bool shouldYieldForHighPriorityWork() override 104 bool shouldYieldForHighPriorityWork() override
99 { 105 {
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 m_startTime + 6.0, 819 m_startTime + 6.0,
814 m_startTime + 8.0, 820 m_startTime + 8.0,
815 m_startTime + 10.0, 821 m_startTime + 10.0,
816 m_startTime + 14.0, 822 m_startTime + 14.0,
817 m_startTime + 18.0, 823 m_startTime + 18.0,
818 m_startTime + 28.0)); 824 m_startTime + 28.0));
819 } 825 }
820 826
821 } // namespace 827 } // namespace
822 } // namespace blink 828 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698