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

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

Issue 1380543002: On Document disposal, only dispose of script runner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert static method Created 5 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/ScriptRunner.h ('k') | no next file » | 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) 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 30 matching lines...) Expand all
41 ScriptRunner::ScriptRunner(Document* document) 41 ScriptRunner::ScriptRunner(Document* document)
42 : m_document(document) 42 : m_document(document)
43 , m_executeScriptsTaskFactory(CancellableTaskFactory::create(this, &ScriptRu nner::executeScripts)) 43 , m_executeScriptsTaskFactory(CancellableTaskFactory::create(this, &ScriptRu nner::executeScripts))
44 { 44 {
45 ASSERT(document); 45 ASSERT(document);
46 } 46 }
47 47
48 ScriptRunner::~ScriptRunner() 48 ScriptRunner::~ScriptRunner()
49 { 49 {
50 #if !ENABLE(OILPAN) 50 #if !ENABLE(OILPAN)
51 dispose();
52 #endif
53 }
54
55 #if !ENABLE(OILPAN)
56 void ScriptRunner::dispose()
57 {
51 // Make sure that ScriptLoaders don't keep their PendingScripts alive. 58 // Make sure that ScriptLoaders don't keep their PendingScripts alive.
52 for (ScriptLoader* scriptLoader : m_scriptsToExecuteInOrder) 59 for (ScriptLoader* scriptLoader : m_scriptsToExecuteInOrder)
53 scriptLoader->detach(); 60 scriptLoader->detach();
54 for (ScriptLoader* scriptLoader : m_scriptsToExecuteSoon) 61 for (ScriptLoader* scriptLoader : m_scriptsToExecuteSoon)
55 scriptLoader->detach(); 62 scriptLoader->detach();
56 for (ScriptLoader* scriptLoader : m_pendingAsyncScripts) 63 for (ScriptLoader* scriptLoader : m_pendingAsyncScripts)
57 scriptLoader->detach(); 64 scriptLoader->detach();
65
66 m_scriptsToExecuteInOrder.clear();
67 m_scriptsToExecuteSoon.clear();
68 m_pendingAsyncScripts.clear();
69 }
58 #endif 70 #endif
59 }
60 71
61 void ScriptRunner::addPendingAsyncScript(ScriptLoader* scriptLoader) 72 void ScriptRunner::addPendingAsyncScript(ScriptLoader* scriptLoader)
62 { 73 {
63 m_document->incrementLoadEventDelayCount(); 74 m_document->incrementLoadEventDelayCount();
64 m_pendingAsyncScripts.add(scriptLoader); 75 m_pendingAsyncScripts.add(scriptLoader);
65 } 76 }
66 77
67 void ScriptRunner::queueScriptForExecution(ScriptLoader* scriptLoader, Execution Type executionType) 78 void ScriptRunner::queueScriptForExecution(ScriptLoader* scriptLoader, Execution Type executionType)
68 { 79 {
69 ASSERT(scriptLoader); 80 ASSERT(scriptLoader);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 { 235 {
225 #if ENABLE(OILPAN) 236 #if ENABLE(OILPAN)
226 visitor->trace(m_document); 237 visitor->trace(m_document);
227 visitor->trace(m_scriptsToExecuteInOrder); 238 visitor->trace(m_scriptsToExecuteInOrder);
228 visitor->trace(m_scriptsToExecuteSoon); 239 visitor->trace(m_scriptsToExecuteSoon);
229 visitor->trace(m_pendingAsyncScripts); 240 visitor->trace(m_pendingAsyncScripts);
230 #endif 241 #endif
231 } 242 }
232 243
233 } // namespace blink 244 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ScriptRunner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698