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/WorkerOrWorkletScriptController.h" | 7 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
8 #include "core/frame/FrameConsole.h" | 8 #include "core/frame/FrameConsole.h" |
9 #include "core/inspector/InspectorInstrumentation.h" | 9 #include "core/inspector/InspectorInstrumentation.h" |
10 #include "core/inspector/MainThreadDebugger.h" | 10 #include "core/inspector/MainThreadDebugger.h" |
11 #include "modules/worklet/WorkletConsole.h" | 11 #include "modules/worklet/WorkletConsole.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 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) |
16 : MainThreadWorkletGlobalScope(frame) | 16 : MainThreadWorkletGlobalScope(frame) |
17 , m_url(url) | 17 , m_url(url) |
18 , m_userAgent(userAgent) | 18 , m_userAgent(userAgent) |
19 , m_scriptController(WorkerOrWorkletScriptController::create(this, isolate)) | 19 , m_scriptController(WorkerOrWorkletScriptController::create(this, isolate)) |
20 { | 20 { |
21 setSecurityOrigin(securityOrigin); | 21 setSecurityOrigin(securityOrigin); |
22 } | 22 } |
23 | 23 |
24 WorkletGlobalScope::~WorkletGlobalScope() | 24 WorkletGlobalScope::~WorkletGlobalScope() |
25 { | 25 { |
26 } | 26 } |
27 | 27 |
| 28 void WorkletGlobalScope::dispose() |
| 29 { |
| 30 stopActiveDOMObjects(); |
| 31 |
| 32 ASSERT(m_scriptController); |
| 33 m_scriptController->willScheduleExecutionTermination(); |
| 34 m_scriptController->dispose(); |
| 35 m_scriptController.clear(); |
| 36 } |
| 37 |
28 WorkletConsole* WorkletGlobalScope::console() | 38 WorkletConsole* WorkletGlobalScope::console() |
29 { | 39 { |
30 if (!m_console) | 40 if (!m_console) |
31 m_console = WorkletConsole::create(this); | 41 m_console = WorkletConsole::create(this); |
32 return m_console.get(); | 42 return m_console.get(); |
33 } | 43 } |
34 | 44 |
35 v8::Local<v8::Object> WorkletGlobalScope::wrap(v8::Isolate*, v8::Local<v8::Objec
t> creationContext) | 45 v8::Local<v8::Object> WorkletGlobalScope::wrap(v8::Isolate*, v8::Local<v8::Objec
t> creationContext) |
36 { | 46 { |
37 // WorkletGlobalScope must never be wrapped with wrap method. The global | 47 // WorkletGlobalScope must never be wrapped with wrap method. The global |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 DEFINE_TRACE(WorkletGlobalScope) | 105 DEFINE_TRACE(WorkletGlobalScope) |
96 { | 106 { |
97 visitor->trace(m_scriptController); | 107 visitor->trace(m_scriptController); |
98 visitor->trace(m_console); | 108 visitor->trace(m_console); |
99 ExecutionContext::trace(visitor); | 109 ExecutionContext::trace(visitor); |
100 SecurityContext::trace(visitor); | 110 SecurityContext::trace(visitor); |
101 MainThreadWorkletGlobalScope::trace(visitor); | 111 MainThreadWorkletGlobalScope::trace(visitor); |
102 } | 112 } |
103 | 113 |
104 } // namespace blink | 114 } // namespace blink |
OLD | NEW |