| 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 12 matching lines...) Expand all Loading... |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "core/html/parser/HTMLScriptRunner.h" | 26 #include "core/html/parser/HTMLScriptRunner.h" |
| 27 | 27 |
| 28 #include "bindings/core/v8/Microtask.h" | 28 #include "bindings/core/v8/Microtask.h" |
| 29 #include "bindings/core/v8/ScriptSourceCode.h" | 29 #include "bindings/core/v8/ScriptSourceCode.h" |
| 30 #include "bindings/core/v8/V8PerIsolateData.h" | 30 #include "bindings/core/v8/V8PerIsolateData.h" |
| 31 #include "core/dom/DocumentParserTiming.h" | 31 #include "core/dom/DocumentParserTiming.h" |
| 32 #include "core/dom/Element.h" | 32 #include "core/dom/Element.h" |
| 33 #include "core/events/Event.h" | |
| 34 #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h" | 33 #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h" |
| 35 #include "core/dom/ScriptLoader.h" | 34 #include "core/dom/ScriptLoader.h" |
| 35 #include "core/events/Event.h" |
| 36 #include "core/fetch/ScriptResource.h" | 36 #include "core/fetch/ScriptResource.h" |
| 37 #include "core/frame/LocalFrame.h" | 37 #include "core/frame/LocalFrame.h" |
| 38 #include "core/html/parser/HTMLInputStream.h" | 38 #include "core/html/parser/HTMLInputStream.h" |
| 39 #include "core/html/parser/HTMLScriptRunnerHost.h" | 39 #include "core/html/parser/HTMLScriptRunnerHost.h" |
| 40 #include "core/html/parser/NestingLevelIncrementer.h" | 40 #include "core/html/parser/NestingLevelIncrementer.h" |
| 41 #include "platform/Histogram.h" | 41 #include "platform/Histogram.h" |
| 42 #include "platform/TraceEvent.h" | 42 #include "platform/TraceEvent.h" |
| 43 #include "platform/TracedValue.h" | 43 #include "platform/TracedValue.h" |
| 44 #include "public/platform/Platform.h" | 44 #include "public/platform/Platform.h" |
| 45 #include "public/platform/WebFrameScheduler.h" | 45 #include "public/platform/WebFrameScheduler.h" |
| 46 #include <inttypes.h> | 46 #include <inttypes.h> |
| 47 #include <memory> |
| 47 | 48 |
| 48 namespace blink { | 49 namespace blink { |
| 49 | 50 |
| 50 namespace { | 51 namespace { |
| 51 | 52 |
| 52 // TODO(bmcquade): move this to a shared location if we find ourselves wanting | 53 // TODO(bmcquade): move this to a shared location if we find ourselves wanting |
| 53 // to trace similar data elsewhere in the codebase. | 54 // to trace similar data elsewhere in the codebase. |
| 54 PassOwnPtr<TracedValue> getTraceArgsForScriptElement(Element* element, const Tex
tPosition& textPosition) | 55 std::unique_ptr<TracedValue> getTraceArgsForScriptElement(Element* element, cons
t TextPosition& textPosition) |
| 55 { | 56 { |
| 56 OwnPtr<TracedValue> value = TracedValue::create(); | 57 std::unique_ptr<TracedValue> value = TracedValue::create(); |
| 57 ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element); | 58 ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element); |
| 58 if (scriptLoader && scriptLoader->resource()) | 59 if (scriptLoader && scriptLoader->resource()) |
| 59 value->setString("url", scriptLoader->resource()->url().getString()); | 60 value->setString("url", scriptLoader->resource()->url().getString()); |
| 60 if (element->ownerDocument() && element->ownerDocument()->frame()) | 61 if (element->ownerDocument() && element->ownerDocument()->frame()) |
| 61 value->setString("frame", String::format("0x%" PRIx64, static_cast<uint6
4_t>(reinterpret_cast<intptr_t>(element->ownerDocument()->frame())))); | 62 value->setString("frame", String::format("0x%" PRIx64, static_cast<uint6
4_t>(reinterpret_cast<intptr_t>(element->ownerDocument()->frame())))); |
| 62 if (textPosition.m_line.zeroBasedInt() > 0 || textPosition.m_column.zeroBase
dInt() > 0) { | 63 if (textPosition.m_line.zeroBasedInt() > 0 || textPosition.m_column.zeroBase
dInt() > 0) { |
| 63 value->setInteger("lineNumber", textPosition.m_line.oneBasedInt()); | 64 value->setInteger("lineNumber", textPosition.m_line.oneBasedInt()); |
| 64 value->setInteger("columnNumber", textPosition.m_column.oneBasedInt()); | 65 value->setInteger("columnNumber", textPosition.m_column.oneBasedInt()); |
| 65 } | 66 } |
| 66 return value; | 67 return value; |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 DEFINE_TRACE(HTMLScriptRunner) | 446 DEFINE_TRACE(HTMLScriptRunner) |
| 446 { | 447 { |
| 447 visitor->trace(m_document); | 448 visitor->trace(m_document); |
| 448 visitor->trace(m_host); | 449 visitor->trace(m_host); |
| 449 visitor->trace(m_parserBlockingScript); | 450 visitor->trace(m_parserBlockingScript); |
| 450 visitor->trace(m_scriptsToExecuteAfterParsing); | 451 visitor->trace(m_scriptsToExecuteAfterParsing); |
| 451 ScriptResourceClient::trace(visitor); | 452 ScriptResourceClient::trace(visitor); |
| 452 } | 453 } |
| 453 | 454 |
| 454 } // namespace blink | 455 } // namespace blink |
| OLD | NEW |