OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "modules/worklet/WorkletGlobalScope.h" | 5 #include "modules/worklet/WorkletGlobalScope.h" |
6 | 6 |
| 7 #include "bindings/core/v8/SourceLocation.h" |
7 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" | 8 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
8 #include "core/frame/FrameConsole.h" | 9 #include "core/frame/FrameConsole.h" |
9 #include "core/inspector/InspectorInstrumentation.h" | 10 #include "core/inspector/InspectorInstrumentation.h" |
10 #include "core/inspector/MainThreadDebugger.h" | 11 #include "core/inspector/MainThreadDebugger.h" |
11 | 12 |
12 namespace blink { | 13 namespace blink { |
13 | 14 |
14 WorkletGlobalScope::WorkletGlobalScope(LocalFrame* frame, const KURL& url, const
String& userAgent, PassRefPtr<SecurityOrigin> securityOrigin, v8::Isolate* isol
ate) | 15 WorkletGlobalScope::WorkletGlobalScope(LocalFrame* frame, const KURL& url, const
String& userAgent, PassRefPtr<SecurityOrigin> securityOrigin, v8::Isolate* isol
ate) |
15 : MainThreadWorkletGlobalScope(frame) | 16 : MainThreadWorkletGlobalScope(frame) |
16 , m_url(url) | 17 , m_url(url) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 void WorkletGlobalScope::reportBlockedScriptExecutionToInspector(const String& d
irectiveText) | 68 void WorkletGlobalScope::reportBlockedScriptExecutionToInspector(const String& d
irectiveText) |
68 { | 69 { |
69 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); | 70 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); |
70 } | 71 } |
71 | 72 |
72 void WorkletGlobalScope::addConsoleMessage(ConsoleMessage* consoleMessage) | 73 void WorkletGlobalScope::addConsoleMessage(ConsoleMessage* consoleMessage) |
73 { | 74 { |
74 frame()->console().addMessage(consoleMessage); | 75 frame()->console().addMessage(consoleMessage); |
75 } | 76 } |
76 | 77 |
77 void WorkletGlobalScope::logExceptionToConsole(const String& errorMessage, int s
criptId, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtr<S
criptCallStack> callStack) | 78 void WorkletGlobalScope::logExceptionToConsole(const String& errorMessage, PassO
wnPtr<SourceLocation> location) |
78 { | 79 { |
79 ConsoleMessage* consoleMessage = ConsoleMessage::create(JSMessageSource, Err
orMessageLevel, errorMessage, sourceURL, lineNumber, columnNumber, callStack, sc
riptId); | 80 ConsoleMessage* consoleMessage = ConsoleMessage::create(JSMessageSource, Err
orMessageLevel, errorMessage, std::move(location)); |
80 addConsoleMessage(consoleMessage); | 81 addConsoleMessage(consoleMessage); |
81 } | 82 } |
82 | 83 |
83 KURL WorkletGlobalScope::virtualCompleteURL(const String& url) const | 84 KURL WorkletGlobalScope::virtualCompleteURL(const String& url) const |
84 { | 85 { |
85 // Always return a null URL when passed a null string. | 86 // Always return a null URL when passed a null string. |
86 // TODO(ikilpatrick): Should we change the KURL constructor to have this | 87 // TODO(ikilpatrick): Should we change the KURL constructor to have this |
87 // behavior? | 88 // behavior? |
88 if (url.isNull()) | 89 if (url.isNull()) |
89 return KURL(); | 90 return KURL(); |
90 // Always use UTF-8 in Worklets. | 91 // Always use UTF-8 in Worklets. |
91 return KURL(m_url, url); | 92 return KURL(m_url, url); |
92 } | 93 } |
93 | 94 |
94 DEFINE_TRACE(WorkletGlobalScope) | 95 DEFINE_TRACE(WorkletGlobalScope) |
95 { | 96 { |
96 visitor->trace(m_scriptController); | 97 visitor->trace(m_scriptController); |
97 ExecutionContext::trace(visitor); | 98 ExecutionContext::trace(visitor); |
98 SecurityContext::trace(visitor); | 99 SecurityContext::trace(visitor); |
99 MainThreadWorkletGlobalScope::trace(visitor); | 100 MainThreadWorkletGlobalScope::trace(visitor); |
100 } | 101 } |
101 | 102 |
102 } // namespace blink | 103 } // namespace blink |
OLD | NEW |