Commit 26137d0c authored by rvargas's avatar rvargas Committed by Commit bot

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}
parent e7002da7
......@@ -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,
......
......@@ -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));
......
......@@ -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";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment