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

Side by Side Diff: third_party/WebKit/Source/core/dom/IdleDeadline.cpp

Issue 2843503002: scheduler: Move WebFrameScheduler and WebScheduler into Blink (Closed)
Patch Set: Build fix Created 3 years, 7 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 "core/dom/IdleDeadline.h" 5 #include "core/dom/IdleDeadline.h"
6 6
7 #include "core/timing/PerformanceBase.h" 7 #include "core/timing/PerformanceBase.h"
8 #include "platform/scheduler/child/web_scheduler.h"
8 #include "platform/wtf/CurrentTime.h" 9 #include "platform/wtf/CurrentTime.h"
9 #include "public/platform/Platform.h" 10 #include "public/platform/Platform.h"
10 #include "public/platform/WebScheduler.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 IdleDeadline::IdleDeadline(double deadline_seconds, CallbackType callback_type) 14 IdleDeadline::IdleDeadline(double deadline_seconds, CallbackType callback_type)
15 : deadline_seconds_(deadline_seconds), callback_type_(callback_type) {} 15 : deadline_seconds_(deadline_seconds), callback_type_(callback_type) {}
16 16
17 double IdleDeadline::timeRemaining() const { 17 double IdleDeadline::timeRemaining() const {
18 double time_remaining = deadline_seconds_ - MonotonicallyIncreasingTime(); 18 double time_remaining = deadline_seconds_ - MonotonicallyIncreasingTime();
19 if (time_remaining < 0) { 19 if (time_remaining < 0) {
20 time_remaining = 0; 20 time_remaining = 0;
21 } else if (Platform::Current() 21 } else if (Platform::Current()
22 ->CurrentThread() 22 ->CurrentThread()
23 ->Scheduler() 23 ->Scheduler()
24 ->ShouldYieldForHighPriorityWork()) { 24 ->ShouldYieldForHighPriorityWork()) {
25 time_remaining = 0; 25 time_remaining = 0;
26 } 26 }
27 27
28 return 1000.0 * PerformanceBase::ClampTimeResolution(time_remaining); 28 return 1000.0 * PerformanceBase::ClampTimeResolution(time_remaining);
29 } 29 }
30 30
31 } // namespace blink 31 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/dom/IdleDeadlineTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698