Index: Source/core/frame/DeviceSensorEventController.cpp |
diff --git a/Source/core/frame/DeviceSensorEventController.cpp b/Source/core/frame/DeviceSensorEventController.cpp |
index 912ce1dce9132ba46fd75bf64af4553ec79f4b19..5ffa369be494a6bdd700d4b41f8cc5081b5fb6bf 100644 |
--- a/Source/core/frame/DeviceSensorEventController.cpp |
+++ b/Source/core/frame/DeviceSensorEventController.cpp |
@@ -33,10 +33,9 @@ |
namespace WebCore { |
-DeviceSensorEventController::DeviceSensorEventController(Document& document) |
- : PageLifecycleObserver(document.page()) |
+DeviceSensorEventController::DeviceSensorEventController(Page* page) |
+ : PageLifecycleObserver(page) |
, m_hasEventListener(false) |
- , m_document(document) |
, m_isActive(false) |
, m_needsCheckingNullEvents(true) |
, m_timer(this, &DeviceSensorEventController::fireDeviceEvent) |
@@ -58,11 +57,13 @@ void DeviceSensorEventController::fireDeviceEvent(Timer<DeviceSensorEventControl |
void DeviceSensorEventController::dispatchDeviceEvent(PassRefPtrWillBeRawPtr<Event> prpEvent) |
{ |
- if (!m_document.domWindow() || m_document.activeDOMObjectsAreSuspended() || m_document.activeDOMObjectsAreStopped()) |
+ Document* targetDocument = document(); |
+ |
+ if (!targetDocument || !targetDocument->domWindow() || targetDocument->activeDOMObjectsAreSuspended() || targetDocument->activeDOMObjectsAreStopped()) |
return; |
RefPtrWillBeRawPtr<Event> event = prpEvent; |
- m_document.domWindow()->dispatchEvent(event); |
+ targetDocument->domWindow()->dispatchEvent(event); |
if (m_needsCheckingNullEvents) { |
if (isNullEvent(event.get())) |