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

Unified Diff: third_party/WebKit/Source/bindings/modules/v8/WorkletScriptController.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/bindings/modules/v8/WorkletScriptController.cpp
diff --git a/third_party/WebKit/Source/modules/device_orientation/DeviceMotionDispatcher.cpp b/third_party/WebKit/Source/bindings/modules/v8/WorkletScriptController.cpp
similarity index 54%
copy from third_party/WebKit/Source/modules/device_orientation/DeviceMotionDispatcher.cpp
copy to third_party/WebKit/Source/bindings/modules/v8/WorkletScriptController.cpp
index 3e4d8fc95390dd3b4f620cd1ecd9c24deeefd920..67c7ea11f0995af23ad24f85fe5a4f1bbf2376df 100644
--- a/third_party/WebKit/Source/modules/device_orientation/DeviceMotionDispatcher.cpp
+++ b/third_party/WebKit/Source/bindings/modules/v8/WorkletScriptController.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -29,54 +29,47 @@
*/
#include "config.h"
-#include "modules/device_orientation/DeviceMotionDispatcher.h"
-#include "modules/device_orientation/DeviceMotionController.h"
-#include "modules/device_orientation/DeviceMotionData.h"
+#include "bindings/modules/v8/WorkletScriptController.h"
+
+#include "bindings/core/v8/V8DOMWrapper.h"
+#include "bindings/core/v8/WrapperTypeInfo.h"
+#include "bindings/modules/v8/V8WorkletGlobalScope.h"
+#include "modules/worklet/WorkletGlobalScope.h"
#include "public/platform/Platform.h"
+#include <v8.h>
namespace blink {
-DeviceMotionDispatcher& DeviceMotionDispatcher::instance()
-{
- DEFINE_STATIC_LOCAL(Persistent<DeviceMotionDispatcher>, deviceMotionDispatcher, (new DeviceMotionDispatcher()));
- return *deviceMotionDispatcher;
-}
-
-DeviceMotionDispatcher::DeviceMotionDispatcher()
-{
-}
-
-DeviceMotionDispatcher::~DeviceMotionDispatcher()
+PassOwnPtrWillBeRawPtr<WorkletScriptController> WorkletScriptController::create(WorkletGlobalScope* workletGlobalScope, v8::Isolate* isolate)
{
+ return adoptPtrWillBeNoop(new WorkletScriptController(workletGlobalScope, isolate));
}
-DEFINE_TRACE(DeviceMotionDispatcher)
+WorkletScriptController::WorkletScriptController(WorkletGlobalScope* workletGlobalScope, v8::Isolate* isolate)
+ : GlobalScopeScriptController(workletGlobalScope, isolate)
+ , m_workletGlobalScope(workletGlobalScope)
{
- visitor->trace(m_lastDeviceMotionData);
- PlatformEventDispatcher::trace(visitor);
}
-void DeviceMotionDispatcher::startListening()
+WorkletScriptController::~WorkletScriptController()
{
- Platform::current()->startListening(WebPlatformEventTypeDeviceMotion, this);
}
-void DeviceMotionDispatcher::stopListening()
+const WrapperTypeInfo* WorkletScriptController::wrapperTypeInfoForGlobalScope() const
{
- Platform::current()->stopListening(WebPlatformEventTypeDeviceMotion);
- m_lastDeviceMotionData.clear();
+ return m_workletGlobalScope->wrapperTypeInfo();
}
-void DeviceMotionDispatcher::didChangeDeviceMotion(const WebDeviceMotionData& motion)
+v8::Local<v8::Object> WorkletScriptController::associateGlobalScopeWithWrapper(v8::Isolate* isolate, const WrapperTypeInfo* wrapperTypeInfo, v8::Local<v8::Object> wrapper)
{
- m_lastDeviceMotionData = DeviceMotionData::create(motion);
- notifyControllers();
+ return V8DOMWrapper::associateObjectWithWrapper(isolate, m_workletGlobalScope, wrapperTypeInfo, wrapper);
}
-DeviceMotionData* DeviceMotionDispatcher::latestDeviceMotionData()
+DEFINE_TRACE(WorkletScriptController)
{
- return m_lastDeviceMotionData.get();
+ visitor->trace(m_workletGlobalScope);
+ GlobalScopeScriptController::trace(visitor);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698