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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 return true; | 243 return true; |
244 } | 244 } |
245 | 245 |
246 void HTMLScriptRunner::requestParsingBlockingScript(Element* element) | 246 void HTMLScriptRunner::requestParsingBlockingScript(Element* element) |
247 { | 247 { |
248 if (!requestPendingScript(m_parserBlockingScript, element)) | 248 if (!requestPendingScript(m_parserBlockingScript, element)) |
249 return; | 249 return; |
250 | 250 |
251 ASSERT(m_parserBlockingScript.resource()); | 251 ASSERT(m_parserBlockingScript.resource()); |
252 | 252 |
253 m_parserBlockingScriptAlreadyLoaded = m_parserBlockingScript.resource()->isL
oaded(); | 253 // Exclude already loaded resources (from memory cache) and reloads from the |
| 254 // computation of |
| 255 // WebCore.Scripts.ParsingBlocking.TimeBetweenLoadedAndCompiled (done after |
| 256 // the script is compiled). |
| 257 m_parserBlockingScriptAlreadyLoaded = m_parserBlockingScript.resource()->isL
oaded() || m_parserBlockingScript.resource()->resourceToRevalidate(); |
254 blink::Platform::current()->histogramEnumeration("WebCore.Scripts.ParsingBlo
cking.AlreadyLoaded", m_parserBlockingScriptAlreadyLoaded ? 1 : 0, 2); | 258 blink::Platform::current()->histogramEnumeration("WebCore.Scripts.ParsingBlo
cking.AlreadyLoaded", m_parserBlockingScriptAlreadyLoaded ? 1 : 0, 2); |
| 259 |
255 // We only care about a load callback if resource is not already | 260 // We only care about a load callback if resource is not already |
256 // in the cache. Callers will attempt to run the m_parserBlockingScript | 261 // in the cache. Callers will attempt to run the m_parserBlockingScript |
257 // if possible before returning control to the parser. | 262 // if possible before returning control to the parser. |
258 if (!m_parserBlockingScriptAlreadyLoaded) | 263 if (!m_parserBlockingScript.resource()->isLoaded()) |
259 m_parserBlockingScript.watchForLoad(this); | 264 m_parserBlockingScript.watchForLoad(this); |
260 } | 265 } |
261 | 266 |
262 void HTMLScriptRunner::requestDeferredScript(Element* element) | 267 void HTMLScriptRunner::requestDeferredScript(Element* element) |
263 { | 268 { |
264 PendingScript pendingScript; | 269 PendingScript pendingScript; |
265 if (!requestPendingScript(pendingScript, element)) | 270 if (!requestPendingScript(pendingScript, element)) |
266 return; | 271 return; |
267 | 272 |
268 ASSERT(pendingScript.resource()); | 273 ASSERT(pendingScript.resource()); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 336 |
332 void HTMLScriptRunner::trace(Visitor* visitor) | 337 void HTMLScriptRunner::trace(Visitor* visitor) |
333 { | 338 { |
334 visitor->trace(m_document); | 339 visitor->trace(m_document); |
335 visitor->trace(m_host); | 340 visitor->trace(m_host); |
336 visitor->trace(m_parserBlockingScript); | 341 visitor->trace(m_parserBlockingScript); |
337 visitor->trace(m_scriptsToExecuteAfterParsing); | 342 visitor->trace(m_scriptsToExecuteAfterParsing); |
338 } | 343 } |
339 | 344 |
340 } | 345 } |
OLD | NEW |