Index: third_party/WebKit/Source/modules/worklet/WorkletGlobalScope.h |
diff --git a/third_party/WebKit/Source/modules/worklet/WorkletGlobalScope.h b/third_party/WebKit/Source/modules/worklet/WorkletGlobalScope.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..882b6d3f11b3a9283e41590971ee1f53eba69858 |
--- /dev/null |
+++ b/third_party/WebKit/Source/modules/worklet/WorkletGlobalScope.h |
@@ -0,0 +1,89 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef WorkletGlobalScope_h |
+#define WorkletGlobalScope_h |
+ |
+#include "bindings/core/v8/ScriptWrappable.h" |
+#include "core/workers/AbstractGlobalScope.h" |
+#include "platform/heap/Handle.h" |
+ |
+namespace blink { |
+ |
+class ExecutionContext; |
+class EventQueue; |
+class GlobalScopeScriptController; |
+class WorkletScriptController; |
+ |
+class WorkletGlobalScope : public RefCountedWillBeNoBase<WorkletGlobalScope>, public AbstractGlobalScope, public ScriptWrappable { |
+ DEFINE_WRAPPERTYPEINFO(); |
+ WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WorkletGlobalScope); |
+public: |
+#if !ENABLE(OILPAN) |
+ using RefCounted<WorkletGlobalScope>::ref; |
+ using RefCounted<WorkletGlobalScope>::deref; |
+#endif |
+ |
+ static PassRefPtrWillBeRawPtr<WorkletGlobalScope> create(v8::Isolate*); |
+ ~WorkletGlobalScope() override; |
+ |
+ bool isWorkletGlobalScope() const final { return true; } |
+ |
+ ExecutionContext* executionContext() const final { return const_cast<WorkletGlobalScope*>(this); } |
+ v8::Isolate* isolate() const final { return m_isolate; } |
+ |
+ String userAgent() const override { return String(); } // XXX this is a no-op. ASSERT NOT REACHED? |
+ void disableEval(const String& errorMessage) override { } // ASSERT NOT REACHED? |
+ |
+ // ScriptWrappable |
+ v8::Local<v8::Object> wrap(v8::Isolate*, v8::Local<v8::Object> creationContext) final; |
+ v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeInfo*, v8::Local<v8::Object> wrapper) final; |
+ |
+ // ExecutionContextClient |
+ EventQueue* eventQueue() const override { return m_queue.get(); } |
+ SecurityContext& securityContext() final { return *this; } |
+ |
+ // ExecutionContext |
+ DOMTimerCoordinator* timers() override { return nullptr; } // XXX ASSERT NOT REACHED? |
+ void postTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTask>) { } // XXX ASSERT NOT REACHED? |
+ void addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage>) final { }; // XXX |
+ bool isSecureContext(String& errorMessage, const SecureContextCheck = StandardSecureContextCheck) const override; |
+ |
+ // AbstractGlobalScope |
+ GlobalScopeScriptController* script() final; |
+ |
+ using SecurityContext::securityOrigin; |
+ using SecurityContext::contentSecurityPolicy; |
+ |
+ DECLARE_VIRTUAL_TRACE(); |
+ |
+protected: |
+ void logExceptionToConsole(const String& errorMessage, int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr<ScriptCallStack>) override { } // XXX |
+ |
+private: |
+#if !ENABLE(OILPAN) |
+ void refExecutionContext() final { ref(); } |
+ void derefExecutionContext() final { deref(); } |
+#endif |
+ |
+ WorkletGlobalScope(v8::Isolate*); |
+ |
+ const KURL& virtualURL() const final; |
+ KURL virtualCompleteURL(const String&) const final; |
+ |
+ void reportBlockedScriptExecutionToInspector(const String& directiveText) override { } |
+ |
+ EventTarget* errorEventTarget() final { return nullptr; } |
+ |
+ KURL m_url; |
+ v8::Isolate* m_isolate; |
+ OwnPtrWillBeMember<WorkletScriptController> m_script; |
+ OwnPtrWillBeMember<EventQueue> m_queue; |
+}; |
+ |
+DEFINE_TYPE_CASTS(WorkletGlobalScope, ExecutionContext, context, context->isWorkletGlobalScope(), context.isWorkletGlobalScope()); |
+ |
+} // namespace blink |
+ |
+#endif // WorkletGlobalScope_h |