| 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 19 matching lines...) Expand all Loading... |
| 30 #include "core/dom/Element.h" | 30 #include "core/dom/Element.h" |
| 31 #include "core/events/Event.h" | 31 #include "core/events/Event.h" |
| 32 #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h" | 32 #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h" |
| 33 #include "core/dom/Microtask.h" | 33 #include "core/dom/Microtask.h" |
| 34 #include "core/dom/ScriptLoader.h" | 34 #include "core/dom/ScriptLoader.h" |
| 35 #include "core/fetch/ScriptResource.h" | 35 #include "core/fetch/ScriptResource.h" |
| 36 #include "core/frame/LocalFrame.h" | 36 #include "core/frame/LocalFrame.h" |
| 37 #include "core/html/parser/HTMLInputStream.h" | 37 #include "core/html/parser/HTMLInputStream.h" |
| 38 #include "core/html/parser/HTMLScriptRunnerHost.h" | 38 #include "core/html/parser/HTMLScriptRunnerHost.h" |
| 39 #include "core/html/parser/NestingLevelIncrementer.h" | 39 #include "core/html/parser/NestingLevelIncrementer.h" |
| 40 #include "platform/Histogram.h" |
| 40 #include "platform/NotImplemented.h" | 41 #include "platform/NotImplemented.h" |
| 41 #include "platform/TraceEvent.h" | 42 #include "platform/TraceEvent.h" |
| 42 #include "platform/TracedValue.h" | 43 #include "platform/TracedValue.h" |
| 43 #include "public/platform/Platform.h" | 44 #include "public/platform/Platform.h" |
| 44 #include "public/platform/WebFrameScheduler.h" | 45 #include "public/platform/WebFrameScheduler.h" |
| 45 #include <inttypes.h> | 46 #include <inttypes.h> |
| 46 | 47 |
| 47 namespace blink { | 48 namespace blink { |
| 48 | 49 |
| 49 namespace { | 50 namespace { |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 if (!doExecuteScript(element.get(), sourceCode, scriptStartPosition,
&compilationFinishTime)) { | 221 if (!doExecuteScript(element.get(), sourceCode, scriptStartPosition,
&compilationFinishTime)) { |
| 221 scriptLoader->dispatchErrorEvent(); | 222 scriptLoader->dispatchErrorEvent(); |
| 222 } else { | 223 } else { |
| 223 element->dispatchEvent(Event::create(EventTypeNames::load)); | 224 element->dispatchEvent(Event::create(EventTypeNames::load)); |
| 224 } | 225 } |
| 225 } | 226 } |
| 226 } | 227 } |
| 227 // The exact value doesn't matter; valid time stamps are much bigger than th
is value. | 228 // The exact value doesn't matter; valid time stamps are much bigger than th
is value. |
| 228 const double epsilon = 1; | 229 const double epsilon = 1; |
| 229 if (pendingScriptType == ScriptStreamer::ParsingBlocking && !m_parserBlockin
gScriptAlreadyLoaded && compilationFinishTime > epsilon && loadFinishTime > epsi
lon) { | 230 if (pendingScriptType == ScriptStreamer::ParsingBlocking && !m_parserBlockin
gScriptAlreadyLoaded && compilationFinishTime > epsilon && loadFinishTime > epsi
lon) { |
| 230 Platform::current()->histogramCustomCounts("WebCore.Scripts.ParsingBlock
ing.TimeBetweenLoadedAndCompiled", (compilationFinishTime - loadFinishTime) * 10
00, 0, 10000, 50); | 231 int duration = (compilationFinishTime - loadFinishTime) * 1000; |
| 232 DEFINE_STATIC_LOCAL(CustomCountHistogram, loadAndCompileHistogram, ("Web
Core.Scripts.ParsingBlocking.TimeBetweenLoadedAndCompiled", 0, 10000, 50)); |
| 233 loadAndCompileHistogram.count(duration); |
| 231 } | 234 } |
| 232 | 235 |
| 233 ASSERT(!isExecutingScript()); | 236 ASSERT(!isExecutingScript()); |
| 234 } | 237 } |
| 235 | 238 |
| 236 void HTMLScriptRunner::stopWatchingResourceForLoad(Resource* resource) | 239 void HTMLScriptRunner::stopWatchingResourceForLoad(Resource* resource) |
| 237 { | 240 { |
| 238 if (m_parserBlockingScript->resource() == resource) { | 241 if (m_parserBlockingScript->resource() == resource) { |
| 239 m_parserBlockingScript->stopWatchingForLoad(this); | 242 m_parserBlockingScript->stopWatchingForLoad(this); |
| 240 m_parserBlockingScript->releaseElementAndClear(); | 243 m_parserBlockingScript->releaseElementAndClear(); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 | 447 |
| 445 DEFINE_TRACE(HTMLScriptRunner) | 448 DEFINE_TRACE(HTMLScriptRunner) |
| 446 { | 449 { |
| 447 visitor->trace(m_document); | 450 visitor->trace(m_document); |
| 448 visitor->trace(m_host); | 451 visitor->trace(m_host); |
| 449 visitor->trace(m_parserBlockingScript); | 452 visitor->trace(m_parserBlockingScript); |
| 450 visitor->trace(m_scriptsToExecuteAfterParsing); | 453 visitor->trace(m_scriptsToExecuteAfterParsing); |
| 451 } | 454 } |
| 452 | 455 |
| 453 } // namespace blink | 456 } // namespace blink |
| OLD | NEW |