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

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

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.cpp
diff --git a/third_party/WebKit/Source/modules/worklet/WorkletGlobalScope.cpp b/third_party/WebKit/Source/modules/worklet/WorkletGlobalScope.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b50e400f7044dceeafa9542ba6c10911d90ccecd
--- /dev/null
+++ b/third_party/WebKit/Source/modules/worklet/WorkletGlobalScope.cpp
@@ -0,0 +1,54 @@
+// 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.
+
+#include "config.h"
+#include "modules/worklet/WorkletGlobalScope.h"
+
+#include "bindings/modules/v8/WorkletScriptController.h"
+
+namespace blink {
+
+// static
+PassRefPtrWillBeRawPtr<WorkletGlobalScope> WorkletGlobalScope::create(const KURL& url, const String& userAgent, v8::Isolate* isolate)
+{
+ return adoptRefWillBeNoop(new WorkletGlobalScope(url, userAgent, isolate));
+}
+
+WorkletGlobalScope::WorkletGlobalScope(const KURL& url, const String& userAgent, v8::Isolate* isolate)
+ : AbstractGlobalScope(url, userAgent)
+ , m_isolate(isolate)
+ , m_script(WorkletScriptController::create(this, m_isolate))
+{
+}
+
+WorkletGlobalScope::~WorkletGlobalScope()
+{
+}
+
+GlobalScopeScriptController* WorkletGlobalScope::script()
+{
+ m_script->initializeContextIfNeeded();
+ return m_script.get();
+}
+
+v8::Local<v8::Object> WorkletGlobalScope::wrap(v8::Isolate*, v8::Local<v8::Object> creationContext)
+{
+ // WorkletGlobalScope must never be wrapped with wrap method. The global
+ // object of ECMAScript environment is used as the wrapper.
+ RELEASE_ASSERT_NOT_REACHED();
+ return v8::Local<v8::Object>();
+}
+
+v8::Local<v8::Object> WorkletGlobalScope::associateWithWrapper(v8::Isolate*, const WrapperTypeInfo*, v8::Local<v8::Object> wrapper)
+{
+ RELEASE_ASSERT_NOT_REACHED(); // same as wrap method
+ return v8::Local<v8::Object>();
+}
+
+DEFINE_TRACE(WorkletGlobalScope)
+{
+ AbstractGlobalScope::trace(visitor);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698