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" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 class WorkletGlobalScope : public RefCountedWillBeGarbageCollectedFinalized<Work
letGlobalScope>, public SecurityContext, public MainThreadWorkletGlobalScope, pu
blic ScriptWrappable { | 25 class WorkletGlobalScope : public RefCountedWillBeGarbageCollectedFinalized<Work
letGlobalScope>, public SecurityContext, public MainThreadWorkletGlobalScope, pu
blic ScriptWrappable { |
26 DEFINE_WRAPPERTYPEINFO(); | 26 DEFINE_WRAPPERTYPEINFO(); |
27 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WorkletGlobalScope); | 27 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WorkletGlobalScope); |
28 public: | 28 public: |
29 #if !ENABLE(OILPAN) | 29 #if !ENABLE(OILPAN) |
30 using RefCounted<WorkletGlobalScope>::ref; | 30 using RefCounted<WorkletGlobalScope>::ref; |
31 using RefCounted<WorkletGlobalScope>::deref; | 31 using RefCounted<WorkletGlobalScope>::deref; |
32 #endif | 32 #endif |
33 | 33 |
34 // The url, userAgent and securityOrigin arguments are inherited from the | |
35 // parent ExecutionContext for Worklets. | |
36 static PassRefPtrWillBeRawPtr<WorkletGlobalScope> create(LocalFrame*, const
KURL&, const String& userAgent, PassRefPtr<SecurityOrigin>, v8::Isolate*); | |
37 ~WorkletGlobalScope() override; | 34 ~WorkletGlobalScope() override; |
38 | 35 |
39 bool isWorkletGlobalScope() const final { return true; } | 36 bool isWorkletGlobalScope() const final { return true; } |
40 | 37 |
41 // WorkletGlobalScope | 38 // WorkletGlobalScope |
42 WorkletConsole* console(); | 39 WorkletConsole* console(); |
43 | 40 |
44 // WorkerOrWorkletGlobalScope | 41 // WorkerOrWorkletGlobalScope |
45 ScriptWrappable* getScriptWrappable() const final { return const_cast<Workle
tGlobalScope*>(this); } | 42 ScriptWrappable* getScriptWrappable() const final { return const_cast<Workle
tGlobalScope*>(this); } |
46 WorkerOrWorkletScriptController* scriptController() final { return m_scriptC
ontroller.get(); } | 43 WorkerOrWorkletScriptController* scriptController() final { return m_scriptC
ontroller.get(); } |
(...skipping 18 matching lines...) Expand all Loading... |
65 // TODO(ikilpatrick): implement. | 62 // TODO(ikilpatrick): implement. |
66 ASSERT_NOT_REACHED(); | 63 ASSERT_NOT_REACHED(); |
67 } | 64 } |
68 | 65 |
69 void reportBlockedScriptExecutionToInspector(const String& directiveText) fi
nal; | 66 void reportBlockedScriptExecutionToInspector(const String& directiveText) fi
nal; |
70 void addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage>) final; | 67 void addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage>) final; |
71 void logExceptionToConsole(const String& errorMessage, int scriptId, const S
tring& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>)
final; | 68 void logExceptionToConsole(const String& errorMessage, int scriptId, const S
tring& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>)
final; |
72 | 69 |
73 DECLARE_VIRTUAL_TRACE(); | 70 DECLARE_VIRTUAL_TRACE(); |
74 | 71 |
| 72 protected: |
| 73 // The url, userAgent and securityOrigin arguments are inherited from the |
| 74 // parent ExecutionContext for Worklets. |
| 75 WorkletGlobalScope(LocalFrame*, const KURL&, const String& userAgent, PassRe
fPtr<SecurityOrigin>, v8::Isolate*); |
| 76 |
75 private: | 77 private: |
76 #if !ENABLE(OILPAN) | 78 #if !ENABLE(OILPAN) |
77 void refExecutionContext() final { ref(); } | 79 void refExecutionContext() final { ref(); } |
78 void derefExecutionContext() final { deref(); } | 80 void derefExecutionContext() final { deref(); } |
79 #endif | 81 #endif |
80 | 82 |
81 WorkletGlobalScope(LocalFrame*, const KURL&, const String& userAgent, PassRe
fPtr<SecurityOrigin>, v8::Isolate*); | |
82 | |
83 const KURL& virtualURL() const final { return m_url; } | 83 const KURL& virtualURL() const final { return m_url; } |
84 KURL virtualCompleteURL(const String&) const final; | 84 KURL virtualCompleteURL(const String&) const final; |
85 | 85 |
86 EventTarget* errorEventTarget() final { return nullptr; } | 86 EventTarget* errorEventTarget() final { return nullptr; } |
87 void didUpdateSecurityOrigin() final { } | 87 void didUpdateSecurityOrigin() final { } |
88 | 88 |
89 mutable PersistentWillBeMember<WorkletConsole> m_console; | 89 mutable PersistentWillBeMember<WorkletConsole> m_console; |
90 | 90 |
91 KURL m_url; | 91 KURL m_url; |
92 String m_userAgent; | 92 String m_userAgent; |
93 OwnPtrWillBeMember<WorkerOrWorkletScriptController> m_scriptController; | 93 OwnPtrWillBeMember<WorkerOrWorkletScriptController> m_scriptController; |
94 }; | 94 }; |
95 | 95 |
96 DEFINE_TYPE_CASTS(WorkletGlobalScope, ExecutionContext, context, context->isWork
letGlobalScope(), context.isWorkletGlobalScope()); | 96 DEFINE_TYPE_CASTS(WorkletGlobalScope, ExecutionContext, context, context->isWork
letGlobalScope(), context.isWorkletGlobalScope()); |
97 | 97 |
98 } // namespace blink | 98 } // namespace blink |
99 | 99 |
100 #endif // WorkletGlobalScope_h | 100 #endif // WorkletGlobalScope_h |
OLD | NEW |