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

Unified Diff: content/browser/gamepad/raw_input_data_fetcher_win.cc

Issue 1874893002: Convert //content/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
Index: content/browser/gamepad/raw_input_data_fetcher_win.cc
diff --git a/content/browser/gamepad/raw_input_data_fetcher_win.cc b/content/browser/gamepad/raw_input_data_fetcher_win.cc
index 0693eef9eb87b51ccefc95850f8d2d676ac6338e..0e53508285d76e5c169ba89e6498107b9736b952 100644
--- a/content/browser/gamepad/raw_input_data_fetcher_win.cc
+++ b/content/browser/gamepad/raw_input_data_fetcher_win.cc
@@ -62,7 +62,7 @@ void RawInputDataFetcher::WillDestroyCurrentMessageLoop() {
RAWINPUTDEVICE* RawInputDataFetcher::GetRawInputDevices(DWORD flags) {
size_t usage_count = arraysize(DeviceUsages);
- scoped_ptr<RAWINPUTDEVICE[]> devices(new RAWINPUTDEVICE[usage_count]);
+ std::unique_ptr<RAWINPUTDEVICE[]> devices(new RAWINPUTDEVICE[usage_count]);
for (size_t i = 0; i < usage_count; ++i) {
devices[i].dwFlags = flags;
devices[i].usUsagePage = 1;
@@ -87,7 +87,8 @@ void RawInputDataFetcher::StartMonitor() {
}
// Register to receive raw HID input.
- scoped_ptr<RAWINPUTDEVICE[]> devices(GetRawInputDevices(RIDEV_INPUTSINK));
+ std::unique_ptr<RAWINPUTDEVICE[]> devices(
+ GetRawInputDevices(RIDEV_INPUTSINK));
if (!RegisterRawInputDevices(devices.get(), arraysize(DeviceUsages),
sizeof(RAWINPUTDEVICE))) {
PLOG(ERROR) << "RegisterRawInputDevices() failed for RIDEV_INPUTSINK";
@@ -109,7 +110,7 @@ void RawInputDataFetcher::StopMonitor() {
// Stop receiving raw input.
DCHECK(window_);
- scoped_ptr<RAWINPUTDEVICE[]> devices(GetRawInputDevices(RIDEV_REMOVE));
+ std::unique_ptr<RAWINPUTDEVICE[]> devices(GetRawInputDevices(RIDEV_REMOVE));
if (!RegisterRawInputDevices(devices.get(), arraysize(DeviceUsages),
sizeof(RAWINPUTDEVICE))) {
@@ -144,7 +145,8 @@ std::vector<RawGamepadInfo*> RawInputDataFetcher::EnumerateDevices() {
}
DCHECK_EQ(0u, result);
- scoped_ptr<RAWINPUTDEVICELIST[]> device_list(new RAWINPUTDEVICELIST[count]);
+ std::unique_ptr<RAWINPUTDEVICELIST[]> device_list(
+ new RAWINPUTDEVICELIST[count]);
result = GetRawInputDeviceList(device_list.get(), &count,
sizeof(RAWINPUTDEVICELIST));
if (result == static_cast<UINT>(-1)) {
@@ -190,7 +192,7 @@ RawGamepadInfo* RawInputDataFetcher::ParseGamepadInfo(HANDLE hDevice) {
}
DCHECK_EQ(0u, result);
- scoped_ptr<uint8_t[]> di_buffer(new uint8_t[size]);
+ std::unique_ptr<uint8_t[]> di_buffer(new uint8_t[size]);
RID_DEVICE_INFO* device_info =
reinterpret_cast<RID_DEVICE_INFO*>(di_buffer.get());
result = GetRawInputDeviceInfo(hDevice, RIDI_DEVICEINFO,
@@ -213,7 +215,7 @@ RawGamepadInfo* RawInputDataFetcher::ParseGamepadInfo(HANDLE hDevice) {
if (!valid_type)
return NULL;
- scoped_ptr<RawGamepadInfo> gamepad_info(new RawGamepadInfo);
+ std::unique_ptr<RawGamepadInfo> gamepad_info(new RawGamepadInfo);
gamepad_info->handle = hDevice;
gamepad_info->report_id = 0;
gamepad_info->vendor_id = device_info->hid.dwVendorId;
@@ -232,7 +234,7 @@ RawGamepadInfo* RawInputDataFetcher::ParseGamepadInfo(HANDLE hDevice) {
}
DCHECK_EQ(0u, result);
- scoped_ptr<wchar_t[]> name_buffer(new wchar_t[size]);
+ std::unique_ptr<wchar_t[]> name_buffer(new wchar_t[size]);
result = GetRawInputDeviceInfo(hDevice, RIDI_DEVICENAME,
name_buffer.get(), &size);
if (result == static_cast<UINT>(-1)) {
@@ -287,7 +289,8 @@ RawGamepadInfo* RawInputDataFetcher::ParseGamepadInfo(HANDLE hDevice) {
// Query button information.
USHORT count = caps.NumberInputButtonCaps;
if (count > 0) {
- scoped_ptr<HIDP_BUTTON_CAPS[]> button_caps(new HIDP_BUTTON_CAPS[count]);
+ std::unique_ptr<HIDP_BUTTON_CAPS[]> button_caps(
+ new HIDP_BUTTON_CAPS[count]);
status = hidp_get_button_caps_(
HidP_Input, button_caps.get(), &count, gamepad_info->preparsed_data);
DCHECK_EQ(HIDP_STATUS_SUCCESS, status);
@@ -305,7 +308,7 @@ RawGamepadInfo* RawInputDataFetcher::ParseGamepadInfo(HANDLE hDevice) {
// Query axis information.
count = caps.NumberInputValueCaps;
- scoped_ptr<HIDP_VALUE_CAPS[]> axes_caps(new HIDP_VALUE_CAPS[count]);
+ std::unique_ptr<HIDP_VALUE_CAPS[]> axes_caps(new HIDP_VALUE_CAPS[count]);
status = hidp_get_value_caps_(HidP_Input, axes_caps.get(), &count,
gamepad_info->preparsed_data);
@@ -377,7 +380,8 @@ void RawInputDataFetcher::UpdateGamepad(
reinterpret_cast<PCHAR>(input->data.hid.bRawData),
input->data.hid.dwSizeHid);
- scoped_ptr<USAGE_AND_PAGE[]> usages(new USAGE_AND_PAGE[buttons_length]);
+ std::unique_ptr<USAGE_AND_PAGE[]> usages(
+ new USAGE_AND_PAGE[buttons_length]);
status =
hidp_get_usages_ex_(HidP_Input,
0,
@@ -445,7 +449,7 @@ LRESULT RawInputDataFetcher::OnInput(HRAWINPUT input_handle) {
DCHECK_EQ(0u, result);
// Retrieve the input record.
- scoped_ptr<uint8_t[]> buffer(new uint8_t[size]);
+ std::unique_ptr<uint8_t[]> buffer(new uint8_t[size]);
RAWINPUT* input = reinterpret_cast<RAWINPUT*>(buffer.get());
result = GetRawInputData(
input_handle, RID_INPUT, buffer.get(), &size, sizeof(RAWINPUTHEADER));
« no previous file with comments | « content/browser/gamepad/raw_input_data_fetcher_win.h ('k') | content/browser/gamepad/xbox_data_fetcher_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698