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

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

Issue 1379543003: Revert of 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 void postTask(const WebTraceLocation&, Task* task) override 80 virtual void postTask(const WebTraceLocation&, Task* task)
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
96 std::priority_queue<DelayedTask>* m_timerTasks; // NOT OWNED 90 std::priority_queue<DelayedTask>* m_timerTasks; // NOT OWNED
97 }; 91 };
98 92
99 class MockWebScheduler : public WebScheduler { 93 class MockWebScheduler : public WebScheduler {
100 public: 94 public:
101 MockWebScheduler() : m_timerWebTaskRunner(&m_timerTasks) { } 95 MockWebScheduler() : m_timerWebTaskRunner(&m_timerTasks) { }
102 ~MockWebScheduler() override { } 96 ~MockWebScheduler() override { }
103 97
104 bool shouldYieldForHighPriorityWork() override 98 bool shouldYieldForHighPriorityWork() override
105 { 99 {
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 m_startTime + 6.0, 814 m_startTime + 6.0,
821 m_startTime + 8.0, 815 m_startTime + 8.0,
822 m_startTime + 10.0, 816 m_startTime + 10.0,
823 m_startTime + 14.0, 817 m_startTime + 14.0,
824 m_startTime + 18.0, 818 m_startTime + 18.0,
825 m_startTime + 28.0)); 819 m_startTime + 28.0));
826 } 820 }
827 821
828 } // namespace 822 } // namespace
829 } // namespace blink 823 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698