diff options
author | dcheng <dcheng@chromium.org> | 2016-03-02 15:20:34 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-02 23:21:51 +0000 |
commit | 70c494273fa71d922405cba4dc39f5457652a2db (patch) | |
tree | 9285f262fe33d8a3d4d9f36f8cd8244caa568ef7 /device | |
parent | 063be11909af7bd64a575259b5ff01eb0686e287 (diff) | |
download | chromium_src-70c494273fa71d922405cba4dc39f5457652a2db.zip chromium_src-70c494273fa71d922405cba4dc39f5457652a2db.tar.gz chromium_src-70c494273fa71d922405cba4dc39f5457652a2db.tar.bz2 |
Convert Pass()→std::move() on Windows
Also cleaned up a few stragglers from grepping the source: it's unclear
if these are just building with weird defines, don't build at all, only
build on obscure platforms, or something else… either way, Pass()
itself will be removed shortly after this.
BUG=557422
Review URL: https://codereview.chromium.org/1752233002
Cr-Commit-Position: refs/heads/master@{#378872}
Diffstat (limited to 'device')
-rw-r--r-- | device/bluetooth/bluetooth_low_energy_win.cc | 24 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_low_energy_win_unittest.cc | 10 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_socket_win.cc | 9 | ||||
-rw-r--r-- | device/hid/hid_connection_win.cc | 3 | ||||
-rw-r--r-- | device/hid/hid_service_win.cc | 6 |
5 files changed, 29 insertions, 23 deletions
diff --git a/device/bluetooth/bluetooth_low_energy_win.cc b/device/bluetooth/bluetooth_low_energy_win.cc index 4d88565..f2830cf 100644 --- a/device/bluetooth/bluetooth_low_energy_win.cc +++ b/device/bluetooth/bluetooth_low_energy_win.cc @@ -4,6 +4,8 @@ #include "device/bluetooth/bluetooth_low_energy_win.h" +#include <utility> + #include "base/files/file.h" #include "base/logging.h" #include "base/macros.h" @@ -203,7 +205,7 @@ bool CollectBluetoothLowEnergyDeviceProperty( } (*value) = scoped_ptr<DevicePropertyValue>( - new DevicePropertyValue(prop_type, prop_value.Pass(), actual_length)); + new DevicePropertyValue(prop_type, std::move(prop_value), actual_length)); return true; } @@ -242,7 +244,7 @@ bool CollectBluetoothLowEnergyDeviceRegistryProperty( } (*value) = DeviceRegistryPropertyValue::Create( - property_type, property_value.Pass(), actual_length).Pass(); + property_type, std::move(property_value), actual_length); return true; } @@ -479,7 +481,7 @@ bool CollectBluetoothLowEnergyDeviceInfo( device_info_handle, &device_info_data, result, error)) { return false; } - (*device_info) = result.Pass(); + (*device_info) = std::move(result); return true; } @@ -530,7 +532,7 @@ HRESULT OpenBluetoothLowEnergyDevices(GUID device_interface_guid, return HRESULT_FROM_WIN32(::GetLastError()); } - (*handle) = result.Pass(); + (*handle) = std::move(result); return S_OK; } @@ -591,8 +593,8 @@ scoped_ptr<DeviceRegistryPropertyValue> DeviceRegistryPropertyValue::Create( break; } } - return scoped_ptr<DeviceRegistryPropertyValue>( - new DeviceRegistryPropertyValue(property_type, value.Pass(), value_size)); + return make_scoped_ptr(new DeviceRegistryPropertyValue( + property_type, std::move(value), value_size)); } DeviceRegistryPropertyValue::DeviceRegistryPropertyValue( @@ -600,9 +602,8 @@ DeviceRegistryPropertyValue::DeviceRegistryPropertyValue( scoped_ptr<uint8_t[]> value, size_t value_size) : property_type_(property_type), - value_(value.Pass()), - value_size_(value_size) { -} + value_(std::move(value)), + value_size_(value_size) {} DeviceRegistryPropertyValue::~DeviceRegistryPropertyValue() { } @@ -623,9 +624,8 @@ DevicePropertyValue::DevicePropertyValue(DEVPROPTYPE property_type, scoped_ptr<uint8_t[]> value, size_t value_size) : property_type_(property_type), - value_(value.Pass()), - value_size_(value_size) { -} + value_(std::move(value)), + value_size_(value_size) {} DevicePropertyValue::~DevicePropertyValue() { } diff --git a/device/bluetooth/bluetooth_low_energy_win_unittest.cc b/device/bluetooth/bluetooth_low_energy_win_unittest.cc index 02afa0f..0565f40 100644 --- a/device/bluetooth/bluetooth_low_energy_win_unittest.cc +++ b/device/bluetooth/bluetooth_low_energy_win_unittest.cc @@ -5,6 +5,8 @@ #include <stddef.h> #include <stdint.h> +#include <utility> + #include "base/strings/sys_string_conversions.h" #include "device/bluetooth/bluetooth_low_energy_win.h" #include "testing/gtest/include/gtest/gtest.h" @@ -59,7 +61,7 @@ TEST_F(BluetoothLowEnergyWinTest, DeviceRegistryPropertyValueAsString) { memcpy(buffer.get(), wide_value.c_str(), buffer_size); scoped_ptr<device::win::DeviceRegistryPropertyValue> value = device::win::DeviceRegistryPropertyValue::Create( - REG_SZ, buffer.Pass(), buffer_size).Pass(); + REG_SZ, std::move(buffer), buffer_size); EXPECT_EQ(test_value, value->AsString()); } @@ -70,7 +72,7 @@ TEST_F(BluetoothLowEnergyWinTest, DeviceRegistryPropertyValueAsDWORD) { memcpy(buffer.get(), &test_value, buffer_size); scoped_ptr<device::win::DeviceRegistryPropertyValue> value = device::win::DeviceRegistryPropertyValue::Create( - REG_DWORD, buffer.Pass(), buffer_size).Pass(); + REG_DWORD, std::move(buffer), buffer_size); EXPECT_EQ(test_value, value->AsDWORD()); } @@ -80,8 +82,8 @@ TEST_F(BluetoothLowEnergyWinTest, DevicePropertyValueAsUint32) { scoped_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]); memcpy(buffer.get(), &test_value, buffer_size); scoped_ptr<device::win::DevicePropertyValue> value( - new device::win::DevicePropertyValue( - DEVPROP_TYPE_UINT32, buffer.Pass(), buffer_size)); + new device::win::DevicePropertyValue(DEVPROP_TYPE_UINT32, + std::move(buffer), buffer_size)); EXPECT_EQ(test_value, value->AsUint32()); } diff --git a/device/bluetooth/bluetooth_socket_win.cc b/device/bluetooth/bluetooth_socket_win.cc index 49886a3..509ade4 100644 --- a/device/bluetooth/bluetooth_socket_win.cc +++ b/device/bluetooth/bluetooth_socket_win.cc @@ -7,6 +7,7 @@ #include <objbase.h> #include <string> +#include <utility> #include "base/logging.h" #include "base/memory/ref_counted.h" @@ -225,7 +226,7 @@ void BluetoothSocketWin::DoConnect( return; } - SetTCPSocket(scoped_socket.Pass()); + SetTCPSocket(std::move(scoped_socket)); success_callback.Run(); } @@ -325,8 +326,8 @@ void BluetoothSocketWin::DoListen( return; } - SetTCPSocket(scoped_socket.Pass()); - service_reg_data_ = reg_data.Pass(); + SetTCPSocket(std::move(scoped_socket)); + service_reg_data_ = std::move(reg_data); PostSuccess(success_callback); } @@ -388,7 +389,7 @@ void BluetoothSocketWin::OnAcceptOnUI( scoped_refptr<BluetoothSocketWin> peer_socket = CreateBluetoothSocket(ui_task_runner(), socket_thread()); - peer_socket->SetTCPSocket(accept_socket.Pass()); + peer_socket->SetTCPSocket(std::move(accept_socket)); success_callback.Run(peer_device, peer_socket); } diff --git a/device/hid/hid_connection_win.cc b/device/hid/hid_connection_win.cc index 833fabd..7855dc8 100644 --- a/device/hid/hid_connection_win.cc +++ b/device/hid/hid_connection_win.cc @@ -5,6 +5,7 @@ #include "device/hid/hid_connection_win.h" #include <cstring> +#include <utility> #include "base/bind.h" #include "base/files/file.h" @@ -102,7 +103,7 @@ void PendingHidTransfer::WillDestroyCurrentMessageLoop() { HidConnectionWin::HidConnectionWin(scoped_refptr<HidDeviceInfo> device_info, base::win::ScopedHandle file) : HidConnection(device_info) { - file_ = file.Pass(); + file_ = std::move(file); } HidConnectionWin::~HidConnectionWin() { diff --git a/device/hid/hid_service_win.cc b/device/hid/hid_service_win.cc index 61f2dcb..0bfc485 100644 --- a/device/hid/hid_service_win.cc +++ b/device/hid/hid_service_win.cc @@ -11,6 +11,8 @@ #include <stddef.h> #include <winioctl.h> +#include <utility> + #include "base/bind.h" #include "base/files/file.h" #include "base/location.h" @@ -68,7 +70,7 @@ void HidServiceWin::Connect(const HidDeviceId& device_id, task_runner_->PostTask( FROM_HERE, - base::Bind(callback, new HidConnectionWin(device_info, file.Pass()))); + base::Bind(callback, new HidConnectionWin(device_info, std::move(file)))); } // static @@ -295,7 +297,7 @@ base::win::ScopedHandle HidServiceWin::OpenDevice( file.Set(CreateFileA(device_path.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL)); } - return file.Pass(); + return file; } } // namespace device |