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

Unified Diff: Source/WebCore/page/DOMWindow.cpp

Issue 13866007: WebKit & WebCore part of the device motion implementation using the platform layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@devicemotion-webcore
Patch Set: fixed Eric's comments. Created 7 years, 8 months 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: Source/WebCore/page/DOMWindow.cpp
diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp
index 475dabff48ed734ed75a5bf88e46a1636c9eff61..fc03b38782f178532c21070df6d2ad5b38b6ad61 100644
--- a/Source/WebCore/page/DOMWindow.cpp
+++ b/Source/WebCore/page/DOMWindow.cpp
@@ -1622,7 +1622,8 @@ bool DOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<Event
addBeforeUnloadEventListener(this);
#if ENABLE(DEVICE_ORIENTATION)
else if (eventType == eventNames().devicemotionEvent && RuntimeEnabledFeatures::deviceMotionEnabled()) {
- DeviceMotionController::shared().addDeviceEventListener(this);
+ if (DeviceMotionController* controller = DeviceMotionController::from(page()))
+ controller->addDeviceEventListener(this);
} else if (eventType == eventNames().deviceorientationEvent && RuntimeEnabledFeatures::deviceOrientationEnabled()) {
if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
controller->addDeviceEventListener(this);
@@ -1657,7 +1658,8 @@ bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener
removeBeforeUnloadEventListener(this);
#if ENABLE(DEVICE_ORIENTATION)
else if (eventType == eventNames().devicemotionEvent) {
- DeviceMotionController::shared().removeDeviceEventListener(this);
+ if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
+ controller->removeDeviceEventListener(this);
} else if (eventType == eventNames().deviceorientationEvent) {
if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
controller->removeDeviceEventListener(this);
@@ -1721,7 +1723,8 @@ void DOMWindow::removeAllEventListeners()
EventTarget::removeAllEventListeners();
#if ENABLE(DEVICE_ORIENTATION)
- DeviceMotionController::shared().removeAllDeviceEventListeners(this);
+ if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
+ controller->removeAllDeviceEventListeners(this);
if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
controller->removeAllDeviceEventListeners(this);
#endif

Powered by Google App Engine
This is Rietveld 408576698