| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 template <typename GamepadType, typename ListType> | 54 template <typename GamepadType, typename ListType> |
| 55 static void sampleGamepads(ListType* into) { | 55 static void sampleGamepads(ListType* into) { |
| 56 WebGamepads gamepads; | 56 WebGamepads gamepads; |
| 57 | 57 |
| 58 GamepadDispatcher::instance().sampleGamepads(gamepads); | 58 GamepadDispatcher::instance().sampleGamepads(gamepads); |
| 59 | 59 |
| 60 for (unsigned i = 0; i < WebGamepads::itemsLengthCap; ++i) { | 60 for (unsigned i = 0; i < WebGamepads::itemsLengthCap; ++i) { |
| 61 WebGamepad& webGamepad = gamepads.items[i]; | 61 WebGamepad& webGamepad = gamepads.items[i]; |
| 62 if (webGamepad.connected) { | 62 if (webGamepad.connected) { |
| 63 /* DO NOT SUBMIT - merge conflict marker. |
| 64 * Please spell |item|, not |Item| below. */ |
| 63 GamepadType* gamepad = into->item(i); | 65 GamepadType* gamepad = into->item(i); |
| 64 if (!gamepad) | 66 if (!gamepad) |
| 65 gamepad = GamepadType::create(); | 67 gamepad = GamepadType::create(); |
| 66 sampleGamepad(i, *gamepad, webGamepad); | 68 sampleGamepad(i, *gamepad, webGamepad); |
| 67 into->set(i, gamepad); | 69 into->set(i, gamepad); |
| 68 } else { | 70 } else { |
| 69 into->set(i, 0); | 71 into->set(i, 0); |
| 70 } | 72 } |
| 71 } | 73 } |
| 72 } | 74 } |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) { | 270 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) { |
| 269 m_pendingEvents.push_back(newGamepad); | 271 m_pendingEvents.push_back(newGamepad); |
| 270 } | 272 } |
| 271 } | 273 } |
| 272 | 274 |
| 273 if (!m_pendingEvents.isEmpty()) | 275 if (!m_pendingEvents.isEmpty()) |
| 274 m_dispatchOneEventRunner->runAsync(); | 276 m_dispatchOneEventRunner->runAsync(); |
| 275 } | 277 } |
| 276 | 278 |
| 277 } // namespace blink | 279 } // namespace blink |
| OLD | NEW |