| 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 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 class WorkletGlobalScope : public RefCountedWillBeGarbageCollectedFinalized<Work
letGlobalScope>, public SecurityContext, public WorkerOrWorkletGlobalScope, publ
ic ScriptWrappable { | 22 class WorkletGlobalScope : public RefCountedWillBeGarbageCollectedFinalized<Work
letGlobalScope>, public SecurityContext, public WorkerOrWorkletGlobalScope, publ
ic ScriptWrappable { |
| 23 DEFINE_WRAPPERTYPEINFO(); | 23 DEFINE_WRAPPERTYPEINFO(); |
| 24 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WorkletGlobalScope); | 24 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WorkletGlobalScope); |
| 25 public: | 25 public: |
| 26 #if !ENABLE(OILPAN) | 26 #if !ENABLE(OILPAN) |
| 27 using RefCounted<WorkletGlobalScope>::ref; | 27 using RefCounted<WorkletGlobalScope>::ref; |
| 28 using RefCounted<WorkletGlobalScope>::deref; | 28 using RefCounted<WorkletGlobalScope>::deref; |
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 // The url and userAgent arguments are inherited from the parent | 31 // The url, userAgent and securityOrigin arguments are inherited from the |
| 32 // ExecutionContext for Worklets. | 32 // parent ExecutionContext for Worklets. |
| 33 static PassRefPtrWillBeRawPtr<WorkletGlobalScope> create(const KURL&, const
String& userAgent, v8::Isolate*); | 33 static PassRefPtrWillBeRawPtr<WorkletGlobalScope> create(const KURL&, const
String& userAgent, PassRefPtr<SecurityOrigin>, v8::Isolate*); |
| 34 ~WorkletGlobalScope() override; | 34 ~WorkletGlobalScope() override; |
| 35 | 35 |
| 36 bool isWorkletGlobalScope() const final { return true; } | 36 bool isWorkletGlobalScope() const final { return true; } |
| 37 | 37 |
| 38 | 38 |
| 39 // WorkerOrWorkletGlobalScope | 39 // WorkerOrWorkletGlobalScope |
| 40 ScriptWrappable* scriptWrappable() const final { return const_cast<WorkletGl
obalScope*>(this); } | 40 ScriptWrappable* scriptWrappable() const final { return const_cast<WorkletGl
obalScope*>(this); } |
| 41 WorkerOrWorkletScriptController* script() final { return m_script.get(); } | 41 WorkerOrWorkletScriptController* script() final { return m_script.get(); } |
| 42 | 42 |
| 43 // ScriptWrappable | 43 // ScriptWrappable |
| (...skipping 23 matching lines...) Expand all Loading... |
| 67 void logExceptionToConsole(const String& errorMessage, int scriptId, const S
tring& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>)
final { } | 67 void logExceptionToConsole(const String& errorMessage, int scriptId, const S
tring& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>)
final { } |
| 68 | 68 |
| 69 DECLARE_VIRTUAL_TRACE(); | 69 DECLARE_VIRTUAL_TRACE(); |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 #if !ENABLE(OILPAN) | 72 #if !ENABLE(OILPAN) |
| 73 void refExecutionContext() final { ref(); } | 73 void refExecutionContext() final { ref(); } |
| 74 void derefExecutionContext() final { deref(); } | 74 void derefExecutionContext() final { deref(); } |
| 75 #endif | 75 #endif |
| 76 | 76 |
| 77 WorkletGlobalScope(const KURL&, const String& userAgent, v8::Isolate*); | 77 WorkletGlobalScope(const KURL&, const String& userAgent, PassRefPtr<Security
Origin>, v8::Isolate*); |
| 78 | 78 |
| 79 const KURL& virtualURL() const final { return m_url; } | 79 const KURL& virtualURL() const final { return m_url; } |
| 80 KURL virtualCompleteURL(const String&) const final; | 80 KURL virtualCompleteURL(const String&) const final; |
| 81 | 81 |
| 82 EventTarget* errorEventTarget() final { return nullptr; } | 82 EventTarget* errorEventTarget() final { return nullptr; } |
| 83 void didUpdateSecurityOrigin() final { } | 83 void didUpdateSecurityOrigin() final { } |
| 84 | 84 |
| 85 KURL m_url; | 85 KURL m_url; |
| 86 String m_userAgent; | 86 String m_userAgent; |
| 87 OwnPtrWillBeMember<WorkerOrWorkletScriptController> m_script; | 87 OwnPtrWillBeMember<WorkerOrWorkletScriptController> m_script; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 DEFINE_TYPE_CASTS(WorkletGlobalScope, ExecutionContext, context, context->isWork
letGlobalScope(), context.isWorkletGlobalScope()); | 90 DEFINE_TYPE_CASTS(WorkletGlobalScope, ExecutionContext, context, context->isWork
letGlobalScope(), context.isWorkletGlobalScope()); |
| 91 | 91 |
| 92 } // namespace blink | 92 } // namespace blink |
| 93 | 93 |
| 94 #endif // WorkletGlobalScope_h | 94 #endif // WorkletGlobalScope_h |
| OLD | NEW |