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

Side by Side Diff: Source/platform/scheduler/Scheduler.cpp

Issue 595023002: Implement idle task scheduling. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix whitespace Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/scheduler/Scheduler.h ('k') | Source/platform/scheduler/SchedulerTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/PlatformThreadData.h" 8 #include "platform/PlatformThreadData.h"
9 #include "platform/Task.h" 9 #include "platform/Task.h"
10 #include "platform/ThreadTimers.h" 10 #include "platform/ThreadTimers.h"
11 #include "platform/TraceEvent.h" 11 #include "platform/TraceEvent.h"
12 #include "public/platform/Platform.h" 12 #include "public/platform/Platform.h"
13 #include "wtf/MainThread.h" 13 #include "wtf/MainThread.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 namespace { 17 namespace {
18 18
19 // The time we should stay in CompositorPriority mode for, after a touch event. 19 // The time we should stay in CompositorPriority mode for, after a touch event.
20 double kLowSchedulerPolicyAfterTouchTimeSeconds = 0.1; 20 double kLowSchedulerPolicyAfterTouchTimeSeconds = 0.1;
21 21
22 // Can be created from any thread.
23 // Note if the scheduler gets shutdown, this may be run after.
24 class MainThreadIdleTaskAdapter : public WebThread::Task {
25 public:
26 MainThreadIdleTaskAdapter(const Scheduler::IdleTask& idleTask, double allott edTimeMs, const TraceLocation& location)
27 : m_idleTask(idleTask)
28 , m_allottedTimeMs(allottedTimeMs)
29 , m_location(location)
30 {
31 }
32
33 // WebThread::Task implementation.
34 virtual void run() OVERRIDE
35 {
36 TRACE_EVENT2("blink", "MainThreadIdleTaskAdapter::run",
37 "src_file", m_location.fileName(),
38 "src_func", m_location.functionName());
39 m_idleTask(m_allottedTimeMs);
40 }
41
42 private:
43 Scheduler::IdleTask m_idleTask;
44 double m_allottedTimeMs;
45 TraceLocation m_location;
46 };
47
48 } // namespace 22 } // namespace
49 23
50 // Typically only created from compositor or render threads. 24 // Typically only created from compositor or render threads.
51 // Note if the scheduler gets shutdown, this may be run after. 25 // Note if the scheduler gets shutdown, this may be run after.
52 class Scheduler::MainThreadPendingHighPriorityTaskRunner : public WebThread::Tas k { 26 class Scheduler::MainThreadPendingHighPriorityTaskRunner : public WebThread::Tas k {
53 public: 27 public:
54 MainThreadPendingHighPriorityTaskRunner() 28 MainThreadPendingHighPriorityTaskRunner()
55 { 29 {
56 ASSERT(Scheduler::shared()); 30 ASSERT(Scheduler::shared());
57 } 31 }
(...skipping 21 matching lines...) Expand all
79 const Scheduler::Task& task, const TraceLocation& location, const char* traceName) 53 const Scheduler::Task& task, const TraceLocation& location, const char* traceName)
80 : m_task(task, location, traceName) 54 : m_task(task, location, traceName)
81 { 55 {
82 ASSERT(Scheduler::shared()); 56 ASSERT(Scheduler::shared());
83 } 57 }
84 58
85 // WebThread::Task implementation. 59 // WebThread::Task implementation.
86 virtual void run() OVERRIDE 60 virtual void run() OVERRIDE
87 { 61 {
88 Scheduler* scheduler = Scheduler::shared(); 62 Scheduler* scheduler = Scheduler::shared();
89 // FIXME: This check should't be necessary, tasks should not outlive bli nk. 63 // FIXME: This check shouldn't be necessary, tasks should not outlive bl ink.
90 ASSERT(scheduler); 64 ASSERT(scheduler);
91 if (scheduler) 65 if (scheduler)
92 Scheduler::shared()->runPendingHighPriorityTasksIfInCompositorPriori ty(); 66 scheduler->runPendingHighPriorityTasksIfInCompositorPriority();
67
93 m_task.run(); 68 m_task.run();
94 } 69 }
95 70
96 TracedTask m_task; 71 private:
72 TracedStandardTask m_task;
97 }; 73 };
98 74
75
76 // Can be created from any thread.
77 // Note if the scheduler gets shutdown, this may be run after.
78 class Scheduler::MainThreadPendingIdleTaskRunner : public WebThread::Task {
79 public:
80 MainThreadPendingIdleTaskRunner()
81 {
82 ASSERT(Scheduler::shared());
83 }
84
85 // WebThread::Task implementation.
86 virtual void run() OVERRIDE
87 {
88 Scheduler* scheduler = Scheduler::shared();
89 // FIXME: This check shouldn't be necessary, tasks should not outlive bl ink.
90 ASSERT(scheduler);
91 if (scheduler) {
92 scheduler->maybeRunPendingIdleTask();
93 // If possible, run the next idle task by reposting on the main thre ad.
94 scheduler->maybePostMainThreadPendingIdleTask();
95 }
96 }
97
98 };
99
100
99 Scheduler* Scheduler::s_sharedScheduler = nullptr; 101 Scheduler* Scheduler::s_sharedScheduler = nullptr;
100 102
101 void Scheduler::initializeOnMainThread() 103 void Scheduler::initializeOnMainThread()
102 { 104 {
103 s_sharedScheduler = new Scheduler(); 105 s_sharedScheduler = new Scheduler();
104 } 106 }
105 107
106 void Scheduler::shutdown() 108 void Scheduler::shutdown()
107 { 109 {
108 delete s_sharedScheduler; 110 delete s_sharedScheduler;
109 s_sharedScheduler = nullptr; 111 s_sharedScheduler = nullptr;
110 } 112 }
111 113
112 Scheduler* Scheduler::shared() 114 Scheduler* Scheduler::shared()
113 { 115 {
114 return s_sharedScheduler; 116 return s_sharedScheduler;
115 } 117 }
116 118
117 Scheduler::Scheduler() 119 Scheduler::Scheduler()
118 : m_sharedTimerFunction(nullptr) 120 : m_sharedTimerFunction(nullptr)
119 , m_mainThread(blink::Platform::current()->currentThread()) 121 , m_mainThread(blink::Platform::current()->currentThread())
120 , m_compositorPriorityPolicyEndTimeSeconds(0) 122 , m_compositorPriorityPolicyEndTimeSeconds(0)
123 , m_currentFrameDeadlineSeconds(0)
121 , m_highPriorityTaskCount(0) 124 , m_highPriorityTaskCount(0)
122 , m_highPriorityTaskRunnerPosted(false) 125 , m_highPriorityTaskRunnerPosted(false)
123 , m_schedulerPolicy(Normal) 126 , m_schedulerPolicy(Normal)
124 { 127 {
125 } 128 }
126 129
127 Scheduler::~Scheduler() 130 Scheduler::~Scheduler()
128 { 131 {
129 while (hasPendingHighPriorityWork()) { 132 while (hasPendingHighPriorityWork()) {
130 swapQueuesAndRunPendingTasks(); 133 swapQueuesAndRunPendingTasks();
131 } 134 }
132 } 135 }
133 136
134 void Scheduler::willBeginFrame(const WebBeginFrameArgs& args) 137 void Scheduler::willBeginFrame(double frameDeadlineSeconds)
Sami 2014/10/06 13:49:42 Please call this something else than a deadline be
rmcilroy 2014/10/06 14:16:25 Renamed arg and also member to (m_)estimatedNextBe
135 { 138 {
136 // TODO: Use frame deadline and interval to schedule idle tasks. 139 ASSERT(isMainThread());
140 m_currentFrameCommitted = false;
141 m_currentFrameDeadlineSeconds = frameDeadlineSeconds;
142 // TODO: Schedule a deferred task here to run idle work if didCommitFrameToC ompositor never get's called
137 } 143 }
138 144
139 void Scheduler::didCommitFrameToCompositor() 145 void Scheduler::didCommitFrameToCompositor()
140 { 146 {
141 // TODO: Trigger the frame deadline immediately. 147 ASSERT(isMainThread());
142 } 148 m_currentFrameCommitted = true;
143 149 maybePostMainThreadPendingIdleTask();
144 void Scheduler::scheduleIdleTask(const TraceLocation& location, const IdleTask& idleTask)
145 {
146 // TODO: send a real allottedTime here.
147 m_mainThread->postTask(new MainThreadIdleTaskAdapter(idleTask, 0, location)) ;
148 } 150 }
149 151
150 void Scheduler::postHighPriorityTaskInternal(const TraceLocation& location, cons t Task& task, const char* traceName) 152 void Scheduler::postHighPriorityTaskInternal(const TraceLocation& location, cons t Task& task, const char* traceName)
151 { 153 {
152 Locker<Mutex> lock(m_pendingTasksMutex); 154 Locker<Mutex> lock(m_pendingTasksMutex);
153 155
154 m_pendingHighPriorityTasks.append(TracedTask(task, location, traceName)); 156 m_pendingHighPriorityTasks.append(TracedStandardTask(task, location, traceNa me));
155 atomicIncrement(&m_highPriorityTaskCount); 157 atomicIncrement(&m_highPriorityTaskCount);
156 maybePostMainThreadPendingHighPriorityTaskRunner(); 158 maybePostMainThreadPendingHighPriorityTaskRunner();
157 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink.scheduler"), "PendingHighPri orityTasks", m_highPriorityTaskCount); 159 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink.scheduler"), "PendingHighPri orityTasks", m_highPriorityTaskCount);
158 } 160 }
159 161
162 void Scheduler::postIdleTaskInternal(const TraceLocation& location, const IdleTa sk& idleTask, const char* traceName)
163 {
164 Locker<Mutex> lock(m_pendingTasksMutex);
165 m_pendingIdleTasks.append(TracedIdleTask(idleTask, location, traceName));
166 }
167
160 void Scheduler::postTask(const TraceLocation& location, const Task& task) 168 void Scheduler::postTask(const TraceLocation& location, const Task& task)
161 { 169 {
162 m_mainThread->postTask(new MainThreadPendingTaskRunner(task, location, "Sche duler::MainThreadTask")); 170 m_mainThread->postTask(new MainThreadPendingTaskRunner(task, location, "Sche duler::MainThreadTask"));
163 } 171 }
164 172
165 void Scheduler::postInputTask(const TraceLocation& location, const Task& task) 173 void Scheduler::postInputTask(const TraceLocation& location, const Task& task)
166 { 174 {
167 postHighPriorityTaskInternal(location, task, "Scheduler::InputTask"); 175 postHighPriorityTaskInternal(location, task, "Scheduler::InputTask");
168 } 176 }
169 177
170 void Scheduler::didReceiveInputEvent() 178 void Scheduler::didReceiveInputEvent()
171 { 179 {
172 enterSchedulerPolicy(CompositorPriority); 180 enterSchedulerPolicy(CompositorPriority);
173 } 181 }
174 182
175 void Scheduler::postCompositorTask(const TraceLocation& location, const Task& ta sk) 183 void Scheduler::postCompositorTask(const TraceLocation& location, const Task& ta sk)
176 { 184 {
177 postHighPriorityTaskInternal(location, task, "Scheduler::CompositorTask"); 185 postHighPriorityTaskInternal(location, task, "Scheduler::CompositorTask");
178 } 186 }
179 187
180 void Scheduler::postIpcTask(const TraceLocation& location, const Task& task) 188 void Scheduler::postIpcTask(const TraceLocation& location, const Task& task)
181 { 189 {
182 // FIXME: we want IPCs to be high priority, but we can't currently do that b ecause some of them can take a very long 190 // FIXME: we want IPCs to be high priority, but we can't currently do that b ecause some of them can take a very long
183 // time to process. These need refactoring but we need to add some infrastru cture to identify them. 191 // time to process. These need refactoring but we need to add some infrastru cture to identify them.
184 m_mainThread->postTask(new MainThreadPendingTaskRunner(task, location, "Sche duler::IpcTask")); 192 m_mainThread->postTask(new MainThreadPendingTaskRunner(task, location, "Sche duler::IpcTask"));
185 } 193 }
186 194
195 void Scheduler::postIdleTask(const TraceLocation& location, const IdleTask& idle Task)
196 {
197 postIdleTaskInternal(location, idleTask, "Scheduler::IdleTask");
198 }
199
187 void Scheduler::maybePostMainThreadPendingHighPriorityTaskRunner() 200 void Scheduler::maybePostMainThreadPendingHighPriorityTaskRunner()
188 { 201 {
189 ASSERT(m_pendingTasksMutex.locked()); 202 ASSERT(m_pendingTasksMutex.locked());
190 if (m_highPriorityTaskRunnerPosted) 203 if (m_highPriorityTaskRunnerPosted)
191 return; 204 return;
192 m_mainThread->postTask(new MainThreadPendingHighPriorityTaskRunner()); 205 m_mainThread->postTask(new MainThreadPendingHighPriorityTaskRunner());
193 m_highPriorityTaskRunnerPosted = true; 206 m_highPriorityTaskRunnerPosted = true;
194 } 207 }
195 208
196 void Scheduler::postIdleTask(const TraceLocation& location, const IdleTask& idle Task) 209 bool Scheduler::maybePostMainThreadPendingIdleTask()
197 { 210 {
198 scheduleIdleTask(location, idleTask); 211 ASSERT(isMainThread());
212 TRACE_EVENT0("blink", "Scheduler::maybePostMainThreadPendingIdleTask");
213 if (canRunIdleTask()) {
214 Locker<Mutex> lock(m_pendingTasksMutex);
215 if (!m_pendingIdleTasks.isEmpty()) {
216 m_mainThread->postTask(new MainThreadPendingIdleTaskRunner());
217 return true;
218 }
219 }
220 return false;
199 } 221 }
200 222
201 void Scheduler::tickSharedTimer() 223 void Scheduler::tickSharedTimer()
202 { 224 {
203 TRACE_EVENT0("blink", "Scheduler::tickSharedTimer"); 225 TRACE_EVENT0("blink", "Scheduler::tickSharedTimer");
204 226
205 // Run any high priority tasks that are queued up, otherwise the blink timer s will yield immediately. 227 // Run any high priority tasks that are queued up, otherwise the blink timer s will yield immediately.
206 bool workDone = runPendingHighPriorityTasksIfInCompositorPriority(); 228 bool workDone = runPendingHighPriorityTasksIfInCompositorPriority();
207 m_sharedTimerFunction(); 229 m_sharedTimerFunction();
208 230
209 // The blink timers may have just yielded, so run any high priority tasks th at where queued up 231 // The blink timers may have just yielded, so run any high priority tasks th at where queued up
210 // while the blink timers were executing. 232 // while the blink timers were executing.
211 if (!workDone) 233 if (!workDone)
212 runPendingHighPriorityTasksIfInCompositorPriority(); 234 runPendingHighPriorityTasksIfInCompositorPriority();
213 } 235 }
214 236
215 bool Scheduler::runPendingHighPriorityTasksIfInCompositorPriority() 237 bool Scheduler::runPendingHighPriorityTasksIfInCompositorPriority()
216 { 238 {
217 ASSERT(isMainThread()); 239 ASSERT(isMainThread());
218 if (schedulerPolicy() != CompositorPriority) 240 if (schedulerPolicy() != CompositorPriority)
219 return false; 241 return false;
220 242
221 return swapQueuesAndRunPendingTasks(); 243 return swapQueuesAndRunPendingTasks();
222 } 244 }
223 245
246 bool Scheduler::maybeRunPendingIdleTask()
247 {
248 ASSERT(isMainThread());
249 if (!canRunIdleTask())
250 return false;
251
252 takeFirstPendingIdleTask().run();
253 return true;
254 }
255
256 TracedIdleTask Scheduler::takeFirstPendingIdleTask()
257 {
258 Locker<Mutex> lock(m_pendingTasksMutex);
259 ASSERT(!m_pendingIdleTasks.isEmpty());
260 return m_pendingIdleTasks.takeFirst();
261 }
262
224 bool Scheduler::swapQueuesAndRunPendingTasks() 263 bool Scheduler::swapQueuesAndRunPendingTasks()
225 { 264 {
226 ASSERT(isMainThread()); 265 ASSERT(isMainThread());
227 266
228 // These locks guard against another thread posting input or compositor task s while we swap the buffers. 267 // These locks guard against another thread posting input or compositor task s while we swap the buffers.
229 // One the buffers have been swapped we can safely access the returned deque without having to lock. 268 // One the buffers have been swapped we can safely access the returned deque without having to lock.
230 m_pendingTasksMutex.lock(); 269 m_pendingTasksMutex.lock();
231 Deque<TracedTask>& highPriorityTasks = m_pendingHighPriorityTasks.swapBuffer s(); 270 Deque<TracedStandardTask>& highPriorityTasks = m_pendingHighPriorityTasks.sw apBuffers();
232 maybeEnterNormalSchedulerPolicy(); 271 maybeEnterNormalSchedulerPolicy();
233 m_pendingTasksMutex.unlock(); 272 m_pendingTasksMutex.unlock();
234 return executeHighPriorityTasks(highPriorityTasks); 273 return executeHighPriorityTasks(highPriorityTasks);
235 } 274 }
236 275
237 void Scheduler::swapQueuesRunPendingTasksAndAllowHighPriorityTaskRunnerPosting() 276 void Scheduler::swapQueuesRunPendingTasksAndAllowHighPriorityTaskRunnerPosting()
238 { 277 {
239 ASSERT(isMainThread()); 278 ASSERT(isMainThread());
240 279
241 // These locks guard against another thread posting input or compositor task s while we swap the buffers. 280 // These locks guard against another thread posting input or compositor task s while we swap the buffers.
242 // One the buffers have been swapped we can safely access the returned deque without having to lock. 281 // One the buffers have been swapped we can safely access the returned deque without having to lock.
243 m_pendingTasksMutex.lock(); 282 m_pendingTasksMutex.lock();
244 Deque<TracedTask>& highPriorityTasks = m_pendingHighPriorityTasks.swapBuffer s(); 283 Deque<TracedStandardTask>& highPriorityTasks = m_pendingHighPriorityTasks.sw apBuffers();
245 m_highPriorityTaskRunnerPosted = false; 284 m_highPriorityTaskRunnerPosted = false;
246 maybeEnterNormalSchedulerPolicy(); 285 maybeEnterNormalSchedulerPolicy();
247 m_pendingTasksMutex.unlock(); 286 m_pendingTasksMutex.unlock();
248 executeHighPriorityTasks(highPriorityTasks); 287 executeHighPriorityTasks(highPriorityTasks);
249 } 288 }
250 289
251 void Scheduler::maybeEnterNormalSchedulerPolicy() 290 void Scheduler::maybeEnterNormalSchedulerPolicy()
252 { 291 {
253 ASSERT(isMainThread()); 292 ASSERT(isMainThread());
254 ASSERT(m_pendingTasksMutex.locked()); 293 ASSERT(m_pendingTasksMutex.locked());
255 294
256 // Go back to the normal scheduler policy if enough time has elapsed. 295 // Go back to the normal scheduler policy if enough time has elapsed.
257 if (schedulerPolicy() == CompositorPriority && Platform::current()->monotoni callyIncreasingTime() > m_compositorPriorityPolicyEndTimeSeconds) 296 if (schedulerPolicy() == CompositorPriority && Platform::current()->monotoni callyIncreasingTime() > m_compositorPriorityPolicyEndTimeSeconds)
258 enterSchedulerPolicyLocked(Normal); 297 enterSchedulerPolicyLocked(Normal);
259 } 298 }
260 299
261 bool Scheduler::executeHighPriorityTasks(Deque<TracedTask>& highPriorityTasks) 300 bool Scheduler::executeHighPriorityTasks(Deque<TracedStandardTask>& highPriority Tasks)
262 { 301 {
263 TRACE_EVENT0("blink", "Scheduler::executeHighPriorityTasks"); 302 TRACE_EVENT0("blink", "Scheduler::executeHighPriorityTasks");
264 int highPriorityTasksExecuted = 0; 303 int highPriorityTasksExecuted = 0;
265 while (!highPriorityTasks.isEmpty()) { 304 while (!highPriorityTasks.isEmpty()) {
266 highPriorityTasks.takeFirst().run(); 305 highPriorityTasks.takeFirst().run();
267 highPriorityTasksExecuted++; 306 highPriorityTasksExecuted++;
268 } 307 }
269 308
270 int highPriorityTaskCount = atomicSubtract(&m_highPriorityTaskCount, highPri orityTasksExecuted); 309 int highPriorityTaskCount = atomicSubtract(&m_highPriorityTaskCount, highPri orityTasksExecuted);
271 ASSERT_UNUSED(highPriorityTaskCount, highPriorityTaskCount >= 0); 310 ASSERT_UNUSED(highPriorityTaskCount, highPriorityTaskCount >= 0);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 bool Scheduler::hasPendingHighPriorityWork() const 345 bool Scheduler::hasPendingHighPriorityWork() const
307 { 346 {
308 // This method is expected to be run on the main thread, but the high priori ty tasks will be posted by 347 // This method is expected to be run on the main thread, but the high priori ty tasks will be posted by
309 // other threads. We could use locks here, but this function is (sometimes) called a lot by 348 // other threads. We could use locks here, but this function is (sometimes) called a lot by
310 // ThreadTimers::sharedTimerFiredInternal so we decided to use atomics + bar rier loads here which 349 // ThreadTimers::sharedTimerFiredInternal so we decided to use atomics + bar rier loads here which
311 // should be cheaper. 350 // should be cheaper.
312 // NOTE it's possible the barrier read is overkill here, since delayed yield ing isn't a big deal. 351 // NOTE it's possible the barrier read is overkill here, since delayed yield ing isn't a big deal.
313 return acquireLoad(&m_highPriorityTaskCount) != 0; 352 return acquireLoad(&m_highPriorityTaskCount) != 0;
314 } 353 }
315 354
355 double Scheduler::currentFrameDeadlineForIdleTasks() const
356 {
357 ASSERT(isMainThread());
358 // TODO: Make idle time more fine-grain chunks when in Compositor priority.
359 return m_currentFrameDeadlineSeconds;
360 }
361
362 bool Scheduler::canRunIdleTask() const
363 {
364 ASSERT(isMainThread());
365 return m_currentFrameCommitted
366 && !shouldYieldForHighPriorityWork()
367 && (m_currentFrameDeadlineSeconds > Platform::current()->monotonicallyIn creasingTime());
368 }
369
316 Scheduler::SchedulerPolicy Scheduler::schedulerPolicy() const 370 Scheduler::SchedulerPolicy Scheduler::schedulerPolicy() const
317 { 371 {
318 ASSERT(isMainThread()); 372 ASSERT(isMainThread());
319 // It's important not to miss the transition from normal to low latency mode , otherwise we're likely to 373 // It's important not to miss the transition from normal to low latency mode , otherwise we're likely to
320 // delay the processing of input tasks. Since that transition is triggered b y a different thread, we 374 // delay the processing of input tasks. Since that transition is triggered b y a different thread, we
321 // need either a lock or a memory barrier, and the memory barrier is probabl y cheaper. 375 // need either a lock or a memory barrier, and the memory barrier is probabl y cheaper.
322 return static_cast<SchedulerPolicy>(acquireLoad(&m_schedulerPolicy)); 376 return static_cast<SchedulerPolicy>(acquireLoad(&m_schedulerPolicy));
323 } 377 }
324 378
325 void Scheduler::enterSchedulerPolicy(SchedulerPolicy schedulerPolicy) 379 void Scheduler::enterSchedulerPolicy(SchedulerPolicy schedulerPolicy)
326 { 380 {
327 Locker<Mutex> lock(m_pendingTasksMutex); 381 Locker<Mutex> lock(m_pendingTasksMutex);
328 enterSchedulerPolicyLocked(schedulerPolicy); 382 enterSchedulerPolicyLocked(schedulerPolicy);
329 } 383 }
330 384
331 void Scheduler::enterSchedulerPolicyLocked(SchedulerPolicy schedulerPolicy) 385 void Scheduler::enterSchedulerPolicyLocked(SchedulerPolicy schedulerPolicy)
332 { 386 {
333 ASSERT(m_pendingTasksMutex.locked()); 387 ASSERT(m_pendingTasksMutex.locked());
334 if (schedulerPolicy == CompositorPriority) 388 if (schedulerPolicy == CompositorPriority)
335 m_compositorPriorityPolicyEndTimeSeconds = Platform::current()->monotoni callyIncreasingTime() + kLowSchedulerPolicyAfterTouchTimeSeconds; 389 m_compositorPriorityPolicyEndTimeSeconds = Platform::current()->monotoni callyIncreasingTime() + kLowSchedulerPolicyAfterTouchTimeSeconds;
336 390
337 releaseStore(&m_schedulerPolicy, schedulerPolicy); 391 releaseStore(&m_schedulerPolicy, schedulerPolicy);
338 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink.scheduler"), "SchedulerPolic y", schedulerPolicy); 392 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink.scheduler"), "SchedulerPolic y", schedulerPolicy);
339 } 393 }
340 394
341 } // namespace blink 395 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/scheduler/Scheduler.h ('k') | Source/platform/scheduler/SchedulerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698