| 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" |
| 33 #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h" | 34 #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h" |
| 34 #include "core/dom/ScriptLoader.h" | 35 #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> | |
| 48 | 47 |
| 49 namespace blink { | 48 namespace blink { |
| 50 | 49 |
| 51 namespace { | 50 namespace { |
| 52 | 51 |
| 53 // TODO(bmcquade): move this to a shared location if we find ourselves wanting | 52 // TODO(bmcquade): move this to a shared location if we find ourselves wanting |
| 54 // to trace similar data elsewhere in the codebase. | 53 // to trace similar data elsewhere in the codebase. |
| 55 std::unique_ptr<TracedValue> getTraceArgsForScriptElement(Element* element, cons
t TextPosition& textPosition) | 54 PassOwnPtr<TracedValue> getTraceArgsForScriptElement(Element* element, const Tex
tPosition& textPosition) |
| 56 { | 55 { |
| 57 std::unique_ptr<TracedValue> value = TracedValue::create(); | 56 OwnPtr<TracedValue> value = TracedValue::create(); |
| 58 ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element); | 57 ScriptLoader* scriptLoader = toScriptLoaderIfPossible(element); |
| 59 if (scriptLoader && scriptLoader->resource()) | 58 if (scriptLoader && scriptLoader->resource()) |
| 60 value->setString("url", scriptLoader->resource()->url().getString()); | 59 value->setString("url", scriptLoader->resource()->url().getString()); |
| 61 if (element->ownerDocument() && element->ownerDocument()->frame()) | 60 if (element->ownerDocument() && element->ownerDocument()->frame()) |
| 62 value->setString("frame", String::format("0x%" PRIx64, static_cast<uint6
4_t>(reinterpret_cast<intptr_t>(element->ownerDocument()->frame())))); | 61 value->setString("frame", String::format("0x%" PRIx64, static_cast<uint6
4_t>(reinterpret_cast<intptr_t>(element->ownerDocument()->frame())))); |
| 63 if (textPosition.m_line.zeroBasedInt() > 0 || textPosition.m_column.zeroBase
dInt() > 0) { | 62 if (textPosition.m_line.zeroBasedInt() > 0 || textPosition.m_column.zeroBase
dInt() > 0) { |
| 64 value->setInteger("lineNumber", textPosition.m_line.oneBasedInt()); | 63 value->setInteger("lineNumber", textPosition.m_line.oneBasedInt()); |
| 65 value->setInteger("columnNumber", textPosition.m_column.oneBasedInt()); | 64 value->setInteger("columnNumber", textPosition.m_column.oneBasedInt()); |
| 66 } | 65 } |
| 67 return value; | 66 return value; |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 DEFINE_TRACE(HTMLScriptRunner) | 445 DEFINE_TRACE(HTMLScriptRunner) |
| 447 { | 446 { |
| 448 visitor->trace(m_document); | 447 visitor->trace(m_document); |
| 449 visitor->trace(m_host); | 448 visitor->trace(m_host); |
| 450 visitor->trace(m_parserBlockingScript); | 449 visitor->trace(m_parserBlockingScript); |
| 451 visitor->trace(m_scriptsToExecuteAfterParsing); | 450 visitor->trace(m_scriptsToExecuteAfterParsing); |
| 452 ScriptResourceClient::trace(visitor); | 451 ScriptResourceClient::trace(visitor); |
| 453 } | 452 } |
| 454 | 453 |
| 455 } // namespace blink | 454 } // namespace blink |
| OLD | NEW |