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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // (otherwise we'd cause a use-after-free in ~ScriptRunner when it tries | 199 // (otherwise we'd cause a use-after-free in ~ScriptRunner when it tries |
200 // to detach). | 200 // to detach). |
201 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(m_pendingAsyncScripts.contains(
scriptLoader)); | 201 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(m_pendingAsyncScripts.contains(
scriptLoader)); |
202 m_pendingAsyncScripts.remove(scriptLoader); | 202 m_pendingAsyncScripts.remove(scriptLoader); |
203 break; | 203 break; |
204 | 204 |
205 case IN_ORDER_EXECUTION: | 205 case IN_ORDER_EXECUTION: |
206 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(m_numberOfInOrderScriptsWithPen
dingNotification > 0); | 206 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(m_numberOfInOrderScriptsWithPen
dingNotification > 0); |
207 m_numberOfInOrderScriptsWithPendingNotification--; | 207 m_numberOfInOrderScriptsWithPendingNotification--; |
208 | 208 |
209 auto it = m_pendingInOrderScripts.begin(); | 209 bool foundPendingScript = false; |
210 for (; it != m_pendingInOrderScripts.end(); ++it) { | 210 for (auto it = m_pendingInOrderScripts.begin(); it != m_pendingInOrderSc
ripts.end(); ++it) { |
211 if (*it == scriptLoader) { | 211 if (*it == scriptLoader) { |
212 m_pendingInOrderScripts.remove(it); | 212 m_pendingInOrderScripts.remove(it); |
| 213 foundPendingScript = true; |
213 break; | 214 break; |
214 } | 215 } |
215 } | 216 } |
216 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(it != m_pendingInOrderScripts.e
nd()); | 217 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(foundPendingScript); |
217 break; | 218 break; |
218 } | 219 } |
219 scriptLoader->detach(); | 220 scriptLoader->detach(); |
220 m_document->decrementLoadEventDelayCount(); | 221 m_document->decrementLoadEventDelayCount(); |
221 } | 222 } |
222 | 223 |
223 void ScriptRunner::movePendingAsyncScript(Document& oldDocument, Document& newDo
cument, ScriptLoader* scriptLoader) | 224 void ScriptRunner::movePendingAsyncScript(Document& oldDocument, Document& newDo
cument, ScriptLoader* scriptLoader) |
224 { | 225 { |
225 RefPtrWillBeRawPtr<Document> newContextDocument = newDocument.contextDocumen
t().get(); | 226 RefPtrWillBeRawPtr<Document> newContextDocument = newDocument.contextDocumen
t().get(); |
226 if (!newContextDocument) { | 227 if (!newContextDocument) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 #if ENABLE(OILPAN) | 289 #if ENABLE(OILPAN) |
289 visitor->trace(m_document); | 290 visitor->trace(m_document); |
290 visitor->trace(m_pendingInOrderScripts); | 291 visitor->trace(m_pendingInOrderScripts); |
291 visitor->trace(m_pendingAsyncScripts); | 292 visitor->trace(m_pendingAsyncScripts); |
292 visitor->trace(m_asyncScriptsToExecuteSoon); | 293 visitor->trace(m_asyncScriptsToExecuteSoon); |
293 visitor->trace(m_inOrderScriptsToExecuteSoon); | 294 visitor->trace(m_inOrderScriptsToExecuteSoon); |
294 #endif | 295 #endif |
295 } | 296 } |
296 | 297 |
297 } // namespace blink | 298 } // namespace blink |
OLD | NEW |