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

Unified Diff: Source/modules/gamepad/NavigatorGamepad.cpp

Issue 826223002: Remove DOMWindowLifecycleObserver::window() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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
« no previous file with comments | « Source/core/frame/DOMWindowLifecycleObserver.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/gamepad/NavigatorGamepad.cpp
diff --git a/Source/modules/gamepad/NavigatorGamepad.cpp b/Source/modules/gamepad/NavigatorGamepad.cpp
index ed3ce6c4b917d023222d3b61368300a5b61a5f66..0846608d4fd11bf2265318aca4aa0dd90448c76c 100644
--- a/Source/modules/gamepad/NavigatorGamepad.cpp
+++ b/Source/modules/gamepad/NavigatorGamepad.cpp
@@ -97,7 +97,7 @@ GamepadList* NavigatorGamepad::gamepads()
{
if (!m_gamepads)
m_gamepads = GamepadList::create();
- if (window()) {
+ if (frame() && frame()->domWindow()) {
startUpdating();
sampleGamepads<Gamepad>(m_gamepads.get());
}
@@ -116,13 +116,15 @@ void NavigatorGamepad::trace(Visitor* visitor)
void NavigatorGamepad::didUpdateData()
{
// We should stop listening once we detached.
- ASSERT(window());
+ ASSERT(frame());
+ ASSERT(frame()->domWindow());
// We register to the dispatcher before sampling gamepads so we need to check if we actually have an event listener.
if (!m_hasEventListener)
return;
- if (window()->document()->activeDOMObjectsAreStopped() || window()->document()->activeDOMObjectsAreSuspended())
+ Document* document = frame()->domWindow()->document();
+ if (document->activeDOMObjectsAreStopped() || document->activeDOMObjectsAreSuspended())
return;
const GamepadDispatcher::ConnectionChange& change = GamepadDispatcher::instance().latestConnectionChange();
@@ -142,12 +144,13 @@ void NavigatorGamepad::didUpdateData()
void NavigatorGamepad::dispatchOneEvent()
{
- ASSERT(window());
+ ASSERT(frame());
+ ASSERT(frame()->domWindow());
ASSERT(!m_pendingEvents.isEmpty());
Gamepad* gamepad = m_pendingEvents.takeFirst();
const AtomicString& eventName = gamepad->connected() ? EventTypeNames::gamepadconnected : EventTypeNames::gamepaddisconnected;
- window()->dispatchEvent(GamepadEvent::create(eventName, false, true, gamepad));
+ frame()->domWindow()->dispatchEvent(GamepadEvent::create(eventName, false, true, gamepad));
if (!m_pendingEvents.isEmpty())
m_dispatchOneEventRunner.runAsync();
« no previous file with comments | « Source/core/frame/DOMWindowLifecycleObserver.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698