| 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 55%
|
| copy from third_party/WebKit/Source/modules/device_orientation/DeviceMotionDispatcher.cpp
|
| copy to third_party/WebKit/Source/bindings/modules/v8/WorkletScriptController.cpp
|
| index 3e4d8fc95390dd3b4f620cd1ecd9c24deeefd920..fb466f68d5a8e6d9e8becd67472bec8381c8ee70 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,46 @@
|
| */
|
|
|
| #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/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
|
|
|