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

Unified Diff: Source/core/frame/DeviceSensorEventController.cpp

Issue 256593010: Gracefully support Navigator Gamepad methods in a detached state. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Have document supplements keep a reference to their document Created 6 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
« no previous file with comments | « Source/core/frame/DeviceSensorEventController.h ('k') | Source/modules/battery/BatteryManager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()))
« no previous file with comments | « Source/core/frame/DeviceSensorEventController.h ('k') | Source/modules/battery/BatteryManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698