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

Side by Side Diff: device/hid/hid_service_win.cc

Issue 169193002: Convert scoped_ptr_malloc -> scoped_ptr, part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « device/hid/hid_connection_mac.h ('k') | google_apis/cup/client_update_protocol_nss.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "device/hid/hid_service_win.h" 5 #include "device/hid/hid_service_win.h"
6 6
7 #include <cstdlib> 7 #include <cstdlib>
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 DWORD required_size = 0; 82 DWORD required_size = 0;
83 83
84 // Determime the required size of detail struct. 84 // Determime the required size of detail struct.
85 SetupDiGetDeviceInterfaceDetailA(device_info_set, 85 SetupDiGetDeviceInterfaceDetailA(device_info_set,
86 &device_interface_data, 86 &device_interface_data,
87 NULL, 87 NULL,
88 0, 88 0,
89 &required_size, 89 &required_size,
90 NULL); 90 NULL);
91 91
92 scoped_ptr_malloc<SP_DEVICE_INTERFACE_DETAIL_DATA_A> 92 scoped_ptr<SP_DEVICE_INTERFACE_DETAIL_DATA_A, base::FreeDeleter>
93 device_interface_detail_data( 93 device_interface_detail_data(
94 reinterpret_cast<SP_DEVICE_INTERFACE_DETAIL_DATA_A*>( 94 static_cast<SP_DEVICE_INTERFACE_DETAIL_DATA_A*>(
95 malloc(required_size))); 95 malloc(required_size)));
96 device_interface_detail_data->cbSize = 96 device_interface_detail_data->cbSize =
97 sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A); 97 sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A);
98 98
99 // Get the detailed data for this device. 99 // Get the detailed data for this device.
100 res = SetupDiGetDeviceInterfaceDetailA(device_info_set, 100 res = SetupDiGetDeviceInterfaceDetailA(device_info_set,
101 &device_interface_data, 101 &device_interface_data,
102 device_interface_detail_data.get(), 102 device_interface_detail_data.get(),
103 required_size, 103 required_size,
104 NULL, 104 NULL,
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 scoped_refptr<HidConnectionWin> connection( 231 scoped_refptr<HidConnectionWin> connection(
232 new HidConnectionWin(devices_[device_id])); 232 new HidConnectionWin(devices_[device_id]));
233 if (!connection->available()) { 233 if (!connection->available()) {
234 LOG_GETLASTERROR(ERROR) << "Failed to open device."; 234 LOG_GETLASTERROR(ERROR) << "Failed to open device.";
235 return NULL; 235 return NULL;
236 } 236 }
237 return connection; 237 return connection;
238 } 238 }
239 239
240 } // namespace device 240 } // namespace device
OLDNEW
« no previous file with comments | « device/hid/hid_connection_mac.h ('k') | google_apis/cup/client_update_protocol_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698