OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WorkletGlobalScope_h |
| 6 #define WorkletGlobalScope_h |
| 7 |
| 8 #include "bindings/core/v8/ScriptWrappable.h" |
| 9 #include "core/workers/AbstractGlobalScope.h" |
| 10 #include "platform/heap/Handle.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class ExecutionContext; |
| 15 class EventQueue; |
| 16 class GlobalScopeScriptController; |
| 17 class WorkletScriptController; |
| 18 |
| 19 class WorkletGlobalScope : public RefCountedWillBeNoBase<WorkletGlobalScope>, pu
blic AbstractGlobalScope, public ScriptWrappable { |
| 20 DEFINE_WRAPPERTYPEINFO(); |
| 21 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WorkletGlobalScope); |
| 22 public: |
| 23 #if !ENABLE(OILPAN) |
| 24 using RefCounted<WorkletGlobalScope>::ref; |
| 25 using RefCounted<WorkletGlobalScope>::deref; |
| 26 #endif |
| 27 |
| 28 static PassRefPtrWillBeRawPtr<WorkletGlobalScope> create(v8::Isolate*); |
| 29 ~WorkletGlobalScope() override; |
| 30 |
| 31 bool isWorkletGlobalScope() const final { return true; } |
| 32 |
| 33 ExecutionContext* executionContext() const final { return const_cast<Worklet
GlobalScope*>(this); } |
| 34 v8::Isolate* isolate() const final { return m_isolate; } |
| 35 |
| 36 String userAgent() const override { return String(); } // XXX this is a no-o
p. ASSERT NOT REACHED? |
| 37 void disableEval(const String& errorMessage) override { } // ASSERT NOT REAC
HED? |
| 38 |
| 39 // ScriptWrappable |
| 40 v8::Local<v8::Object> wrap(v8::Isolate*, v8::Local<v8::Object> creationConte
xt) final; |
| 41 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn
fo*, v8::Local<v8::Object> wrapper) final; |
| 42 |
| 43 // ExecutionContextClient |
| 44 EventQueue* eventQueue() const override { return m_queue.get(); } |
| 45 SecurityContext& securityContext() final { return *this; } |
| 46 |
| 47 // ExecutionContext |
| 48 DOMTimerCoordinator* timers() override { return nullptr; } // XXX ASSERT NOT
REACHED? |
| 49 void postTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTask>) { }
// XXX ASSERT NOT REACHED? |
| 50 void addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage>) final { }; //
XXX |
| 51 bool isSecureContext(String& errorMessage, const SecureContextCheck = Standa
rdSecureContextCheck) const override; |
| 52 |
| 53 // AbstractGlobalScope |
| 54 GlobalScopeScriptController* script() final; |
| 55 |
| 56 using SecurityContext::securityOrigin; |
| 57 using SecurityContext::contentSecurityPolicy; |
| 58 |
| 59 DECLARE_VIRTUAL_TRACE(); |
| 60 |
| 61 protected: |
| 62 void logExceptionToConsole(const String& errorMessage, int scriptId, const S
tring& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr<Scrip
tCallStack>) override { } // XXX |
| 63 |
| 64 private: |
| 65 #if !ENABLE(OILPAN) |
| 66 void refExecutionContext() final { ref(); } |
| 67 void derefExecutionContext() final { deref(); } |
| 68 #endif |
| 69 |
| 70 WorkletGlobalScope(v8::Isolate*); |
| 71 |
| 72 const KURL& virtualURL() const final; |
| 73 KURL virtualCompleteURL(const String&) const final; |
| 74 |
| 75 void reportBlockedScriptExecutionToInspector(const String& directiveText) ov
erride { } |
| 76 |
| 77 EventTarget* errorEventTarget() final { return nullptr; } |
| 78 |
| 79 KURL m_url; |
| 80 v8::Isolate* m_isolate; |
| 81 OwnPtrWillBeMember<WorkletScriptController> m_script; |
| 82 OwnPtrWillBeMember<EventQueue> m_queue; |
| 83 }; |
| 84 |
| 85 DEFINE_TYPE_CASTS(WorkletGlobalScope, ExecutionContext, context, context->isWork
letGlobalScope(), context.isWorkletGlobalScope()); |
| 86 |
| 87 } // namespace blink |
| 88 |
| 89 #endif // WorkletGlobalScope_h |
OLD | NEW |