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

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

Issue 913473002: Testing a fix to crbug.com/456059. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: refactored Created 5 years, 10 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/dom/ScriptRunner.h ('k') | Source/core/html/HTMLScriptElement.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) 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 scriptLoader->detach(); 111 scriptLoader->detach();
112 m_document->decrementLoadEventDelayCount(); 112 m_document->decrementLoadEventDelayCount();
113 break; 113 break;
114 114
115 case IN_ORDER_EXECUTION: 115 case IN_ORDER_EXECUTION:
116 ASSERT(!m_scriptsToExecuteInOrder.isEmpty()); 116 ASSERT(!m_scriptsToExecuteInOrder.isEmpty());
117 break; 117 break;
118 } 118 }
119 } 119 }
120 120
121 void ScriptRunner::movePendingAsyncScript(Document& oldDocument, Document& newDo cument, ScriptLoader* scriptLoader)
122 {
123 RefPtrWillBeRawPtr<Document> newContextDocument = newDocument.contextDocumen t().get();
124 if (!newContextDocument) {
125 // Document's contextDocument() method will return no Document if the
126 // following conditions both hold:
127 //
128 // - The Document wasn't created with an explicit context document
129 // and that document is otherwise kept alive.
130 // - The Document itself is detached from its frame.
131 //
132 // The script element's loader is in that case moved to document() and
133 // its script runner, which is the non-null Document that contextDocumen t()
134 // would return if not detached.
135 ASSERT(!newDocument.frame());
136 newContextDocument = &newDocument;
137 }
138 RefPtrWillBeRawPtr<Document> oldContextDocument = oldDocument.contextDocumen t().get();
139 if (!oldContextDocument) {
140 ASSERT(!oldDocument.frame());
141 oldContextDocument = &oldDocument;
142 }
143 if (oldContextDocument != newContextDocument)
144 oldContextDocument->scriptRunner()->movePendingAsyncScript(newContextDoc ument->scriptRunner(), scriptLoader);
145 }
146
121 void ScriptRunner::movePendingAsyncScript(ScriptRunner* newRunner, ScriptLoader* scriptLoader) 147 void ScriptRunner::movePendingAsyncScript(ScriptRunner* newRunner, ScriptLoader* scriptLoader)
122 { 148 {
123 if (m_pendingAsyncScripts.contains(scriptLoader)) { 149 if (m_pendingAsyncScripts.contains(scriptLoader)) {
124 newRunner->addPendingAsyncScript(scriptLoader); 150 newRunner->addPendingAsyncScript(scriptLoader);
125 m_pendingAsyncScripts.remove(scriptLoader); 151 m_pendingAsyncScripts.remove(scriptLoader);
126 m_document->decrementLoadEventDelayCount(); 152 m_document->decrementLoadEventDelayCount();
127 } 153 }
128 } 154 }
129 155
130 void ScriptRunner::timerFired(Timer<ScriptRunner>* timer) 156 void ScriptRunner::timerFired(Timer<ScriptRunner>* timer)
(...skipping 22 matching lines...) Expand all
153 { 179 {
154 #if ENABLE(OILPAN) 180 #if ENABLE(OILPAN)
155 visitor->trace(m_document); 181 visitor->trace(m_document);
156 visitor->trace(m_scriptsToExecuteInOrder); 182 visitor->trace(m_scriptsToExecuteInOrder);
157 visitor->trace(m_scriptsToExecuteSoon); 183 visitor->trace(m_scriptsToExecuteSoon);
158 visitor->trace(m_pendingAsyncScripts); 184 visitor->trace(m_pendingAsyncScripts);
159 #endif 185 #endif
160 } 186 }
161 187
162 } 188 }
OLDNEW
« no previous file with comments | « Source/core/dom/ScriptRunner.h ('k') | Source/core/html/HTMLScriptElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698