#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/modules/gamepad/gamepad_comparisons.h"
#include "third_party/blink/renderer/modules/gamepad/gamepad.h"
namespace blink {
namespace {
const double kButtonActivationThreshold = …;
template <typename Collection>
bool HasSameNumberofElements(const Collection* lhs, const Collection* rhs) { … }
bool HasSameNumberofElements(const GamepadTouchVector* lhs,
const GamepadTouchVector* rhs) { … }
template <typename T>
auto Begin(const T* col) { … }
template <typename T>
auto End(const T* col) { … }
auto Begin(const GamepadTouchVector* col) { … }
auto End(const GamepadTouchVector* col) { … }
template <typename Collection,
typename Pred = std::equal_to<typename Collection::ValueType>>
bool Compare(const Collection* old_array,
const Collection* new_array,
Pred pred = Pred{ … }
}
bool GamepadComparisons::HasUserActivation(
const HeapVector<Member<Gamepad>> gamepads) { … }
void GamepadComparisons::HasGamepadConnectionChanged(bool old_connected,
bool new_connected,
bool id_changed,
bool* gamepad_found,
bool* gamepad_lost) { … }
GamepadStateCompareResult::GamepadStateCompareResult(
const HeapVector<Member<Gamepad>> old_gamepads,
const HeapVector<Member<Gamepad>> new_gamepads,
bool compare_all_axes,
bool compare_all_buttons) { … }
bool GamepadStateCompareResult::IsDifferent() const { … }
bool GamepadStateCompareResult::IsGamepadConnected(size_t pad_index) const { … }
bool GamepadStateCompareResult::IsGamepadDisconnected(size_t pad_index) const { … }
bool GamepadStateCompareResult::IsAxisChanged(size_t pad_index,
size_t axis_index) const { … }
bool GamepadStateCompareResult::IsButtonChanged(size_t pad_index,
size_t button_index) const { … }
bool GamepadStateCompareResult::IsButtonDown(size_t pad_index,
size_t button_index) const { … }
bool GamepadStateCompareResult::IsButtonUp(size_t pad_index,
size_t button_index) const { … }
bool GamepadStateCompareResult::CompareGamepads(
const HeapVector<Member<Gamepad>> old_gamepads,
const HeapVector<Member<Gamepad>> new_gamepads,
bool compare_all_axes,
bool compare_all_buttons) { … }
bool GamepadStateCompareResult::CompareAxes(Gamepad* old_gamepad,
Gamepad* new_gamepad,
size_t index,
bool compare_all) { … }
bool GamepadStateCompareResult::CompareButtons(Gamepad* old_gamepad,
Gamepad* new_gamepad,
size_t index,
bool compare_all) { … }
bool GamepadStateCompareResult::CompareTouches(Gamepad* old_gamepad,
Gamepad* new_gamepad) { … }
GamepadStateCompareResult GamepadComparisons::Compare(
const HeapVector<Member<Gamepad>> old_gamepads,
const HeapVector<Member<Gamepad>> new_gamepads,
bool compare_all_axes,
bool compare_all_buttons) { … }
}