OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 12 matching lines...) Expand all Loading... |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "core/dom/ScriptRunner.h" | 27 #include "core/dom/ScriptRunner.h" |
28 | 28 |
29 #include "core/dom/Document.h" | 29 #include "core/dom/Document.h" |
30 #include "core/dom/Element.h" | 30 #include "core/dom/Element.h" |
31 #include "core/dom/ScriptLoader.h" | 31 #include "core/dom/ScriptLoader.h" |
32 #include "platform/heap/Handle.h" | 32 #include "platform/heap/Handle.h" |
33 #include "platform/scheduler/Scheduler.h" | 33 #include "public/platform/Platform.h" |
| 34 #include "public/platform/WebScheduler.h" |
| 35 #include "public/platform/WebThread.h" |
34 #include "wtf/Functional.h" | 36 #include "wtf/Functional.h" |
35 | 37 |
36 // This bit of magic is needed by oilpan to prevent the ScriptRunner from leakin
g. | 38 // This bit of magic is needed by oilpan to prevent the ScriptRunner from leakin
g. |
37 namespace WTF { | 39 namespace WTF { |
38 template<> | 40 template<> |
39 struct ParamStorageTraits<blink::ScriptRunner*> : public PointerParamStorageTrai
ts<blink::ScriptRunner*, false> { | 41 struct ParamStorageTraits<blink::ScriptRunner*> : public PointerParamStorageTrai
ts<blink::ScriptRunner*, false> { |
40 }; | 42 }; |
41 } | 43 } |
42 | 44 |
43 namespace blink { | 45 namespace blink { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 ScriptLoader* script = scriptLoaders.takeLast(); | 205 ScriptLoader* script = scriptLoaders.takeLast(); |
204 if (inorderSet.contains(script)) | 206 if (inorderSet.contains(script)) |
205 m_scriptsToExecuteInOrder.prepend(script); | 207 m_scriptsToExecuteInOrder.prepend(script); |
206 else | 208 else |
207 m_scriptsToExecuteSoon.prepend(script); | 209 m_scriptsToExecuteSoon.prepend(script); |
208 } | 210 } |
209 } | 211 } |
210 | 212 |
211 bool ScriptRunner::yieldForHighPriorityWork() | 213 bool ScriptRunner::yieldForHighPriorityWork() |
212 { | 214 { |
213 if (!Scheduler::shared()->shouldYieldForHighPriorityWork()) | 215 if (!Platform::current()->currentThread()->scheduler()->shouldYieldForHighPr
iorityWork()) |
214 return false; | 216 return false; |
215 | 217 |
216 postTaskIfOneIsNotAlreadyInFlight(); | 218 postTaskIfOneIsNotAlreadyInFlight(); |
217 return true; | 219 return true; |
218 } | 220 } |
219 | 221 |
220 void ScriptRunner::postTaskIfOneIsNotAlreadyInFlight() | 222 void ScriptRunner::postTaskIfOneIsNotAlreadyInFlight() |
221 { | 223 { |
222 if (m_executeScriptsTaskFactory.isPending()) | 224 if (m_executeScriptsTaskFactory.isPending()) |
223 return; | 225 return; |
224 | 226 |
225 // FIXME: Rename task() so that it's obvious it cancels any pending task. | 227 // FIXME: Rename task() so that it's obvious it cancels any pending task. |
226 Scheduler::shared()->postLoadingTask(FROM_HERE, m_executeScriptsTaskFactory.
task()); | 228 Platform::current()->currentThread()->scheduler()->postLoadingTask(FROM_HERE
, m_executeScriptsTaskFactory.task()); |
227 } | 229 } |
228 | 230 |
229 DEFINE_TRACE(ScriptRunner) | 231 DEFINE_TRACE(ScriptRunner) |
230 { | 232 { |
231 #if ENABLE(OILPAN) | 233 #if ENABLE(OILPAN) |
232 visitor->trace(m_document); | 234 visitor->trace(m_document); |
233 visitor->trace(m_scriptsToExecuteInOrder); | 235 visitor->trace(m_scriptsToExecuteInOrder); |
234 visitor->trace(m_scriptsToExecuteSoon); | 236 visitor->trace(m_scriptsToExecuteSoon); |
235 visitor->trace(m_pendingAsyncScripts); | 237 visitor->trace(m_pendingAsyncScripts); |
236 #endif | 238 #endif |
237 } | 239 } |
238 | 240 |
239 } | 241 } |
OLD | NEW |