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

Side by Side Diff: Source/platform/ThreadTimers.cpp

Issue 1087203002: Patch 2/3 to get WebScheduler via WebThread (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Style nits Created 5 years, 8 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
« no previous file with comments | « Source/core/html/parser/HTMLParserScheduler.cpp ('k') | Source/platform/WebScheduler.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 /* 1 /*
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 13 matching lines...) Expand all
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #include "config.h" 27 #include "config.h"
28 #include "platform/ThreadTimers.h" 28 #include "platform/ThreadTimers.h"
29 29
30 #include "platform/PlatformThreadData.h" 30 #include "platform/PlatformThreadData.h"
31 #include "platform/SharedTimer.h" 31 #include "platform/SharedTimer.h"
32 #include "platform/Timer.h" 32 #include "platform/Timer.h"
33 #include "platform/TraceEvent.h" 33 #include "platform/TraceEvent.h"
34 #include "platform/scheduler/Scheduler.h" 34 #include "public/platform/Platform.h"
35 #include "public/platform/WebScheduler.h"
35 #include "wtf/CurrentTime.h" 36 #include "wtf/CurrentTime.h"
36 #include "wtf/MainThread.h" 37 #include "wtf/MainThread.h"
37 38
38 namespace blink { 39 namespace blink {
39 40
40 // Fire timers for this length of time, and then quit to let the run loop proces s user input events. 41 // Fire timers for this length of time, and then quit to let the run loop proces s user input events.
41 // 100ms is about a perceptable delay in UI, so use a half of that as a threshol d. 42 // 100ms is about a perceptable delay in UI, so use a half of that as a threshol d.
42 // This is to prevent UI freeze when there are too many timers or machine perfor mance is low. 43 // This is to prevent UI freeze when there are too many timers or machine perfor mance is low.
43 static const double maxDurationOfFiringTimers = 0.050; 44 static const double maxDurationOfFiringTimers = 0.050;
44 45
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 timer.setNextFireTime(interval ? fireTime + interval : 0); 130 timer.setNextFireTime(interval ? fireTime + interval : 0);
130 131
131 TRACE_EVENT2("blink", "ThreadTimers::sharedTimerFiredInternal", 132 TRACE_EVENT2("blink", "ThreadTimers::sharedTimerFiredInternal",
132 "src_file", timer.location().fileName(), 133 "src_file", timer.location().fileName(),
133 "src_func", timer.location().functionName()); 134 "src_func", timer.location().functionName());
134 135
135 // Once the timer has been fired, it may be deleted, so do nothing else with it after this point. 136 // Once the timer has been fired, it may be deleted, so do nothing else with it after this point.
136 timer.fired(); 137 timer.fired();
137 138
138 // Catch the case where the timer asked timers to fire in a nested event loop, or we are over time limit. 139 // Catch the case where the timer asked timers to fire in a nested event loop, or we are over time limit.
139 if (!m_firingTimers || timeToQuit < monotonicallyIncreasingTime() || (is MainThread() && Scheduler::shared()->shouldYieldForHighPriorityWork())) 140 if (!m_firingTimers || timeToQuit < monotonicallyIncreasingTime()
141 || (isMainThread() && Platform::current()->currentThread()->schedule r()->shouldYieldForHighPriorityWork()))
140 break; 142 break;
141 } 143 }
142 144
143 m_firingTimers = false; 145 m_firingTimers = false;
144 146
145 updateSharedTimer(); 147 updateSharedTimer();
146 } 148 }
147 149
148 } // namespace blink 150 } // namespace blink
149 151
OLDNEW
« no previous file with comments | « Source/core/html/parser/HTMLParserScheduler.cpp ('k') | Source/platform/WebScheduler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698