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 #ifndef WorkletGlobalScope_h | 5 #ifndef WorkletGlobalScope_h |
6 #define WorkletGlobalScope_h | 6 #define WorkletGlobalScope_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptCallStack.h" | 8 #include "bindings/core/v8/ScriptCallStack.h" |
9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
10 #include "core/dom/ExecutionContext.h" | 10 #include "core/dom/ExecutionContext.h" |
11 #include "core/dom/ExecutionContextTask.h" | 11 #include "core/dom/ExecutionContextTask.h" |
12 #include "core/dom/SecurityContext.h" | 12 #include "core/dom/SecurityContext.h" |
13 #include "core/inspector/ConsoleMessage.h" | 13 #include "core/inspector/ConsoleMessage.h" |
14 #include "core/workers/MainThreadWorkletGlobalScope.h" | 14 #include "core/workers/MainThreadWorkletGlobalScope.h" |
15 #include "core/workers/WorkerOrWorkletGlobalScope.h" | 15 #include "core/workers/WorkerOrWorkletGlobalScope.h" |
16 #include "modules/ModulesExport.h" | 16 #include "modules/ModulesExport.h" |
17 #include "platform/heap/Handle.h" | 17 #include "platform/heap/Handle.h" |
18 | 18 |
19 namespace blink { | 19 namespace blink { |
20 | 20 |
21 class EventQueue; | 21 class EventQueue; |
22 class LocalFrame; | 22 class LocalFrame; |
23 class WorkerOrWorkletScriptController; | 23 class WorkerOrWorkletScriptController; |
24 class WorkletConsole; | |
25 | 24 |
26 class MODULES_EXPORT WorkletGlobalScope : public GarbageCollectedFinalized<Workl
etGlobalScope>, public SecurityContext, public MainThreadWorkletGlobalScope, pub
lic ScriptWrappable { | 25 class MODULES_EXPORT WorkletGlobalScope : public GarbageCollectedFinalized<Workl
etGlobalScope>, public SecurityContext, public MainThreadWorkletGlobalScope, pub
lic ScriptWrappable { |
27 DEFINE_WRAPPERTYPEINFO(); | 26 DEFINE_WRAPPERTYPEINFO(); |
28 USING_GARBAGE_COLLECTED_MIXIN(WorkletGlobalScope); | 27 USING_GARBAGE_COLLECTED_MIXIN(WorkletGlobalScope); |
29 public: | 28 public: |
30 ~WorkletGlobalScope() override; | 29 ~WorkletGlobalScope() override; |
31 virtual void dispose(); | 30 virtual void dispose(); |
32 | 31 |
33 bool isWorkletGlobalScope() const final { return true; } | 32 bool isWorkletGlobalScope() const final { return true; } |
34 | 33 |
35 // WorkletGlobalScope | |
36 WorkletConsole* console(); | |
37 | |
38 // WorkerOrWorkletGlobalScope | 34 // WorkerOrWorkletGlobalScope |
39 ScriptWrappable* getScriptWrappable() const final { return const_cast<Workle
tGlobalScope*>(this); } | 35 ScriptWrappable* getScriptWrappable() const final { return const_cast<Workle
tGlobalScope*>(this); } |
40 WorkerOrWorkletScriptController* scriptController() final { return m_scriptC
ontroller.get(); } | 36 WorkerOrWorkletScriptController* scriptController() final { return m_scriptC
ontroller.get(); } |
41 | 37 |
42 // ScriptWrappable | 38 // ScriptWrappable |
43 v8::Local<v8::Object> wrap(v8::Isolate*, v8::Local<v8::Object> creationConte
xt) final; | 39 v8::Local<v8::Object> wrap(v8::Isolate*, v8::Local<v8::Object> creationConte
xt) final; |
44 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn
fo*, v8::Local<v8::Object> wrapper) final; | 40 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn
fo*, v8::Local<v8::Object> wrapper) final; |
45 | 41 |
46 // ExecutionContext | 42 // ExecutionContext |
47 void disableEval(const String& errorMessage) final; | 43 void disableEval(const String& errorMessage) final; |
(...skipping 23 matching lines...) Expand all Loading... |
71 // parent ExecutionContext for Worklets. | 67 // parent ExecutionContext for Worklets. |
72 WorkletGlobalScope(LocalFrame*, const KURL&, const String& userAgent, PassRe
fPtr<SecurityOrigin>, v8::Isolate*); | 68 WorkletGlobalScope(LocalFrame*, const KURL&, const String& userAgent, PassRe
fPtr<SecurityOrigin>, v8::Isolate*); |
73 | 69 |
74 private: | 70 private: |
75 const KURL& virtualURL() const final { return m_url; } | 71 const KURL& virtualURL() const final { return m_url; } |
76 KURL virtualCompleteURL(const String&) const final; | 72 KURL virtualCompleteURL(const String&) const final; |
77 | 73 |
78 EventTarget* errorEventTarget() final { return nullptr; } | 74 EventTarget* errorEventTarget() final { return nullptr; } |
79 void didUpdateSecurityOrigin() final { } | 75 void didUpdateSecurityOrigin() final { } |
80 | 76 |
81 mutable Member<WorkletConsole> m_console; | |
82 | |
83 KURL m_url; | 77 KURL m_url; |
84 String m_userAgent; | 78 String m_userAgent; |
85 Member<WorkerOrWorkletScriptController> m_scriptController; | 79 Member<WorkerOrWorkletScriptController> m_scriptController; |
86 }; | 80 }; |
87 | 81 |
88 DEFINE_TYPE_CASTS(WorkletGlobalScope, ExecutionContext, context, context->isWork
letGlobalScope(), context.isWorkletGlobalScope()); | 82 DEFINE_TYPE_CASTS(WorkletGlobalScope, ExecutionContext, context, context->isWork
letGlobalScope(), context.isWorkletGlobalScope()); |
89 | 83 |
90 } // namespace blink | 84 } // namespace blink |
91 | 85 |
92 #endif // WorkletGlobalScope_h | 86 #endif // WorkletGlobalScope_h |
OLD | NEW |