diff options
author | rvargas <rvargas@chromium.org> | 2014-09-29 15:40:08 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-29 22:42:38 +0000 |
commit | 26137d0ce52c0b8a6888b3a2562253a8f966334c (patch) | |
tree | 0ed8dfb827fb3e7ac2b504d2b4a7163a27f3d972 /device | |
parent | e7002da73ea0a881bea02bab6781672ca3eeb7b4 (diff) | |
download | chromium_src-26137d0ce52c0b8a6888b3a2562253a8f966334c.zip chromium_src-26137d0ce52c0b8a6888b3a2562253a8f966334c.tar.gz chromium_src-26137d0ce52c0b8a6888b3a2562253a8f966334c.tar.bz2 |
Remove implicit HANDLE conversions from device.
BUG=416722
R=gdk@chromium.org
Review URL: https://codereview.chromium.org/604613002
Cr-Commit-Position: refs/heads/master@{#297290}
Diffstat (limited to 'device')
-rw-r--r-- | device/bluetooth/bluetooth_low_energy_win.cc | 18 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_task_manager_win.cc | 17 | ||||
-rw-r--r-- | device/hid/hid_connection_win.cc | 6 |
3 files changed, 21 insertions, 20 deletions
diff --git a/device/bluetooth/bluetooth_low_energy_win.cc b/device/bluetooth/bluetooth_low_energy_win.cc index cf1ad4b..44eefbf 100644 --- a/device/bluetooth/bluetooth_low_energy_win.cc +++ b/device/bluetooth/bluetooth_low_energy_win.cc @@ -171,7 +171,7 @@ bool CollectBluetoothLowEnergyDeviceProperty( std::string* error) { DWORD required_length; DEVPROPTYPE prop_type; - BOOL success = SetupDiGetDeviceProperty(device_info_handle, + BOOL success = SetupDiGetDeviceProperty(device_info_handle.Get(), device_info_data, &key, &prop_type, @@ -184,7 +184,7 @@ bool CollectBluetoothLowEnergyDeviceProperty( scoped_ptr<uint8_t[]> prop_value(new uint8_t[required_length]); DWORD actual_length = required_length; - success = SetupDiGetDeviceProperty(device_info_handle, + success = SetupDiGetDeviceProperty(device_info_handle.Get(), device_info_data, &key, &prop_type, @@ -211,7 +211,7 @@ bool CollectBluetoothLowEnergyDeviceRegistryProperty( scoped_ptr<DeviceRegistryPropertyValue>* value, std::string* error) { ULONG required_length = 0; - BOOL success = SetupDiGetDeviceRegistryProperty(device_info_handle, + BOOL success = SetupDiGetDeviceRegistryProperty(device_info_handle.Get(), device_info_data, property_id, NULL, @@ -224,7 +224,7 @@ bool CollectBluetoothLowEnergyDeviceRegistryProperty( scoped_ptr<uint8_t[]> property_value(new uint8_t[required_length]); ULONG actual_length = required_length; DWORD property_type; - success = SetupDiGetDeviceRegistryProperty(device_info_handle, + success = SetupDiGetDeviceRegistryProperty(device_info_handle.Get(), device_info_data, property_id, &property_type, @@ -250,13 +250,13 @@ bool CollectBluetoothLowEnergyDeviceInstanceId( std::string* error) { ULONG required_length = 0; BOOL success = SetupDiGetDeviceInstanceId( - device_info_handle, device_info_data, NULL, 0, &required_length); + device_info_handle.Get(), device_info_data, NULL, 0, &required_length); if (!CheckInsufficientBuffer(!!success, kDeviceInfoError, error)) return false; scoped_ptr<WCHAR[]> instance_id(new WCHAR[required_length]); ULONG actual_length = required_length; - success = SetupDiGetDeviceInstanceId(device_info_handle, + success = SetupDiGetDeviceInstanceId(device_info_handle.Get(), device_info_data, instance_id.get(), actual_length, @@ -417,7 +417,7 @@ bool CollectBluetoothLowEnergyDeviceInfo( std::string* error) { // Retrieve required # of bytes for interface details ULONG required_length = 0; - BOOL success = SetupDiGetDeviceInterfaceDetail(device_info_handle, + BOOL success = SetupDiGetDeviceInterfaceDetail(device_info_handle.Get(), device_interface_data, NULL, 0, @@ -438,7 +438,7 @@ bool CollectBluetoothLowEnergyDeviceInfo( device_info_data.cbSize = sizeof(SP_DEVINFO_DATA); ULONG actual_length = required_length; - success = SetupDiGetDeviceInterfaceDetail(device_info_handle, + success = SetupDiGetDeviceInterfaceDetail(device_info_handle.Get(), device_interface_data, device_interface_detail_data, actual_length, @@ -486,7 +486,7 @@ DeviceInfoResult EnumerateSingleBluetoothLowEnergyDevice( GUID BluetoothInterfaceGUID = GUID_BLUETOOTHLE_DEVICE_INTERFACE; SP_DEVICE_INTERFACE_DATA device_interface_data = {0}; device_interface_data.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA); - BOOL success = ::SetupDiEnumDeviceInterfaces(device_info_handle, + BOOL success = ::SetupDiEnumDeviceInterfaces(device_info_handle.Get(), NULL, &BluetoothInterfaceGUID, device_index, diff --git a/device/bluetooth/bluetooth_task_manager_win.cc b/device/bluetooth/bluetooth_task_manager_win.cc index d89c1a0..2e040c8 100644 --- a/device/bluetooth/bluetooth_task_manager_win.cc +++ b/device/bluetooth/bluetooth_task_manager_win.cc @@ -291,7 +291,7 @@ void BluetoothTaskManagerWin::PollAdapter() { if (!discovering_) { const BLUETOOTH_FIND_RADIO_PARAMS adapter_param = { sizeof(BLUETOOTH_FIND_RADIO_PARAMS) }; - if (adapter_handle_) + if (adapter_handle_.IsValid()) adapter_handle_.Close(); HANDLE temp_adapter_handle; HBLUETOOTH_RADIO_FIND handle = BluetoothFindFirstRadio( @@ -317,7 +317,7 @@ void BluetoothTaskManagerWin::PollAdapter() { void BluetoothTaskManagerWin::PostAdapterStateToUi() { DCHECK(bluetooth_task_runner_->RunsTasksOnCurrentThread()); AdapterState* state = new AdapterState(); - GetAdapterState(adapter_handle_, state); + GetAdapterState(adapter_handle_.Get(), state); ui_task_runner_->PostTask( FROM_HERE, base::Bind(&BluetoothTaskManagerWin::OnAdapterStateChanged, @@ -331,10 +331,11 @@ void BluetoothTaskManagerWin::SetPowered( const BluetoothAdapter::ErrorCallback& error_callback) { DCHECK(bluetooth_task_runner_->RunsTasksOnCurrentThread()); bool success = false; - if (adapter_handle_) { + if (adapter_handle_.IsValid()) { if (!powered) - BluetoothEnableDiscovery(adapter_handle_, false); - success = !!BluetoothEnableIncomingConnections(adapter_handle_, powered); + BluetoothEnableDiscovery(adapter_handle_.Get(), false); + success = + !!BluetoothEnableIncomingConnections(adapter_handle_.Get(), powered); } if (success) { @@ -351,8 +352,8 @@ void BluetoothTaskManagerWin::StartDiscovery() { FROM_HERE, base::Bind(&BluetoothTaskManagerWin::OnDiscoveryStarted, this, - !!adapter_handle_)); - if (!adapter_handle_) + adapter_handle_.IsValid())); + if (!adapter_handle_.IsValid()) return; discovering_ = true; @@ -369,7 +370,7 @@ void BluetoothTaskManagerWin::StopDiscovery() { void BluetoothTaskManagerWin::DiscoverDevices(int timeout_multiplier) { DCHECK(bluetooth_task_runner_->RunsTasksOnCurrentThread()); - if (!discovering_ || !adapter_handle_) { + if (!discovering_ || !adapter_handle_.IsValid()) { ui_task_runner_->PostTask( FROM_HERE, base::Bind(&BluetoothTaskManagerWin::OnDiscoveryStopped, this)); diff --git a/device/hid/hid_connection_win.cc b/device/hid/hid_connection_win.cc index 8e00ae0..8d0c63f 100644 --- a/device/hid/hid_connection_win.cc +++ b/device/hid/hid_connection_win.cc @@ -208,7 +208,7 @@ void HidConnectionWin::OnReadComplete(scoped_refptr<net::IOBuffer> buffer, DWORD bytes_transferred; if (GetOverlappedResult( - file_, transfer->GetOverlapped(), &bytes_transferred, FALSE)) { + file_.Get(), transfer->GetOverlapped(), &bytes_transferred, FALSE)) { CompleteRead(buffer, bytes_transferred, callback); } else { VPLOG(1) << "HID read failed"; @@ -228,7 +228,7 @@ void HidConnectionWin::OnReadFeatureComplete( DWORD bytes_transferred; if (GetOverlappedResult( - file_, transfer->GetOverlapped(), &bytes_transferred, FALSE)) { + file_.Get(), transfer->GetOverlapped(), &bytes_transferred, FALSE)) { scoped_refptr<net::IOBuffer> new_buffer( new net::IOBuffer(bytes_transferred - 1)); memcpy(new_buffer->data(), buffer->data() + 1, bytes_transferred - 1); @@ -249,7 +249,7 @@ void HidConnectionWin::OnWriteComplete(const WriteCallback& callback, DWORD bytes_transferred; if (GetOverlappedResult( - file_, transfer->GetOverlapped(), &bytes_transferred, FALSE)) { + file_.Get(), transfer->GetOverlapped(), &bytes_transferred, FALSE)) { callback.Run(true); } else { VPLOG(1) << "HID write failed"; |