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

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

Issue 2572323002: Delete WebGamepads::length. (Closed)
Patch Set: Rebase Created 3 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
« no previous file with comments | « ppapi/shared_impl/ppb_gamepad_shared.cc ('k') | third_party/WebKit/public/platform/Platform.h » ('j') | 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
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 (i < gamepads.length && webGamepad.connected) { 62 if (webGamepad.connected) {
63 GamepadType* gamepad = into->item(i); 63 GamepadType* gamepad = into->item(i);
64 if (!gamepad) 64 if (!gamepad)
65 gamepad = GamepadType::create(); 65 gamepad = GamepadType::create();
66 sampleGamepad(i, *gamepad, webGamepad); 66 sampleGamepad(i, *gamepad, webGamepad);
67 into->set(i, gamepad); 67 into->set(i, gamepad);
68 } else { 68 } else {
69 into->set(i, 0); 69 into->set(i, 0);
70 } 70 }
71 } 71 }
72 } 72 }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) { 266 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) {
267 m_pendingEvents.append(newGamepad); 267 m_pendingEvents.append(newGamepad);
268 } 268 }
269 } 269 }
270 270
271 if (!m_pendingEvents.isEmpty()) 271 if (!m_pendingEvents.isEmpty())
272 m_dispatchOneEventRunner->runAsync(); 272 m_dispatchOneEventRunner->runAsync();
273 } 273 }
274 274
275 } // namespace blink 275 } // namespace blink
OLDNEW
« no previous file with comments | « ppapi/shared_impl/ppb_gamepad_shared.cc ('k') | third_party/WebKit/public/platform/Platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698