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

Side by Side Diff: content/browser/gamepad/raw_input_data_fetcher_win.cc

Issue 1549113002: Switch to standard integer types in content/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 12 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/gamepad/raw_input_data_fetcher_win.h" 5 #include "content/browser/gamepad/raw_input_data_fetcher_win.h"
6 6
7 #include <stddef.h>
8
9 #include "base/macros.h"
7 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
8 #include "content/common/gamepad_hardware_buffer.h" 11 #include "content/common/gamepad_hardware_buffer.h"
9 #include "content/common/gamepad_messages.h" 12 #include "content/common/gamepad_messages.h"
10 13
11 namespace content { 14 namespace content {
12 15
13 using namespace blink; 16 using namespace blink;
14 17
15 namespace { 18 namespace {
16 19
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 183
181 // Query basic device info. 184 // Query basic device info.
182 UINT result = GetRawInputDeviceInfo(hDevice, RIDI_DEVICEINFO, 185 UINT result = GetRawInputDeviceInfo(hDevice, RIDI_DEVICEINFO,
183 NULL, &size); 186 NULL, &size);
184 if (result == static_cast<UINT>(-1)) { 187 if (result == static_cast<UINT>(-1)) {
185 PLOG(ERROR) << "GetRawInputDeviceInfo() failed"; 188 PLOG(ERROR) << "GetRawInputDeviceInfo() failed";
186 return NULL; 189 return NULL;
187 } 190 }
188 DCHECK_EQ(0u, result); 191 DCHECK_EQ(0u, result);
189 192
190 scoped_ptr<uint8[]> di_buffer(new uint8[size]); 193 scoped_ptr<uint8_t[]> di_buffer(new uint8_t[size]);
191 RID_DEVICE_INFO* device_info = 194 RID_DEVICE_INFO* device_info =
192 reinterpret_cast<RID_DEVICE_INFO*>(di_buffer.get()); 195 reinterpret_cast<RID_DEVICE_INFO*>(di_buffer.get());
193 result = GetRawInputDeviceInfo(hDevice, RIDI_DEVICEINFO, 196 result = GetRawInputDeviceInfo(hDevice, RIDI_DEVICEINFO,
194 di_buffer.get(), &size); 197 di_buffer.get(), &size);
195 if (result == static_cast<UINT>(-1)) { 198 if (result == static_cast<UINT>(-1)) {
196 PLOG(ERROR) << "GetRawInputDeviceInfo() failed"; 199 PLOG(ERROR) << "GetRawInputDeviceInfo() failed";
197 return NULL; 200 return NULL;
198 } 201 }
199 DCHECK_EQ(size, result); 202 DCHECK_EQ(size, result);
200 203
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 262
260 // Query device capabilities. 263 // Query device capabilities.
261 result = GetRawInputDeviceInfo(hDevice, RIDI_PREPARSEDDATA, 264 result = GetRawInputDeviceInfo(hDevice, RIDI_PREPARSEDDATA,
262 NULL, &size); 265 NULL, &size);
263 if (result == static_cast<UINT>(-1)) { 266 if (result == static_cast<UINT>(-1)) {
264 PLOG(ERROR) << "GetRawInputDeviceInfo() failed"; 267 PLOG(ERROR) << "GetRawInputDeviceInfo() failed";
265 return NULL; 268 return NULL;
266 } 269 }
267 DCHECK_EQ(0u, result); 270 DCHECK_EQ(0u, result);
268 271
269 gamepad_info->ppd_buffer.reset(new uint8[size]); 272 gamepad_info->ppd_buffer.reset(new uint8_t[size]);
270 gamepad_info->preparsed_data = 273 gamepad_info->preparsed_data =
271 reinterpret_cast<PHIDP_PREPARSED_DATA>(gamepad_info->ppd_buffer.get()); 274 reinterpret_cast<PHIDP_PREPARSED_DATA>(gamepad_info->ppd_buffer.get());
272 result = GetRawInputDeviceInfo(hDevice, RIDI_PREPARSEDDATA, 275 result = GetRawInputDeviceInfo(hDevice, RIDI_PREPARSEDDATA,
273 gamepad_info->ppd_buffer.get(), &size); 276 gamepad_info->ppd_buffer.get(), &size);
274 if (result == static_cast<UINT>(-1)) { 277 if (result == static_cast<UINT>(-1)) {
275 PLOG(ERROR) << "GetRawInputDeviceInfo() failed"; 278 PLOG(ERROR) << "GetRawInputDeviceInfo() failed";
276 return NULL; 279 return NULL;
277 } 280 }
278 DCHECK_EQ(size, result); 281 DCHECK_EQ(size, result);
279 282
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 UINT size = 0; 438 UINT size = 0;
436 UINT result = GetRawInputData( 439 UINT result = GetRawInputData(
437 input_handle, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER)); 440 input_handle, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER));
438 if (result == static_cast<UINT>(-1)) { 441 if (result == static_cast<UINT>(-1)) {
439 PLOG(ERROR) << "GetRawInputData() failed"; 442 PLOG(ERROR) << "GetRawInputData() failed";
440 return 0; 443 return 0;
441 } 444 }
442 DCHECK_EQ(0u, result); 445 DCHECK_EQ(0u, result);
443 446
444 // Retrieve the input record. 447 // Retrieve the input record.
445 scoped_ptr<uint8[]> buffer(new uint8[size]); 448 scoped_ptr<uint8_t[]> buffer(new uint8_t[size]);
446 RAWINPUT* input = reinterpret_cast<RAWINPUT*>(buffer.get()); 449 RAWINPUT* input = reinterpret_cast<RAWINPUT*>(buffer.get());
447 result = GetRawInputData( 450 result = GetRawInputData(
448 input_handle, RID_INPUT, buffer.get(), &size, sizeof(RAWINPUTHEADER)); 451 input_handle, RID_INPUT, buffer.get(), &size, sizeof(RAWINPUTHEADER));
449 if (result == static_cast<UINT>(-1)) { 452 if (result == static_cast<UINT>(-1)) {
450 PLOG(ERROR) << "GetRawInputData() failed"; 453 PLOG(ERROR) << "GetRawInputData() failed";
451 return 0; 454 return 0;
452 } 455 }
453 DCHECK_EQ(size, result); 456 DCHECK_EQ(size, result);
454 457
455 // Notify the observer about events generated locally. 458 // Notify the observer about events generated locally.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 return false; 516 return false;
514 hidd_get_product_string_ = reinterpret_cast<HidDGetStringFunc>( 517 hidd_get_product_string_ = reinterpret_cast<HidDGetStringFunc>(
515 hid_dll_.GetFunctionPointer("HidD_GetProductString")); 518 hid_dll_.GetFunctionPointer("HidD_GetProductString"));
516 if (!hidd_get_product_string_) 519 if (!hidd_get_product_string_)
517 return false; 520 return false;
518 521
519 return true; 522 return true;
520 } 523 }
521 524
522 } // namespace content 525 } // namespace content
OLDNEW
« 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