| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |