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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // Clear the pending script before possible rentrancy from executeScript() | 145 // Clear the pending script before possible rentrancy from executeScript() |
146 RefPtrWillBeRawPtr<Element> element = pendingScript.releaseElementAndClear()
; | 146 RefPtrWillBeRawPtr<Element> element = pendingScript.releaseElementAndClear()
; |
147 double compilationFinishTime = 0; | 147 double compilationFinishTime = 0; |
148 if (ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element.get())) { | 148 if (ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element.get())) { |
149 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel); | 149 NestingLevelIncrementer nestingLevelIncrementer(m_scriptNestingLevel); |
150 IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrem
enter(m_document); | 150 IgnoreDestructiveWriteCountIncrementer ignoreDestructiveWriteCountIncrem
enter(m_document); |
151 if (errorOccurred) | 151 if (errorOccurred) |
152 scriptLoader->dispatchErrorEvent(); | 152 scriptLoader->dispatchErrorEvent(); |
153 else { | 153 else { |
154 ASSERT(isExecutingScript()); | 154 ASSERT(isExecutingScript()); |
155 scriptLoader->executeScript(sourceCode, &compilationFinishTime); | 155 if (!scriptLoader->executeScript(sourceCode, &compilationFinishTime)
) { |
156 element->dispatchEvent(createScriptLoadEvent()); | 156 scriptLoader->dispatchErrorEvent(); |
| 157 } else { |
| 158 element->dispatchEvent(createScriptLoadEvent()); |
| 159 } |
157 } | 160 } |
158 } | 161 } |
159 // The exact value doesn't matter; valid time stamps are much bigger than th
is value. | 162 // The exact value doesn't matter; valid time stamps are much bigger than th
is value. |
160 const double epsilon = 1; | 163 const double epsilon = 1; |
161 if (pendingScriptType == PendingScript::ParsingBlocking && !m_parserBlocking
ScriptAlreadyLoaded && compilationFinishTime > epsilon && loadFinishTime > epsil
on) { | 164 if (pendingScriptType == PendingScript::ParsingBlocking && !m_parserBlocking
ScriptAlreadyLoaded && compilationFinishTime > epsilon && loadFinishTime > epsil
on) { |
162 blink::Platform::current()->histogramCustomCounts("WebCore.Scripts.Parsi
ngBlocking.TimeBetweenLoadedAndCompiled", (compilationFinishTime - loadFinishTim
e) * 1000, 0, 10000, 50); | 165 blink::Platform::current()->histogramCustomCounts("WebCore.Scripts.Parsi
ngBlocking.TimeBetweenLoadedAndCompiled", (compilationFinishTime - loadFinishTim
e) * 1000, 0, 10000, 50); |
163 } | 166 } |
164 | 167 |
165 ASSERT(!isExecutingScript()); | 168 ASSERT(!isExecutingScript()); |
166 } | 169 } |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 358 |
356 DEFINE_TRACE(HTMLScriptRunner) | 359 DEFINE_TRACE(HTMLScriptRunner) |
357 { | 360 { |
358 visitor->trace(m_document); | 361 visitor->trace(m_document); |
359 visitor->trace(m_host); | 362 visitor->trace(m_host); |
360 visitor->trace(m_parserBlockingScript); | 363 visitor->trace(m_parserBlockingScript); |
361 visitor->trace(m_scriptsToExecuteAfterParsing); | 364 visitor->trace(m_scriptsToExecuteAfterParsing); |
362 } | 365 } |
363 | 366 |
364 } | 367 } |
OLD | NEW |