Avoid recreating haptics in GamepadPlatformDataFetcherWin

A gamepad may be enumerated twice while its active state is still
marked as GAMEPAD_NEWLY_ACTIVE. If this happens, a new
XInputHapticGamepadWin instance will be created without properly
shutting down the previous instance, causing a DCHECK failure.

This situation can occur when a gamepad is enumerated twice before
the polling thread polls the gamepad state, which resets all gamepads
to GAMEPAD_INACTIVE.

To avoid the DCHECK failure, this CL modifies the newly active gamepad
logic so the XInputHapticGamepadWin instance is only created if it was
previously null.

BUG=749295

Change-Id: I1afbe0f6e4f6757384dd37a3491ab6a9cd4313c5
Reviewed-on: https://chromium-review.googlesource.com/883780
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Matt Reynolds <mattreynolds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531712}
1 file changed