chromium/device/gamepad/gamepad_provider.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "device/gamepad/gamepad_provider.h"

#include <stddef.h>
#include <string.h>
#include <cmath>
#include <memory>
#include <utility>
#include <vector>

#include "base/check.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/message_loop/message_pump_type.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "device/gamepad/gamepad_data_fetcher.h"
#include "device/gamepad/gamepad_data_fetcher_manager.h"
#include "device/gamepad/gamepad_user_gesture.h"
#include "device/gamepad/public/cpp/gamepad_features.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "third_party/abseil-cpp/absl/base/dynamic_annotations.h"

namespace device {

namespace {
std::vector<mojom::ButtonChangePtr> CompareButtons(const Gamepad* old_gamepad,
                                                   const Gamepad* new_gamepad) {}

std::vector<mojom::AxisChangePtr> CompareAxes(const Gamepad* old_gamepad,
                                              const Gamepad* new_gamepad) {}

mojom::GamepadChangesPtr CompareGamepadState(const Gamepad* old_gamepad,
                                             const Gamepad* new_gamepad,
                                             size_t index) {}
}  // namespace

constexpr int64_t kPollingIntervalMilliseconds =;  // ~250 Hz

GamepadProvider::GamepadProvider(GamepadChangeClient* gamepad_change_client)
    :{}

GamepadProvider::GamepadProvider(GamepadChangeClient* gamepad_change_client,
                                 std::unique_ptr<GamepadDataFetcher> fetcher,
                                 std::unique_ptr<base::Thread> polling_thread)
    :{}

GamepadProvider::~GamepadProvider() {}

base::ReadOnlySharedMemoryRegion
GamepadProvider::DuplicateSharedMemoryRegion() {}

void GamepadProvider::GetCurrentGamepadData(Gamepads* data) {}

void GamepadProvider::PlayVibrationEffectOnce(
    uint32_t pad_index,
    mojom::GamepadHapticEffectType type,
    mojom::GamepadEffectParametersPtr params,
    mojom::GamepadHapticsManager::PlayVibrationEffectOnceCallback callback) {}

void GamepadProvider::ResetVibrationActuator(
    uint32_t pad_index,
    mojom::GamepadHapticsManager::ResetVibrationActuatorCallback callback) {}

void GamepadProvider::Pause() {}

void GamepadProvider::Resume() {}

void GamepadProvider::RegisterForUserGesture(base::OnceClosure closure) {}

void GamepadProvider::OnDevicesChanged(base::SystemMonitor::DeviceType type) {}

void GamepadProvider::Initialize(std::unique_ptr<GamepadDataFetcher> fetcher) {}

void GamepadProvider::AddGamepadDataFetcher(
    std::unique_ptr<GamepadDataFetcher> fetcher) {}

void GamepadProvider::RemoveSourceGamepadDataFetcher(GamepadSource source) {}

void GamepadProvider::PlayEffectOnPollingThread(
    uint32_t pad_index,
    mojom::GamepadHapticEffectType type,
    mojom::GamepadEffectParametersPtr params,
    mojom::GamepadHapticsManager::PlayVibrationEffectOnceCallback callback,
    scoped_refptr<base::SequencedTaskRunner> callback_runner) {}

void GamepadProvider::ResetVibrationOnPollingThread(
    uint32_t pad_index,
    mojom::GamepadHapticsManager::PlayVibrationEffectOnceCallback callback,
    scoped_refptr<base::SequencedTaskRunner> callback_runner) {}

GamepadDataFetcher* GamepadProvider::GetSourceGamepadDataFetcher(
    GamepadSource source) {}

void GamepadProvider::DoAddGamepadDataFetcher(
    std::unique_ptr<GamepadDataFetcher> fetcher) {}

void GamepadProvider::DoRemoveSourceGamepadDataFetcher(GamepadSource source) {}

void GamepadProvider::SendPauseHint(bool paused) {}

void GamepadProvider::DoPoll() {}

void GamepadProvider::SendChangeEvents(
    mojom::GamepadChangesPtr gamepad_changes) {}

void GamepadProvider::DisconnectUnrecognizedGamepad(GamepadSource source,
                                                    int source_id) {}

void GamepadProvider::ScheduleDoPoll() {}

void GamepadProvider::OnGamepadConnectionChange(bool connected,
                                                uint32_t index,
                                                const Gamepad& pad) {}

bool GamepadProvider::CheckForUserGesture() {}

}  // namespace device