| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 // We should stop listening once we detached. | 123 // We should stop listening once we detached. |
| 124 Document* document = static_cast<Document*>(getExecutionContext()); | 124 Document* document = static_cast<Document*>(getExecutionContext()); |
| 125 DCHECK(document->frame()); | 125 DCHECK(document->frame()); |
| 126 DCHECK(document->frame()->domWindow()); | 126 DCHECK(document->frame()->domWindow()); |
| 127 | 127 |
| 128 // We register to the dispatcher before sampling gamepads so we need to check | 128 // We register to the dispatcher before sampling gamepads so we need to check |
| 129 // if we actually have an event listener. | 129 // if we actually have an event listener. |
| 130 if (!m_hasEventListener) | 130 if (!m_hasEventListener) |
| 131 return; | 131 return; |
| 132 | 132 |
| 133 if (document->activeDOMObjectsAreStopped() || | 133 if (document->isContextDestroyed() || |
| 134 document->activeDOMObjectsAreSuspended()) | 134 document->activeDOMObjectsAreSuspended()) |
| 135 return; | 135 return; |
| 136 | 136 |
| 137 const GamepadDispatcher::ConnectionChange& change = | 137 const GamepadDispatcher::ConnectionChange& change = |
| 138 GamepadDispatcher::instance().latestConnectionChange(); | 138 GamepadDispatcher::instance().latestConnectionChange(); |
| 139 | 139 |
| 140 if (!m_gamepads) | 140 if (!m_gamepads) |
| 141 m_gamepads = GamepadList::create(); | 141 m_gamepads = GamepadList::create(); |
| 142 | 142 |
| 143 Gamepad* gamepad = m_gamepads->item(change.index); | 143 Gamepad* gamepad = m_gamepads->item(change.index); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) { | 267 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) { |
| 268 m_pendingEvents.append(newGamepad); | 268 m_pendingEvents.append(newGamepad); |
| 269 } | 269 } |
| 270 } | 270 } |
| 271 | 271 |
| 272 if (!m_pendingEvents.isEmpty()) | 272 if (!m_pendingEvents.isEmpty()) |
| 273 m_dispatchOneEventRunner->runAsync(); | 273 m_dispatchOneEventRunner->runAsync(); |
| 274 } | 274 } |
| 275 | 275 |
| 276 } // namespace blink | 276 } // namespace blink |
| OLD | NEW |