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 "core/workers/MainThreadWorkletGlobalScope.h" | 5 #include "core/workers/MainThreadWorkletGlobalScope.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptSourceCode.h" | 7 #include "bindings/core/v8/ScriptSourceCode.h" |
8 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" | 8 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
9 #include "core/frame/FrameConsole.h" | 9 #include "core/frame/FrameConsole.h" |
10 #include "core/inspector/MainThreadDebugger.h" | 10 #include "core/inspector/MainThreadDebugger.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 MainThreadWorkletGlobalScope::MainThreadWorkletGlobalScope(LocalFrame* frame, co
nst KURL& url, const String& userAgent, PassRefPtr<SecurityOrigin> securityOrigi
n, v8::Isolate* isolate) | 14 MainThreadWorkletGlobalScope::MainThreadWorkletGlobalScope(LocalFrame* frame, co
nst KURL& url, const String& userAgent, PassRefPtr<SecurityOrigin> securityOrigi
n, v8::Isolate* isolate) |
15 : WorkletGlobalScope(url, userAgent, securityOrigin, isolate) | 15 : WorkletGlobalScope(url, userAgent, securityOrigin, isolate) |
16 , LocalFrameLifecycleObserver(frame) | 16 , LocalFrameLifecycleObserver(frame) |
17 { | 17 { |
18 } | 18 } |
19 | 19 |
20 MainThreadWorkletGlobalScope::~MainThreadWorkletGlobalScope() | 20 MainThreadWorkletGlobalScope::~MainThreadWorkletGlobalScope() |
21 { | 21 { |
22 } | 22 } |
23 | 23 |
24 void MainThreadWorkletGlobalScope::evaluateScript(const String& source, const KU
RL& scriptURL) | 24 void MainThreadWorkletGlobalScope::evaluateScript(const ScriptSourceCode& script
SourceCode) |
25 { | 25 { |
26 scriptController()->evaluate(ScriptSourceCode(source, scriptURL)); | 26 scriptController()->evaluate(scriptSourceCode); |
27 } | 27 } |
28 | 28 |
29 void MainThreadWorkletGlobalScope::terminateWorkletGlobalScope() | 29 void MainThreadWorkletGlobalScope::terminateWorkletGlobalScope() |
30 { | 30 { |
31 dispose(); | 31 dispose(); |
32 } | 32 } |
33 | 33 |
34 void MainThreadWorkletGlobalScope::addConsoleMessage(ConsoleMessage* consoleMess
age) | 34 void MainThreadWorkletGlobalScope::addConsoleMessage(ConsoleMessage* consoleMess
age) |
35 { | 35 { |
36 frame()->console().addMessage(consoleMessage); | 36 frame()->console().addMessage(consoleMessage); |
37 } | 37 } |
38 | 38 |
39 void MainThreadWorkletGlobalScope::exceptionThrown(const String& errorMessage, s
td::unique_ptr<SourceLocation> location) | 39 void MainThreadWorkletGlobalScope::exceptionThrown(const String& errorMessage, s
td::unique_ptr<SourceLocation> location) |
40 { | 40 { |
41 MainThreadDebugger::instance()->exceptionThrown(frame(), errorMessage, std::
move(location)); | 41 MainThreadDebugger::instance()->exceptionThrown(frame(), errorMessage, std::
move(location)); |
42 } | 42 } |
43 | 43 |
44 } // namespace blink | 44 } // namespace blink |
OLD | NEW |