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

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

Issue 2743023002: Migrate WTF::Deque::append() to ::push_back() (Closed)
Patch Set: rebase Created 3 years, 9 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
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 if (!m_gamepads) 139 if (!m_gamepads)
140 m_gamepads = GamepadList::create(); 140 m_gamepads = GamepadList::create();
141 141
142 Gamepad* gamepad = m_gamepads->item(change.index); 142 Gamepad* gamepad = m_gamepads->item(change.index);
143 if (!gamepad) 143 if (!gamepad)
144 gamepad = Gamepad::create(); 144 gamepad = Gamepad::create();
145 sampleGamepad(change.index, *gamepad, change.pad); 145 sampleGamepad(change.index, *gamepad, change.pad);
146 m_gamepads->set(change.index, gamepad); 146 m_gamepads->set(change.index, gamepad);
147 147
148 m_pendingEvents.append(gamepad); 148 m_pendingEvents.push_back(gamepad);
149 m_dispatchOneEventRunner->runAsync(); 149 m_dispatchOneEventRunner->runAsync();
150 } 150 }
151 151
152 void NavigatorGamepad::dispatchOneEvent() { 152 void NavigatorGamepad::dispatchOneEvent() {
153 Document* document = static_cast<Document*>(getExecutionContext()); 153 Document* document = static_cast<Document*>(getExecutionContext());
154 DCHECK(document->frame()); 154 DCHECK(document->frame());
155 DCHECK(document->frame()->domWindow()); 155 DCHECK(document->frame()->domWindow());
156 DCHECK(!m_pendingEvents.isEmpty()); 156 DCHECK(!m_pendingEvents.isEmpty());
157 157
158 Gamepad* gamepad = m_pendingEvents.takeFirst(); 158 Gamepad* gamepad = m_pendingEvents.takeFirst();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 256
257 for (unsigned i = 0; i < WebGamepads::itemsLengthCap; ++i) { 257 for (unsigned i = 0; i < WebGamepads::itemsLengthCap; ++i) {
258 Gamepad* oldGamepad = oldGamepads ? oldGamepads->item(i) : 0; 258 Gamepad* oldGamepad = oldGamepads ? oldGamepads->item(i) : 0;
259 Gamepad* newGamepad = newGamepads->item(i); 259 Gamepad* newGamepad = newGamepads->item(i);
260 bool oldWasConnected = oldGamepad && oldGamepad->connected(); 260 bool oldWasConnected = oldGamepad && oldGamepad->connected();
261 bool newIsConnected = newGamepad && newGamepad->connected(); 261 bool newIsConnected = newGamepad && newGamepad->connected();
262 bool connectedGamepadChanged = oldWasConnected && newIsConnected && 262 bool connectedGamepadChanged = oldWasConnected && newIsConnected &&
263 oldGamepad->id() != newGamepad->id(); 263 oldGamepad->id() != newGamepad->id();
264 if (connectedGamepadChanged || (oldWasConnected && !newIsConnected)) { 264 if (connectedGamepadChanged || (oldWasConnected && !newIsConnected)) {
265 oldGamepad->setConnected(false); 265 oldGamepad->setConnected(false);
266 m_pendingEvents.append(oldGamepad); 266 m_pendingEvents.push_back(oldGamepad);
267 } 267 }
268 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) { 268 if (connectedGamepadChanged || (!oldWasConnected && newIsConnected)) {
269 m_pendingEvents.append(newGamepad); 269 m_pendingEvents.push_back(newGamepad);
270 } 270 }
271 } 271 }
272 272
273 if (!m_pendingEvents.isEmpty()) 273 if (!m_pendingEvents.isEmpty())
274 m_dispatchOneEventRunner->runAsync(); 274 m_dispatchOneEventRunner->runAsync();
275 } 275 }
276 276
277 } // namespace blink 277 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698