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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 #endif 206 #endif
207 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(foundLoader); 207 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(foundLoader);
208 scheduleReadyInOrderScripts(); 208 scheduleReadyInOrderScripts();
209 break; 209 break;
210 } 210 }
211 m_document->decrementLoadEventDelayCount(); 211 m_document->decrementLoadEventDelayCount();
212 } 212 }
213 213
214 void ScriptRunner::movePendingScript(Document& oldDocument, Document& newDocumen t, ScriptLoader* scriptLoader) 214 void ScriptRunner::movePendingScript(Document& oldDocument, Document& newDocumen t, ScriptLoader* scriptLoader)
215 { 215 {
216 RefPtrWillBeRawPtr<Document> newContextDocument = newDocument.contextDocumen t().get(); 216 RawPtr<Document> newContextDocument = newDocument.contextDocument().get();
217 if (!newContextDocument) { 217 if (!newContextDocument) {
218 // Document's contextDocument() method will return no Document if the 218 // Document's contextDocument() method will return no Document if the
219 // following conditions both hold: 219 // following conditions both hold:
220 // 220 //
221 // - The Document wasn't created with an explicit context document 221 // - The Document wasn't created with an explicit context document
222 // and that document is otherwise kept alive. 222 // and that document is otherwise kept alive.
223 // - The Document itself is detached from its frame. 223 // - The Document itself is detached from its frame.
224 // 224 //
225 // The script element's loader is in that case moved to document() and 225 // The script element's loader is in that case moved to document() and
226 // its script runner, which is the non-null Document that contextDocumen t() 226 // its script runner, which is the non-null Document that contextDocumen t()
227 // would return if not detached. 227 // would return if not detached.
228 ASSERT(!newDocument.frame()); 228 ASSERT(!newDocument.frame());
229 newContextDocument = &newDocument; 229 newContextDocument = &newDocument;
230 } 230 }
231 RefPtrWillBeRawPtr<Document> oldContextDocument = oldDocument.contextDocumen t().get(); 231 RawPtr<Document> oldContextDocument = oldDocument.contextDocument().get();
232 if (!oldContextDocument) { 232 if (!oldContextDocument) {
233 ASSERT(!oldDocument.frame()); 233 ASSERT(!oldDocument.frame());
234 oldContextDocument = &oldDocument; 234 oldContextDocument = &oldDocument;
235 } 235 }
236 if (oldContextDocument != newContextDocument) 236 if (oldContextDocument != newContextDocument)
237 oldContextDocument->scriptRunner()->movePendingScript(newContextDocument ->scriptRunner(), scriptLoader); 237 oldContextDocument->scriptRunner()->movePendingScript(newContextDocument ->scriptRunner(), scriptLoader);
238 } 238 }
239 239
240 void ScriptRunner::movePendingScript(ScriptRunner* newRunner, ScriptLoader* scri ptLoader) 240 void ScriptRunner::movePendingScript(ScriptRunner* newRunner, ScriptLoader* scri ptLoader)
241 { 241 {
242 if (m_pendingAsyncScripts.contains(scriptLoader)) { 242 if (m_pendingAsyncScripts.contains(scriptLoader)) {
243 newRunner->queueScriptForExecution(scriptLoader, ASYNC_EXECUTION); 243 newRunner->queueScriptForExecution(scriptLoader, ASYNC_EXECUTION);
244 m_pendingAsyncScripts.remove(scriptLoader); 244 m_pendingAsyncScripts.remove(scriptLoader);
245 m_document->decrementLoadEventDelayCount(); 245 m_document->decrementLoadEventDelayCount();
246 return; 246 return;
247 } 247 }
248 if (removePendingInOrderScript(scriptLoader)) { 248 if (removePendingInOrderScript(scriptLoader)) {
249 newRunner->queueScriptForExecution(scriptLoader, IN_ORDER_EXECUTION); 249 newRunner->queueScriptForExecution(scriptLoader, IN_ORDER_EXECUTION);
250 m_document->decrementLoadEventDelayCount(); 250 m_document->decrementLoadEventDelayCount();
251 } 251 }
252 } 252 }
253 253
254 // Returns true if task was run, and false otherwise. 254 // Returns true if task was run, and false otherwise.
255 bool ScriptRunner::executeTaskFromQueue(WillBeHeapDeque<RawPtrWillBeMember<Scrip tLoader>>* taskQueue) 255 bool ScriptRunner::executeTaskFromQueue(HeapDeque<Member<ScriptLoader>>* taskQue ue)
256 { 256 {
257 if (taskQueue->isEmpty()) 257 if (taskQueue->isEmpty())
258 return false; 258 return false;
259 taskQueue->takeFirst()->execute(); 259 taskQueue->takeFirst()->execute();
260 260
261 m_document->decrementLoadEventDelayCount(); 261 m_document->decrementLoadEventDelayCount();
262 return true; 262 return true;
263 } 263 }
264 264
265 void ScriptRunner::executeTask() 265 void ScriptRunner::executeTask()
(...skipping 18 matching lines...) Expand all
284 #if ENABLE(OILPAN) 284 #if ENABLE(OILPAN)
285 visitor->trace(m_document); 285 visitor->trace(m_document);
286 visitor->trace(m_pendingInOrderScripts); 286 visitor->trace(m_pendingInOrderScripts);
287 visitor->trace(m_pendingAsyncScripts); 287 visitor->trace(m_pendingAsyncScripts);
288 visitor->trace(m_asyncScriptsToExecuteSoon); 288 visitor->trace(m_asyncScriptsToExecuteSoon);
289 visitor->trace(m_inOrderScriptsToExecuteSoon); 289 visitor->trace(m_inOrderScriptsToExecuteSoon);
290 #endif 290 #endif
291 } 291 }
292 292
293 } // namespace blink 293 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ScriptRunner.h ('k') | third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698