Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(863)

Unified Diff: third_party/WebKit/Source/modules/worklet/WorkletGlobalScope.h

Issue 1535943005: Initial implementation of bindings and basic classes for worklets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix memory leak. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..5d2eaed5ec17928c6d09b1a50720d269f3a73474
--- /dev/null
+++ b/third_party/WebKit/Source/modules/worklet/WorkletGlobalScope.h
@@ -0,0 +1,78 @@
+// 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/dom/ExecutionContextTask.h"
+#include "core/inspector/ConsoleMessage.h"
+#include "core/inspector/ScriptCallStack.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(const KURL&, const String& userAgent, v8::Isolate*);
kinuko 2015/12/22 08:39:03 Are we giving the parent context's url, userAgent
ikilpatrick 2015/12/22 23:40:23 Yes the parents url & userAgent, and the appropria
+ ~WorkletGlobalScope() override;
+
+ bool isWorkletGlobalScope() const final { return true; }
+
+ // AbstractGlobalScope
+ ExecutionContext* executionContext() const final { return const_cast<WorkletGlobalScope*>(this); }
+ GlobalScopeScriptController* script() final;
+ v8::Isolate* isolate() const final { return m_isolate; }
+ void didStopRunLoop() final { }
+
+ // 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;
+
+ // ExecutionContext
+ SecurityContext& securityContext() final { return *this; }
+ EventQueue* eventQueue() const final { ASSERT_NOT_REACHED(); return nullptr; } // WorkletGlobalScopes don't have an event queue.
+
+ DOMTimerCoordinator* timers() final { ASSERT_NOT_REACHED(); return nullptr; } // WorkletGlobalScopes don't have timers.
+ void postTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTask>) override { }
+
+ // TODO(ikilpatrick): implement when we implement devtools support.
+ void reportBlockedScriptExecutionToInspector(const String& directiveText) final { }
+ void addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage>) final { }
+ void logExceptionToConsole(const String& errorMessage, int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr<ScriptCallStack>) final { }
+
+ DECLARE_VIRTUAL_TRACE();
+
+private:
+#if !ENABLE(OILPAN)
+ void refExecutionContext() final { ref(); }
+ void derefExecutionContext() final { deref(); }
+#endif
+
+ WorkletGlobalScope(const KURL&, const String& userAgent, v8::Isolate*);
+
+ EventTarget* errorEventTarget() final { return nullptr; }
+
+ v8::Isolate* m_isolate;
+ OwnPtrWillBeMember<WorkletScriptController> m_script;
+};
+
+DEFINE_TYPE_CASTS(WorkletGlobalScope, ExecutionContext, context, context->isWorkletGlobalScope(), context.isWorkletGlobalScope());
+
+} // namespace blink
+
+#endif // WorkletGlobalScope_h

Powered by Google App Engine
This is Rietveld 408576698