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

Side by Side Diff: Source/modules/gamepad/NavigatorGamepad.cpp

Issue 828983002: Do not (re)start NavigatorGamepad updating once detached. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Simply refuse to (re)start updating when detached Created 5 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, Google Inc. All rights reserved. 2 * Copyright (C) 2011, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met: 5 * modification, are permitted provided that the following conditions are met:
6 * 6 *
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 GamepadList* NavigatorGamepad::getGamepads(Navigator& navigator) 91 GamepadList* NavigatorGamepad::getGamepads(Navigator& navigator)
92 { 92 {
93 return NavigatorGamepad::from(navigator).gamepads(); 93 return NavigatorGamepad::from(navigator).gamepads();
94 } 94 }
95 95
96 GamepadList* NavigatorGamepad::gamepads() 96 GamepadList* NavigatorGamepad::gamepads()
97 { 97 {
98 if (!m_gamepads) 98 if (!m_gamepads)
99 m_gamepads = GamepadList::create(); 99 m_gamepads = GamepadList::create();
100 if (frame() && frame()->domWindow()) { 100 if (frame() && frame()->host()) {
101 // The frame must be attached to start updating.
101 startUpdating(); 102 startUpdating();
102 sampleGamepads<Gamepad>(m_gamepads.get()); 103 sampleGamepads<Gamepad>(m_gamepads.get());
103 } 104 }
104 return m_gamepads.get(); 105 return m_gamepads.get();
105 } 106 }
106 107
107 void NavigatorGamepad::trace(Visitor* visitor) 108 void NavigatorGamepad::trace(Visitor* visitor)
108 { 109 {
109 visitor->trace(m_gamepads); 110 visitor->trace(m_gamepads);
110 visitor->trace(m_pendingEvents); 111 visitor->trace(m_pendingEvents);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) { 271 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) {
271 m_pendingEvents.append(newGamepad); 272 m_pendingEvents.append(newGamepad);
272 } 273 }
273 } 274 }
274 275
275 if (!m_pendingEvents.isEmpty()) 276 if (!m_pendingEvents.isEmpty())
276 m_dispatchOneEventRunner.runAsync(); 277 m_dispatchOneEventRunner.runAsync();
277 } 278 }
278 279
279 } // namespace blink 280 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698