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

Unified Diff: components/exo/gamepad.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/exo/gamepad_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/gamepad.cc
diff --git a/components/exo/gamepad.cc b/components/exo/gamepad.cc
index 876d05d809a2510353821a221aaca768e8f24642..8d5e23110df2a17be3d845730e451719b6491d32 100644
--- a/components/exo/gamepad.cc
+++ b/components/exo/gamepad.cc
@@ -123,7 +123,6 @@ class Gamepad::ThreadSafeGamepadChangeFetcher
fetcher_->GetGamepadData(
false /* No hardware changed notification from the system */);
- new_state.length = 0;
device::PadState& pad_state = pad_states_.get()[0];
// After querying the gamepad clear the state if it did not have it's active
@@ -137,22 +136,15 @@ class Gamepad::ThreadSafeGamepadChangeFetcher
MapAndSanitizeGamepadData(&pad_state, &new_state.items[0],
false /* Don't sanitize gamepad data */);
- // If the gamepad was active then increment the length of the WebGamepads
- // struct to indicate it's valid, then set the pad state to inactive. If the
- // gamepad is still actively reporting the next call to GetGamepadData will
- // set the active state to active again.
- if (pad_state.active_state) {
- new_state.length++;
+ // If the gamepad is still actively reporting the next call to
+ // GetGamepadData will set the active state to active again.
+ if (pad_state.active_state)
pad_state.active_state = device::GAMEPAD_INACTIVE;
- }
- if (std::max(new_state.length, state_.length) > 0) {
- if (new_state.items[0].connected != state_.items[0].connected ||
- new_state.items[0].timestamp > state_.items[0].timestamp) {
- origin_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(process_gamepad_changes_, new_state.items[0]));
- }
+ if (new_state.items[0].connected != state_.items[0].connected ||
+ new_state.items[0].timestamp > state_.items[0].timestamp) {
+ origin_task_runner_->PostTask(
+ FROM_HERE, base::Bind(process_gamepad_changes_, new_state.items[0]));
}
state_ = new_state;
« no previous file with comments | « no previous file | components/exo/gamepad_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698