diff options
author | dcheng <dcheng@chromium.org> | 2015-12-27 14:05:10 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-27 22:06:04 +0000 |
commit | 64f325fc1d271609f83819102a8eba6d54d98d4b (patch) | |
tree | c21ad0baee4eec54413eff1df2deb4f13e0ab9a9 /device | |
parent | 38b2f73d2594ec921ea1b73bebfd2da113b6799e (diff) | |
download | chromium_src-64f325fc1d271609f83819102a8eba6d54d98d4b.zip chromium_src-64f325fc1d271609f83819102a8eba6d54d98d4b.tar.gz chromium_src-64f325fc1d271609f83819102a8eba6d54d98d4b.tar.bz2 |
Convert Pass()→std::move() in //device
❆(੭ु ◜◡‾)੭ु⁾☃❆
BUG=557422
R=avi@chromium.org
TBR=rockot@chromium.org
Review URL: https://codereview.chromium.org/1544323002
Cr-Commit-Position: refs/heads/master@{#366937}
Diffstat (limited to 'device')
62 files changed, 366 insertions, 295 deletions
diff --git a/device/battery/battery_monitor_impl.cc b/device/battery/battery_monitor_impl.cc index b538394..8bb92db 100644 --- a/device/battery/battery_monitor_impl.cc +++ b/device/battery/battery_monitor_impl.cc @@ -4,6 +4,8 @@ #include "device/battery/battery_monitor_impl.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" @@ -12,13 +14,12 @@ namespace device { // static void BatteryMonitorImpl::Create( mojo::InterfaceRequest<BatteryMonitor> request) { - new BatteryMonitorImpl(request.Pass()); + new BatteryMonitorImpl(std::move(request)); } BatteryMonitorImpl::BatteryMonitorImpl( mojo::InterfaceRequest<BatteryMonitor> request) - : binding_(this, request.Pass()), - status_to_report_(false) { + : binding_(this, std::move(request)), status_to_report_(false) { // NOTE: DidChange may be called before AddCallback returns. This is done to // report current status. subscription_ = BatteryStatusService::GetInstance()->AddCallback( diff --git a/device/battery/battery_status_manager_linux.cc b/device/battery/battery_status_manager_linux.cc index cf07f78..0f5cfc7 100644 --- a/device/battery/battery_status_manager_linux.cc +++ b/device/battery/battery_status_manager_linux.cc @@ -85,7 +85,7 @@ scoped_ptr<base::DictionaryValue> GetPropertiesAsDictionary( scoped_ptr<PathsVector> GetPowerSourcesPaths(dbus::ObjectProxy* proxy) { scoped_ptr<PathsVector> paths(new PathsVector()); if (!proxy) - return paths.Pass(); + return paths; dbus::MethodCall method_call(kUPowerServiceName, kUPowerEnumerateDevices); scoped_ptr<dbus::Response> response( @@ -96,7 +96,7 @@ scoped_ptr<PathsVector> GetPowerSourcesPaths(dbus::ObjectProxy* proxy) { dbus::MessageReader reader(response.get()); reader.PopArrayOfObjectPaths(paths.get()); } - return paths.Pass();; + return paths; } void UpdateNumberBatteriesHistogram(int count) { diff --git a/device/battery/battery_status_service.cc b/device/battery/battery_status_service.cc index 453adb7..6b3c34c 100644 --- a/device/battery/battery_status_service.cc +++ b/device/battery/battery_status_service.cc @@ -4,6 +4,8 @@ #include "device/battery/battery_status_service.h" +#include <utility> + #include "base/bind.h" #include "base/message_loop/message_loop.h" #include "base/single_thread_task_runner.h" @@ -99,7 +101,7 @@ BatteryStatusService::GetUpdateCallbackForTesting() const { void BatteryStatusService::SetBatteryManagerForTesting( scoped_ptr<BatteryStatusManager> test_battery_manager) { - battery_fetcher_ = test_battery_manager.Pass(); + battery_fetcher_ = std::move(test_battery_manager); status_ = BatteryStatus(); status_updated_ = false; } diff --git a/device/battery/battery_status_service_unittest.cc b/device/battery/battery_status_service_unittest.cc index c46b806..45d137d 100644 --- a/device/battery/battery_status_service_unittest.cc +++ b/device/battery/battery_status_service_unittest.cc @@ -2,12 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "device/battery/battery_status_service.h" + +#include <utility> + #include "base/bind.h" #include "base/macros.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "device/battery/battery_status_manager.h" -#include "device/battery/battery_status_service.h" #include "testing/gtest/include/gtest/gtest.h" namespace device { @@ -69,7 +72,7 @@ class BatteryStatusServiceTest : public testing::Test { new FakeBatteryManager(battery_service_.GetUpdateCallbackForTesting())); battery_manager_ = battery_manager.get(); - battery_service_.SetBatteryManagerForTesting(battery_manager.Pass()); + battery_service_.SetBatteryManagerForTesting(std::move(battery_manager)); } void TearDown() override { diff --git a/device/bluetooth/bluetooth_adapter.cc b/device/bluetooth/bluetooth_adapter.cc index 20f73d6..2f90428 100644 --- a/device/bluetooth/bluetooth_adapter.cc +++ b/device/bluetooth/bluetooth_adapter.cc @@ -4,6 +4,8 @@ #include "device/bluetooth/bluetooth_adapter.h" +#include <utility> + #include "base/bind.h" #include "base/metrics/histogram_macros.h" #include "base/stl_util.h" @@ -168,9 +170,9 @@ void BluetoothAdapter::OnStartDiscoverySession( scoped_ptr<BluetoothDiscoverySession> discovery_session( new BluetoothDiscoverySession(scoped_refptr<BluetoothAdapter>(this), - discovery_filter.Pass())); + std::move(discovery_filter))); discovery_sessions_.insert(discovery_session.get()); - callback.Run(discovery_session.Pass()); + callback.Run(std::move(discovery_session)); } void BluetoothAdapter::OnStartDiscoverySessionError( @@ -239,7 +241,7 @@ BluetoothAdapter::GetMergedDiscoveryFilterHelper( result = BluetoothDiscoveryFilter::Merge(result.get(), curr_filter); } - return result.Pass(); + return result; } // static diff --git a/device/bluetooth/bluetooth_adapter_bluez.cc b/device/bluetooth/bluetooth_adapter_bluez.cc index 2e059f1..0997dd9 100644 --- a/device/bluetooth/bluetooth_adapter_bluez.cc +++ b/device/bluetooth/bluetooth_adapter_bluez.cc @@ -5,6 +5,7 @@ #include "device/bluetooth/bluetooth_adapter_bluez.h" #include <string> +#include <utility> #include "base/bind.h" #include "base/location.h" @@ -345,7 +346,7 @@ void BluetoothAdapterBlueZ::RegisterAdvertisement( const CreateAdvertisementCallback& callback, const CreateAdvertisementErrorCallback& error_callback) { scoped_refptr<BluetoothAdvertisementBlueZ> advertisement( - new BluetoothAdvertisementBlueZ(advertisement_data.Pass(), this)); + new BluetoothAdvertisementBlueZ(std::move(advertisement_data), this)); advertisement->Register(base::Bind(callback, advertisement), error_callback); } @@ -1198,7 +1199,7 @@ void BluetoothAdapterBlueZ::AddDiscoverySession( BluetoothDiscoveryFilter::Transport::TRANSPORT_DUAL)); df->CopyFrom(*discovery_filter); SetDiscoveryFilter( - df.Pass(), + std::move(df), base::Bind(&BluetoothAdapterBlueZ::OnPreSetDiscoveryFilter, weak_ptr_factory_.GetWeakPtr(), callback, error_callback), base::Bind(&BluetoothAdapterBlueZ::OnPreSetDiscoveryFilterError, diff --git a/device/bluetooth/bluetooth_adapter_profile_bluez.cc b/device/bluetooth/bluetooth_adapter_profile_bluez.cc index 845002b..86b93c6 100644 --- a/device/bluetooth/bluetooth_adapter_profile_bluez.cc +++ b/device/bluetooth/bluetooth_adapter_profile_bluez.cc @@ -5,6 +5,7 @@ #include "device/bluetooth/bluetooth_adapter_profile_bluez.h" #include <string> +#include <utility> #include "base/bind.h" #include "base/logging.h" @@ -125,7 +126,7 @@ void BluetoothAdapterProfileBlueZ::NewConnection( return; } - delegates_[delegate_path.value()]->NewConnection(device_path, fd.Pass(), + delegates_[delegate_path.value()]->NewConnection(device_path, std::move(fd), options, callback); } diff --git a/device/bluetooth/bluetooth_adapter_unittest.cc b/device/bluetooth/bluetooth_adapter_unittest.cc index 9cff2e4..6bc24c3 100644 --- a/device/bluetooth/bluetooth_adapter_unittest.cc +++ b/device/bluetooth/bluetooth_adapter_unittest.cc @@ -2,14 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "device/bluetooth/bluetooth_adapter.h" + #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/memory/ref_counted.h" #include "base/run_loop.h" #include "build/build_config.h" -#include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_device.h" #include "device/bluetooth/bluetooth_discovery_session.h" #include "device/bluetooth/test/bluetooth_test.h" @@ -61,7 +63,7 @@ class TestBluetoothAdapter : public BluetoothAdapter { scoped_ptr<BluetoothDiscoveryFilter> discovery_filter, const DiscoverySessionCallback& callback, const ErrorCallback& error_callback) override { - OnStartDiscoverySession(discovery_filter.Pass(), callback); + OnStartDiscoverySession(std::move(discovery_filter), callback); } void StartDiscoverySession(const DiscoverySessionCallback& callback, @@ -94,7 +96,7 @@ class TestBluetoothAdapter : public BluetoothAdapter { void TestOnStartDiscoverySession( scoped_ptr<device::BluetoothDiscoverySession> discovery_session) { - discovery_sessions_.push_back(discovery_session.Pass()); + discovery_sessions_.push_back(std::move(discovery_session)); } void CleanupSessions() { discovery_sessions_.clear(); } @@ -102,7 +104,7 @@ class TestBluetoothAdapter : public BluetoothAdapter { void InjectFilteredSession( scoped_ptr<device::BluetoothDiscoveryFilter> discovery_filter) { StartDiscoverySessionWithFilter( - discovery_filter.Pass(), + std::move(discovery_filter), base::Bind(&TestBluetoothAdapter::TestOnStartDiscoverySession, base::Unretained(this)), base::Bind(&TestBluetoothAdapter::TestErrorCallback, @@ -226,7 +228,7 @@ TEST(BluetoothAdapterTest, GetMergedDiscoveryFilterRegular) { scoped_ptr<BluetoothDiscoveryFilter> discovery_filter; // make sure adapter have one session wihout filtering. - adapter->InjectFilteredSession(discovery_filter.Pass()); + adapter->InjectFilteredSession(std::move(discovery_filter)); // having one reglar session should result in no filter scoped_ptr<BluetoothDiscoveryFilter> resulting_filter = @@ -257,7 +259,7 @@ TEST(BluetoothAdapterTest, GetMergedDiscoveryFilterRssi) { scoped_ptr<BluetoothDiscoveryFilter> discovery_filter2(df2); // make sure adapter have one session wihout filtering. - adapter->InjectFilteredSession(discovery_filter.Pass()); + adapter->InjectFilteredSession(std::move(discovery_filter)); // DO_NOTHING should have no impact resulting_filter = adapter->GetMergedDiscoveryFilter(); @@ -269,7 +271,7 @@ TEST(BluetoothAdapterTest, GetMergedDiscoveryFilterRssi) { resulting_filter->GetRSSI(&resulting_rssi); EXPECT_EQ(-30, resulting_rssi); - adapter->InjectFilteredSession(discovery_filter2.Pass()); + adapter->InjectFilteredSession(std::move(discovery_filter2)); // result of merging two rssi values should be lower one resulting_filter = adapter->GetMergedDiscoveryFilter(); @@ -293,7 +295,7 @@ TEST(BluetoothAdapterTest, GetMergedDiscoveryFilterRssi) { // when rssi and pathloss are merged, both should be cleared, becuase there is // no way to tell which filter will be more generic - adapter->InjectFilteredSession(discovery_filter3.Pass()); + adapter->InjectFilteredSession(std::move(discovery_filter3)); resulting_filter = adapter->GetMergedDiscoveryFilter(); EXPECT_FALSE(resulting_filter->GetRSSI(&resulting_rssi)); EXPECT_FALSE(resulting_filter->GetPathloss(&resulting_pathloss)); @@ -313,14 +315,14 @@ TEST(BluetoothAdapterTest, GetMergedDiscoveryFilterTransport) { BluetoothDiscoveryFilter::Transport::TRANSPORT_LE); scoped_ptr<BluetoothDiscoveryFilter> discovery_filter2(df2); - adapter->InjectFilteredSession(discovery_filter.Pass()); + adapter->InjectFilteredSession(std::move(discovery_filter)); // Just one filter, make sure transport was properly rewritten resulting_filter = adapter->GetMergedDiscoveryFilter(); EXPECT_EQ(BluetoothDiscoveryFilter::Transport::TRANSPORT_CLASSIC, resulting_filter->GetTransport()); - adapter->InjectFilteredSession(discovery_filter2.Pass()); + adapter->InjectFilteredSession(std::move(discovery_filter2)); // Two filters, should have OR of both transport's resulting_filter = adapter->GetMergedDiscoveryFilter(); @@ -344,7 +346,7 @@ TEST(BluetoothAdapterTest, GetMergedDiscoveryFilterTransport) { scoped_ptr<BluetoothDiscoveryFilter> discovery_filter3(df3); // Merging empty filter in should result in empty filter - adapter->InjectFilteredSession(discovery_filter3.Pass()); + adapter->InjectFilteredSession(std::move(discovery_filter3)); resulting_filter = adapter->GetMergedDiscoveryFilter(); EXPECT_TRUE(resulting_filter->IsDefault()); @@ -379,9 +381,9 @@ TEST(BluetoothAdapterTest, GetMergedDiscoveryFilterAllFields) { scoped_ptr<BluetoothDiscoveryFilter> discovery_filter3(df3); // make sure adapter have one session wihout filtering. - adapter->InjectFilteredSession(discovery_filter.Pass()); - adapter->InjectFilteredSession(discovery_filter2.Pass()); - adapter->InjectFilteredSession(discovery_filter3.Pass()); + adapter->InjectFilteredSession(std::move(discovery_filter)); + adapter->InjectFilteredSession(std::move(discovery_filter2)); + adapter->InjectFilteredSession(std::move(discovery_filter3)); scoped_ptr<BluetoothDiscoveryFilter> resulting_filter = adapter->GetMergedDiscoveryFilter(); diff --git a/device/bluetooth/bluetooth_advertisement.h b/device/bluetooth/bluetooth_advertisement.h index 5dcc1f0..4f79519 100644 --- a/device/bluetooth/bluetooth_advertisement.h +++ b/device/bluetooth/bluetooth_advertisement.h @@ -6,9 +6,9 @@ #define DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_H_ #include <stdint.h> - #include <map> #include <string> +#include <utility> #include <vector> #include "base/callback.h" @@ -60,24 +60,24 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdvertisement ~Data(); AdvertisementType type() { return type_; } - scoped_ptr<UUIDList> service_uuids() { return service_uuids_.Pass(); } + scoped_ptr<UUIDList> service_uuids() { return std::move(service_uuids_); } scoped_ptr<ManufacturerData> manufacturer_data() { - return manufacturer_data_.Pass(); + return std::move(manufacturer_data_); } - scoped_ptr<UUIDList> solicit_uuids() { return solicit_uuids_.Pass(); } - scoped_ptr<ServiceData> service_data() { return service_data_.Pass(); } + scoped_ptr<UUIDList> solicit_uuids() { return std::move(solicit_uuids_); } + scoped_ptr<ServiceData> service_data() { return std::move(service_data_); } void set_service_uuids(scoped_ptr<UUIDList> service_uuids) { - service_uuids_ = service_uuids.Pass(); + service_uuids_ = std::move(service_uuids); } void set_manufacturer_data(scoped_ptr<ManufacturerData> manufacturer_data) { - manufacturer_data_ = manufacturer_data.Pass(); + manufacturer_data_ = std::move(manufacturer_data); } void set_solicit_uuids(scoped_ptr<UUIDList> solicit_uuids) { - solicit_uuids_ = solicit_uuids.Pass(); + solicit_uuids_ = std::move(solicit_uuids); } void set_service_data(scoped_ptr<ServiceData> service_data) { - service_data_ = service_data.Pass(); + service_data_ = std::move(service_data); } void set_include_tx_power(bool include_tx_power) { diff --git a/device/bluetooth/bluetooth_advertisement_bluez.cc b/device/bluetooth/bluetooth_advertisement_bluez.cc index 97b78da..869692f 100644 --- a/device/bluetooth/bluetooth_advertisement_bluez.cc +++ b/device/bluetooth/bluetooth_advertisement_bluez.cc @@ -89,8 +89,8 @@ BluetoothAdvertisementBlueZ::BluetoothAdvertisementBlueZ( static_cast< bluez::BluetoothLEAdvertisementServiceProvider::AdvertisementType>( data->type()), - data->service_uuids().Pass(), data->manufacturer_data().Pass(), - data->solicit_uuids().Pass(), data->service_data().Pass()); + data->service_uuids(), data->manufacturer_data(), data->solicit_uuids(), + data->service_data()); } void BluetoothAdvertisementBlueZ::Register( diff --git a/device/bluetooth/bluetooth_advertisement_bluez_unittest.cc b/device/bluetooth/bluetooth_advertisement_bluez_unittest.cc index b3a6702..ea933fc 100644 --- a/device/bluetooth/bluetooth_advertisement_bluez_unittest.cc +++ b/device/bluetooth/bluetooth_advertisement_bluez_unittest.cc @@ -93,14 +93,14 @@ class BluetoothAdvertisementBlueZTest : public testing::Test { make_scoped_ptr(new BluetoothAdvertisement::Data( BluetoothAdvertisement::ADVERTISEMENT_TYPE_BROADCAST)); data->set_service_uuids( - make_scoped_ptr(new BluetoothAdvertisement::UUIDList()).Pass()); + make_scoped_ptr(new BluetoothAdvertisement::UUIDList())); data->set_manufacturer_data( - make_scoped_ptr(new BluetoothAdvertisement::ManufacturerData()).Pass()); + make_scoped_ptr(new BluetoothAdvertisement::ManufacturerData())); data->set_solicit_uuids( - make_scoped_ptr(new BluetoothAdvertisement::UUIDList()).Pass()); + make_scoped_ptr(new BluetoothAdvertisement::UUIDList())); data->set_service_data( - make_scoped_ptr(new BluetoothAdvertisement::ServiceData()).Pass()); - return data.Pass(); + make_scoped_ptr(new BluetoothAdvertisement::ServiceData())); + return data; } // Creates and registers an advertisement with the adapter. @@ -109,7 +109,7 @@ class BluetoothAdvertisementBlueZTest : public testing::Test { advertisement_ = nullptr; adapter_->RegisterAdvertisement( - CreateAdvertisementData().Pass(), + CreateAdvertisementData(), base::Bind(&BluetoothAdvertisementBlueZTest::RegisterCallback, base::Unretained(this)), base::Bind(&BluetoothAdvertisementBlueZTest::AdvertisementErrorCallback, diff --git a/device/bluetooth/bluetooth_bluez_unittest.cc b/device/bluetooth/bluetooth_bluez_unittest.cc index 74287e0..309aec0 100644 --- a/device/bluetooth/bluetooth_bluez_unittest.cc +++ b/device/bluetooth/bluetooth_bluez_unittest.cc @@ -4,6 +4,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/memory/scoped_vector.h" #include "base/message_loop/message_loop.h" @@ -1408,7 +1409,7 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterBeforeStartDiscovery) { true, base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)), base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); adapter_->StartDiscoverySessionWithFilter( - discovery_filter.Pass(), + std::move(discovery_filter), base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, base::Unretained(this)), base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); @@ -1473,7 +1474,7 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterBeforeStartDiscoveryFail) { fake_bluetooth_adapter_client_->MakeSetDiscoveryFilterFail(); adapter_->StartDiscoverySessionWithFilter( - discovery_filter.Pass(), + std::move(discovery_filter), base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, base::Unretained(this)), base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); @@ -1523,13 +1524,13 @@ TEST_F(BluetoothBlueZTest, QueuedSetDiscoveryFilterBeforeStartDiscovery) { // Queue two requests to start discovery session with filter. adapter_->StartDiscoverySessionWithFilter( - discovery_filter.Pass(), + std::move(discovery_filter), base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, base::Unretained(this)), base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); adapter_->StartDiscoverySessionWithFilter( - discovery_filter2.Pass(), + std::move(discovery_filter2), base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, base::Unretained(this)), base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); @@ -1620,13 +1621,13 @@ TEST_F(BluetoothBlueZTest, QueuedSetDiscoveryFilterBeforeStartDiscoveryFail) { // Queue two requests to start discovery session with filter. adapter_->StartDiscoverySessionWithFilter( - discovery_filter.Pass(), + std::move(discovery_filter), base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, base::Unretained(this)), base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); adapter_->StartDiscoverySessionWithFilter( - discovery_filter2.Pass(), + std::move(discovery_filter2), base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, base::Unretained(this)), base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); @@ -1722,7 +1723,7 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterAfterStartDiscovery) { scoped_ptr<BluetoothDiscoveryFilter> discovery_filter(df); discovery_sessions_[0]->SetDiscoveryFilter( - discovery_filter.Pass(), + std::move(discovery_filter), base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)), base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); @@ -1801,7 +1802,7 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterBeforeStartDiscoveryMultiple) { } adapter_->StartDiscoverySessionWithFilter( - discovery_filter.Pass(), + std::move(discovery_filter), base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, base::Unretained(this)), base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); @@ -1925,7 +1926,7 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterBeforeStartDiscoveryMultiple) { } adapter_->StartDiscoverySessionWithFilter( - discovery_filter.Pass(), + std::move(discovery_filter), base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, base::Unretained(this)), base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); @@ -2007,7 +2008,7 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterMergingTest) { scoped_ptr<BluetoothDiscoveryFilter> discovery_filter(df); adapter_->StartDiscoverySessionWithFilter( - discovery_filter.Pass(), + std::move(discovery_filter), base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, base::Unretained(this)), base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); @@ -2029,7 +2030,7 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterMergingTest) { discovery_filter = scoped_ptr<BluetoothDiscoveryFilter>(df); adapter_->StartDiscoverySessionWithFilter( - discovery_filter.Pass(), + std::move(discovery_filter), base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, base::Unretained(this)), base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); @@ -2053,7 +2054,7 @@ TEST_F(BluetoothBlueZTest, SetDiscoveryFilterMergingTest) { scoped_ptr<BluetoothDiscoveryFilter> discovery_filter3(df3); adapter_->StartDiscoverySessionWithFilter( - discovery_filter3.Pass(), + std::move(discovery_filter3), base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, base::Unretained(this)), base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); diff --git a/device/bluetooth/bluetooth_device_bluez.cc b/device/bluetooth/bluetooth_device_bluez.cc index 97ba1d7..4ae3dde 100644 --- a/device/bluetooth/bluetooth_device_bluez.cc +++ b/device/bluetooth/bluetooth_device_bluez.cc @@ -5,6 +5,7 @@ #include "device/bluetooth/bluetooth_device_bluez.h" #include <stdio.h> +#include <utility> #include "base/bind.h" #include "base/memory/scoped_ptr.h" @@ -636,7 +637,7 @@ void BluetoothDeviceBlueZ::OnCreateGattConnection( const GattConnectionCallback& callback) { scoped_ptr<device::BluetoothGattConnection> conn( new BluetoothGattConnectionBlueZ(adapter_, GetAddress(), object_path_)); - callback.Run(conn.Pass()); + callback.Run(std::move(conn)); } void BluetoothDeviceBlueZ::OnConnectError( diff --git a/device/bluetooth/bluetooth_discovery_session.cc b/device/bluetooth/bluetooth_discovery_session.cc index 964b8c5..9db760d 100644 --- a/device/bluetooth/bluetooth_discovery_session.cc +++ b/device/bluetooth/bluetooth_discovery_session.cc @@ -101,7 +101,7 @@ void BluetoothDiscoverySession::SetDiscoveryFilter( // BluetoothDiscoverySession::SetDiscoveryFilter is only used from a private // extension API, so we don't bother histogramming its failures. adapter_->SetDiscoveryFilter( - adapter_->GetMergedDiscoveryFilter().Pass(), callback, + adapter_->GetMergedDiscoveryFilter(), callback, base::Bind(&IgnoreDiscoveryOutcome, error_callback)); } diff --git a/device/bluetooth/bluetooth_gatt_bluez_unittest.cc b/device/bluetooth/bluetooth_gatt_bluez_unittest.cc index 7dcfe27..575c867 100644 --- a/device/bluetooth/bluetooth_gatt_bluez_unittest.cc +++ b/device/bluetooth/bluetooth_gatt_bluez_unittest.cc @@ -4,6 +4,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/memory/scoped_vector.h" #include "base/message_loop/message_loop.h" @@ -138,7 +139,7 @@ class BluetoothGattBlueZTest : public testing::Test { void GattConnectionCallback(scoped_ptr<BluetoothGattConnection> conn) { ++success_callback_count_; - gatt_conn_ = conn.Pass(); + gatt_conn_ = std::move(conn); } void NotifySessionCallback(scoped_ptr<BluetoothGattNotifySession> session) { diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.cc b/device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.cc index e76c57e..07806f7 100644 --- a/device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.cc +++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.cc @@ -5,6 +5,7 @@ #include "device/bluetooth/bluetooth_remote_gatt_characteristic_bluez.h" #include <limits> +#include <utility> #include "base/logging.h" #include "base/strings/stringprintf.h" @@ -251,7 +252,7 @@ void BluetoothRemoteGattCharacteristicBlueZ::StartNotifySession( new BluetoothGattNotifySessionBlueZ( service_->GetAdapter(), service_->GetDevice()->GetAddress(), service_->GetIdentifier(), GetIdentifier(), object_path_)); - callback.Run(session.Pass()); + callback.Run(std::move(session)); return; } @@ -417,7 +418,7 @@ void BluetoothRemoteGattCharacteristicBlueZ::OnStartNotifySuccess( new BluetoothGattNotifySessionBlueZ( service_->GetAdapter(), service_->GetDevice()->GetAddress(), service_->GetIdentifier(), GetIdentifier(), object_path_)); - callback.Run(session.Pass()); + callback.Run(std::move(session)); ProcessStartNotifyQueue(); } diff --git a/device/bluetooth/bluetooth_socket_bluez.cc b/device/bluetooth/bluetooth_socket_bluez.cc index df5a0c0..5a82ef1 100644 --- a/device/bluetooth/bluetooth_socket_bluez.cc +++ b/device/bluetooth/bluetooth_socket_bluez.cc @@ -5,9 +5,9 @@ #include "device/bluetooth/bluetooth_socket_bluez.h" #include <stdint.h> - #include <queue> #include <string> +#include <utility> #include "base/bind.h" #include "base/callback.h" @@ -368,7 +368,7 @@ void BluetoothSocketBlueZ::NewConnection( } else { linked_ptr<ConnectionRequest> request(new ConnectionRequest()); request->device_path = device_path; - request->fd = fd.Pass(); + request->fd = std::move(fd); request->options = options; request->callback = callback; diff --git a/device/bluetooth/bluetooth_socket_net.cc b/device/bluetooth/bluetooth_socket_net.cc index b042863..de113f9 100644 --- a/device/bluetooth/bluetooth_socket_net.cc +++ b/device/bluetooth/bluetooth_socket_net.cc @@ -6,6 +6,7 @@ #include <queue> #include <string> +#include <utility> #include "base/location.h" #include "base/logging.h" @@ -120,7 +121,7 @@ void BluetoothSocketNet::ResetTCPSocket() { } void BluetoothSocketNet::SetTCPSocket(scoped_ptr<net::TCPSocket> tcp_socket) { - tcp_socket_ = tcp_socket.Pass(); + tcp_socket_ = std::move(tcp_socket); } void BluetoothSocketNet::PostSuccess(const base::Closure& callback) { diff --git a/device/bluetooth/dbus/bluetooth_agent_service_provider.cc b/device/bluetooth/dbus/bluetooth_agent_service_provider.cc index 0592356..1bafcb0 100644 --- a/device/bluetooth/dbus/bluetooth_agent_service_provider.cc +++ b/device/bluetooth/dbus/bluetooth_agent_service_provider.cc @@ -4,6 +4,8 @@ #include "device/bluetooth/dbus/bluetooth_agent_service_provider.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "base/macros.h" @@ -323,7 +325,7 @@ class BluetoothAgentServiceProviderImpl : public BluetoothAgentServiceProvider { dbus::Response::FromMethodCall(method_call)); dbus::MessageWriter writer(response.get()); writer.AppendString(pincode); - response_sender.Run(response.Pass()); + response_sender.Run(std::move(response)); break; } case Delegate::REJECTED: { @@ -354,7 +356,7 @@ class BluetoothAgentServiceProviderImpl : public BluetoothAgentServiceProvider { dbus::Response::FromMethodCall(method_call)); dbus::MessageWriter writer(response.get()); writer.AppendUint32(passkey); - response_sender.Run(response.Pass()); + response_sender.Run(std::move(response)); break; } case Delegate::REJECTED: { diff --git a/device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.cc b/device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.cc index 6132fbf..bd578532 100644 --- a/device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.cc +++ b/device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.cc @@ -5,6 +5,7 @@ #include "device/bluetooth/dbus/bluetooth_gatt_characteristic_service_provider.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/logging.h" @@ -141,7 +142,7 @@ class BluetoothGattCharacteristicServiceProviderImpl scoped_ptr<dbus::ErrorResponse> error_response = dbus::ErrorResponse::FromMethodCall(method_call, kErrorInvalidArgs, "Expected 'ss'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -152,7 +153,7 @@ class BluetoothGattCharacteristicServiceProviderImpl dbus::ErrorResponse::FromMethodCall( method_call, kErrorInvalidArgs, "No such interface: '" + interface_name + "'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -190,7 +191,7 @@ class BluetoothGattCharacteristicServiceProviderImpl "No such property: '" + property_name + "'."); } - response_sender.Run(response.Pass()); + response_sender.Run(std::move(response)); } // Called by dbus:: when the Bluetooth daemon sets a single property of the @@ -212,7 +213,7 @@ class BluetoothGattCharacteristicServiceProviderImpl scoped_ptr<dbus::ErrorResponse> error_response = dbus::ErrorResponse::FromMethodCall(method_call, kErrorInvalidArgs, "Expected 'ssv'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -223,7 +224,7 @@ class BluetoothGattCharacteristicServiceProviderImpl dbus::ErrorResponse::FromMethodCall( method_call, kErrorInvalidArgs, "No such interface: '" + interface_name + "'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -242,7 +243,7 @@ class BluetoothGattCharacteristicServiceProviderImpl scoped_ptr<dbus::ErrorResponse> error_response = dbus::ErrorResponse::FromMethodCall(method_call, error_name, error_message); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -254,7 +255,7 @@ class BluetoothGattCharacteristicServiceProviderImpl dbus::ErrorResponse::FromMethodCall( method_call, kErrorInvalidArgs, "Property '" + property_name + "' has type 'ay'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -286,7 +287,7 @@ class BluetoothGattCharacteristicServiceProviderImpl scoped_ptr<dbus::ErrorResponse> error_response = dbus::ErrorResponse::FromMethodCall(method_call, kErrorInvalidArgs, "Expected 's'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -297,7 +298,7 @@ class BluetoothGattCharacteristicServiceProviderImpl dbus::ErrorResponse::FromMethodCall( method_call, kErrorInvalidArgs, "No such interface: '" + interface_name + "'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -363,7 +364,7 @@ class BluetoothGattCharacteristicServiceProviderImpl writer.CloseContainer(&array_writer); - response_sender.Run(response.Pass()); + response_sender.Run(std::move(response)); } // Called by the Delegate in response to a successful method call to get the @@ -381,7 +382,7 @@ class BluetoothGattCharacteristicServiceProviderImpl variant_writer.AppendArrayOfBytes(value.data(), value.size()); writer.CloseContainer(&variant_writer); - response_sender.Run(response.Pass()); + response_sender.Run(std::move(response)); } // Called by the Delegate in response to a successful method call to set the @@ -401,7 +402,7 @@ class BluetoothGattCharacteristicServiceProviderImpl dbus::ErrorResponse::FromMethodCall( method_call, kErrorFailed, "Failed to get/set characteristic value."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); } // Origin thread (i.e. the UI thread in production). diff --git a/device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.cc b/device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.cc index 36ae7ef..53cc7f1 100644 --- a/device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.cc +++ b/device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.cc @@ -5,6 +5,7 @@ #include "device/bluetooth/dbus/bluetooth_gatt_descriptor_service_provider.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/logging.h" @@ -139,7 +140,7 @@ class BluetoothGattDescriptorServiceProviderImpl scoped_ptr<dbus::ErrorResponse> error_response = dbus::ErrorResponse::FromMethodCall(method_call, kErrorInvalidArgs, "Expected 'ss'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -150,7 +151,7 @@ class BluetoothGattDescriptorServiceProviderImpl dbus::ErrorResponse::FromMethodCall( method_call, kErrorInvalidArgs, "No such interface: '" + interface_name + "'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -188,7 +189,7 @@ class BluetoothGattDescriptorServiceProviderImpl "No such property: '" + property_name + "'."); } - response_sender.Run(response.Pass()); + response_sender.Run(std::move(response)); } // Called by dbus:: when the Bluetooth daemon sets a single property of the @@ -210,7 +211,7 @@ class BluetoothGattDescriptorServiceProviderImpl scoped_ptr<dbus::ErrorResponse> error_response = dbus::ErrorResponse::FromMethodCall(method_call, kErrorInvalidArgs, "Expected 'ssv'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -221,7 +222,7 @@ class BluetoothGattDescriptorServiceProviderImpl dbus::ErrorResponse::FromMethodCall( method_call, kErrorInvalidArgs, "No such interface: '" + interface_name + "'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -240,7 +241,7 @@ class BluetoothGattDescriptorServiceProviderImpl scoped_ptr<dbus::ErrorResponse> error_response = dbus::ErrorResponse::FromMethodCall(method_call, error_name, error_message); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -252,7 +253,7 @@ class BluetoothGattDescriptorServiceProviderImpl dbus::ErrorResponse::FromMethodCall( method_call, kErrorInvalidArgs, "Property '" + property_name + "' has type 'ay'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -283,7 +284,7 @@ class BluetoothGattDescriptorServiceProviderImpl scoped_ptr<dbus::ErrorResponse> error_response = dbus::ErrorResponse::FromMethodCall(method_call, kErrorInvalidArgs, "Expected 's'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -294,7 +295,7 @@ class BluetoothGattDescriptorServiceProviderImpl dbus::ErrorResponse::FromMethodCall( method_call, kErrorInvalidArgs, "No such interface: '" + interface_name + "'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -358,7 +359,7 @@ class BluetoothGattDescriptorServiceProviderImpl writer.CloseContainer(&array_writer); - response_sender.Run(response.Pass()); + response_sender.Run(std::move(response)); } // Called by the Delegate in response to a successful method call to get the @@ -376,7 +377,7 @@ class BluetoothGattDescriptorServiceProviderImpl variant_writer.AppendArrayOfBytes(value.data(), value.size()); writer.CloseContainer(&variant_writer); - response_sender.Run(response.Pass()); + response_sender.Run(std::move(response)); } // Called by the Delegate in response to a successful method call to set the @@ -395,7 +396,7 @@ class BluetoothGattDescriptorServiceProviderImpl scoped_ptr<dbus::ErrorResponse> error_response = dbus::ErrorResponse::FromMethodCall( method_call, kErrorFailed, "Failed to get/set descriptor value."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); } // Origin thread (i.e. the UI thread in production). diff --git a/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc b/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc index c0e5ddb..c30587f 100644 --- a/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc +++ b/device/bluetooth/dbus/bluetooth_gatt_service_service_provider.cc @@ -4,6 +4,8 @@ #include "device/bluetooth/dbus/bluetooth_gatt_service_service_provider.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "base/macros.h" @@ -96,7 +98,7 @@ class BluetoothGattServiceServiceProviderImpl scoped_ptr<dbus::ErrorResponse> error_response = dbus::ErrorResponse::FromMethodCall(method_call, kErrorInvalidArgs, "Expected 'ss'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -107,7 +109,7 @@ class BluetoothGattServiceServiceProviderImpl dbus::ErrorResponse::FromMethodCall( method_call, kErrorInvalidArgs, "No such interface: '" + interface_name + "'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -118,7 +120,7 @@ class BluetoothGattServiceServiceProviderImpl dbus::ErrorResponse::FromMethodCall( method_call, kErrorInvalidArgs, "No such property: '" + property_name + "'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -137,7 +139,7 @@ class BluetoothGattServiceServiceProviderImpl writer.CloseContainer(&variant_writer); } - response_sender.Run(response.Pass()); + response_sender.Run(std::move(response)); } // Called by dbus:: when the Bluetooth daemon sets a single property of the @@ -153,7 +155,7 @@ class BluetoothGattServiceServiceProviderImpl scoped_ptr<dbus::ErrorResponse> error_response = dbus::ErrorResponse::FromMethodCall(method_call, kErrorPropertyReadOnly, "All properties are read-only."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); } // Called by dbus:: when the Bluetooth daemon fetches all properties of the @@ -171,7 +173,7 @@ class BluetoothGattServiceServiceProviderImpl scoped_ptr<dbus::ErrorResponse> error_response = dbus::ErrorResponse::FromMethodCall(method_call, kErrorInvalidArgs, "Expected 's'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -182,7 +184,7 @@ class BluetoothGattServiceServiceProviderImpl dbus::ErrorResponse::FromMethodCall( method_call, kErrorInvalidArgs, "No such interface: '" + interface_name + "'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -209,7 +211,7 @@ class BluetoothGattServiceServiceProviderImpl writer.CloseContainer(&array_writer); - response_sender.Run(response.Pass()); + response_sender.Run(std::move(response)); } // Called by dbus:: when a method is exported. diff --git a/device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.cc b/device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.cc index e5c5e35..b5e6f81 100644 --- a/device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.cc +++ b/device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.cc @@ -4,6 +4,8 @@ #include "device/bluetooth/dbus/bluetooth_le_advertisement_service_provider.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "base/macros.h" @@ -38,10 +40,10 @@ class BluetoothAdvertisementServiceProviderImpl bus_(bus), delegate_(delegate), type_(type), - service_uuids_(service_uuids.Pass()), - manufacturer_data_(manufacturer_data.Pass()), - solicit_uuids_(solicit_uuids.Pass()), - service_data_(service_data.Pass()), + service_uuids_(std::move(service_uuids)), + manufacturer_data_(std::move(manufacturer_data)), + solicit_uuids_(std::move(solicit_uuids)), + service_data_(std::move(service_data)), weak_ptr_factory_(this) { DCHECK(bus); DCHECK(delegate); @@ -116,7 +118,7 @@ class BluetoothAdvertisementServiceProviderImpl scoped_ptr<dbus::ErrorResponse> error_response = dbus::ErrorResponse::FromMethodCall(method_call, kErrorInvalidArgs, "Expected 'ss'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -127,7 +129,7 @@ class BluetoothAdvertisementServiceProviderImpl dbus::ErrorResponse::FromMethodCall( method_call, kErrorInvalidArgs, "No such interface: '" + interface_name + "'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -168,11 +170,11 @@ class BluetoothAdvertisementServiceProviderImpl dbus::ErrorResponse::FromMethodCall( method_call, kErrorInvalidArgs, "No such property: '" + property_name + "'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); } writer.CloseContainer(&variant_writer); - response_sender.Run(response.Pass()); + response_sender.Run(std::move(response)); } // Called by dbus:: when the Bluetooth daemon fetches all properties of the @@ -190,7 +192,7 @@ class BluetoothAdvertisementServiceProviderImpl scoped_ptr<dbus::ErrorResponse> error_response = dbus::ErrorResponse::FromMethodCall(method_call, kErrorInvalidArgs, "Expected 's'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } @@ -201,11 +203,11 @@ class BluetoothAdvertisementServiceProviderImpl dbus::ErrorResponse::FromMethodCall( method_call, kErrorInvalidArgs, "No such interface: '" + interface_name + "'."); - response_sender.Run(error_response.Pass()); + response_sender.Run(std::move(error_response)); return; } - response_sender.Run(CreateGetAllResponse(method_call).Pass()); + response_sender.Run(CreateGetAllResponse(method_call)); } // Called by dbus:: when a method is exported. @@ -255,7 +257,7 @@ class BluetoothAdvertisementServiceProviderImpl variant_writer.AppendArrayOfBytes(value.data(), value.size()); writer.CloseContainer(&variant_writer); - response_sender.Run(response.Pass()); + response_sender.Run(std::move(response)); } void AppendArrayVariantOfStrings(dbus::MessageWriter* dict_writer, @@ -413,8 +415,9 @@ BluetoothLEAdvertisementServiceProvider::Create( scoped_ptr<ServiceData> service_data) { if (!bluez::BluezDBusManager::Get()->IsUsingStub()) { return make_scoped_ptr(new BluetoothAdvertisementServiceProviderImpl( - bus, object_path, delegate, type, service_uuids.Pass(), - manufacturer_data.Pass(), solicit_uuids.Pass(), service_data.Pass())); + bus, object_path, delegate, type, std::move(service_uuids), + std::move(manufacturer_data), std::move(solicit_uuids), + std::move(service_data))); } else { return make_scoped_ptr( new FakeBluetoothLEAdvertisementServiceProvider(object_path, delegate)); diff --git a/device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.cc b/device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.cc index 9c7a4081..5a0d17f 100644 --- a/device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.cc +++ b/device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.cc @@ -5,6 +5,7 @@ #include "device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/logging.h" @@ -255,7 +256,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothMediaEndpointServiceProviderImpl } else { writer.AppendArrayOfBytes(&configuration[0], configuration.size()); } - response_sender.Run(response.Pass()); + response_sender.Run(std::move(response)); } // Origin thread (i.e. the UI thread in production). diff --git a/device/bluetooth/dbus/bluetooth_profile_service_provider.cc b/device/bluetooth/dbus/bluetooth_profile_service_provider.cc index 1555d51..4d2845d 100644 --- a/device/bluetooth/dbus/bluetooth_profile_service_provider.cc +++ b/device/bluetooth/dbus/bluetooth_profile_service_provider.cc @@ -4,6 +4,8 @@ #include "device/bluetooth/dbus/bluetooth_profile_service_provider.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "base/macros.h" @@ -130,7 +132,7 @@ class BluetoothProfileServiceProviderImpl &BluetoothProfileServiceProviderImpl::OnConfirmation, weak_ptr_factory_.GetWeakPtr(), method_call, response_sender); - delegate_->NewConnection(device_path, fd.Pass(), options, callback); + delegate_->NewConnection(device_path, std::move(fd), options, callback); } // Called by dbus:: when the Bluetooth daemon is about to disconnect the diff --git a/device/bluetooth/dbus/bluez_dbus_manager.cc b/device/bluetooth/dbus/bluez_dbus_manager.cc index 376261d..9736f67 100644 --- a/device/bluetooth/dbus/bluez_dbus_manager.cc +++ b/device/bluetooth/dbus/bluez_dbus_manager.cc @@ -4,6 +4,8 @@ #include "device/bluetooth/dbus/bluez_dbus_manager.h" +#include <utility> + #include "base/command_line.h" #include "base/sys_info.h" #include "base/threading/thread.h" @@ -30,7 +32,7 @@ static bool g_using_bluez_dbus_manager_for_testing = false; BluezDBusManager::BluezDBusManager( dbus::Bus* bus, scoped_ptr<BluetoothDBusClientBundle> client_bundle) - : bus_(bus), client_bundle_(client_bundle.Pass()) {} + : bus_(bus), client_bundle_(std::move(client_bundle)) {} BluezDBusManager::~BluezDBusManager() { // Delete all D-Bus clients before shutting down the system bus. @@ -177,74 +179,75 @@ BluezDBusManagerSetter::~BluezDBusManagerSetter() {} void BluezDBusManagerSetter::SetBluetoothAdapterClient( scoped_ptr<BluetoothAdapterClient> client) { bluez::BluezDBusManager::Get()->client_bundle_->bluetooth_adapter_client_ = - client.Pass(); + std::move(client); } void BluezDBusManagerSetter::SetBluetoothLEAdvertisingManagerClient( scoped_ptr<BluetoothLEAdvertisingManagerClient> client) { bluez::BluezDBusManager::Get() ->client_bundle_->bluetooth_le_advertising_manager_client_ = - client.Pass(); + std::move(client); } void BluezDBusManagerSetter::SetBluetoothAgentManagerClient( scoped_ptr<BluetoothAgentManagerClient> client) { bluez::BluezDBusManager::Get() - ->client_bundle_->bluetooth_agent_manager_client_ = client.Pass(); + ->client_bundle_->bluetooth_agent_manager_client_ = std::move(client); } void BluezDBusManagerSetter::SetBluetoothDeviceClient( scoped_ptr<BluetoothDeviceClient> client) { bluez::BluezDBusManager::Get()->client_bundle_->bluetooth_device_client_ = - client.Pass(); + std::move(client); } void BluezDBusManagerSetter::SetBluetoothGattCharacteristicClient( scoped_ptr<BluetoothGattCharacteristicClient> client) { bluez::BluezDBusManager::Get() - ->client_bundle_->bluetooth_gatt_characteristic_client_ = client.Pass(); + ->client_bundle_->bluetooth_gatt_characteristic_client_ = + std::move(client); } void BluezDBusManagerSetter::SetBluetoothGattDescriptorClient( scoped_ptr<BluetoothGattDescriptorClient> client) { bluez::BluezDBusManager::Get() - ->client_bundle_->bluetooth_gatt_descriptor_client_ = client.Pass(); + ->client_bundle_->bluetooth_gatt_descriptor_client_ = std::move(client); } void BluezDBusManagerSetter::SetBluetoothGattManagerClient( scoped_ptr<BluetoothGattManagerClient> client) { bluez::BluezDBusManager::Get() - ->client_bundle_->bluetooth_gatt_manager_client_ = client.Pass(); + ->client_bundle_->bluetooth_gatt_manager_client_ = std::move(client); } void BluezDBusManagerSetter::SetBluetoothGattServiceClient( scoped_ptr<BluetoothGattServiceClient> client) { bluez::BluezDBusManager::Get() - ->client_bundle_->bluetooth_gatt_service_client_ = client.Pass(); + ->client_bundle_->bluetooth_gatt_service_client_ = std::move(client); } void BluezDBusManagerSetter::SetBluetoothInputClient( scoped_ptr<BluetoothInputClient> client) { bluez::BluezDBusManager::Get()->client_bundle_->bluetooth_input_client_ = - client.Pass(); + std::move(client); } void BluezDBusManagerSetter::SetBluetoothMediaClient( scoped_ptr<BluetoothMediaClient> client) { bluez::BluezDBusManager::Get()->client_bundle_->bluetooth_media_client_ = - client.Pass(); + std::move(client); } void BluezDBusManagerSetter::SetBluetoothMediaTransportClient( scoped_ptr<BluetoothMediaTransportClient> client) { bluez::BluezDBusManager::Get() - ->client_bundle_->bluetooth_media_transport_client_ = client.Pass(); + ->client_bundle_->bluetooth_media_transport_client_ = std::move(client); } void BluezDBusManagerSetter::SetBluetoothProfileManagerClient( scoped_ptr<BluetoothProfileManagerClient> client) { bluez::BluezDBusManager::Get() - ->client_bundle_->bluetooth_profile_manager_client_ = client.Pass(); + ->client_bundle_->bluetooth_profile_manager_client_ = std::move(client); } } // namespace bluez diff --git a/device/bluetooth/dbus/fake_bluetooth_device_client.cc b/device/bluetooth/dbus/fake_bluetooth_device_client.cc index efcba2c..9e3e6bc 100644 --- a/device/bluetooth/dbus/fake_bluetooth_device_client.cc +++ b/device/bluetooth/dbus/fake_bluetooth_device_client.cc @@ -479,7 +479,7 @@ void FakeBluetoothDeviceClient::ConnectProfile( BluetoothProfileServiceProvider::Delegate::Options options; profile_service_provider->NewConnection( - object_path, fd.Pass(), options, + object_path, std::move(fd), options, base::Bind(&FakeBluetoothDeviceClient::ConnectionCallback, base::Unretained(this), object_path, callback, error_callback)); @@ -763,7 +763,7 @@ FakeBluetoothDeviceClient::GetBluetoothDevicesAsDictionaries() const { pairedDevice->SetBoolean("isTrusted", true); pairedDevice->SetBoolean("paired", true); pairedDevice->SetBoolean("incoming", false); - predefined_devices->Append(pairedDevice.Pass()); + predefined_devices->Append(std::move(pairedDevice)); scoped_ptr<base::DictionaryValue> legacyDevice(new base::DictionaryValue); legacyDevice->SetString("path", kLegacyAutopairPath); @@ -778,7 +778,7 @@ FakeBluetoothDeviceClient::GetBluetoothDevicesAsDictionaries() const { legacyDevice->SetBoolean("discoverable", false); legacyDevice->SetBoolean("paired", false); legacyDevice->SetBoolean("incoming", false); - predefined_devices->Append(legacyDevice.Pass()); + predefined_devices->Append(std::move(legacyDevice)); scoped_ptr<base::DictionaryValue> pin(new base::DictionaryValue); pin->SetString("path", kDisplayPinCodePath); @@ -793,7 +793,7 @@ FakeBluetoothDeviceClient::GetBluetoothDevicesAsDictionaries() const { pin->SetBoolean("discoverable", false); pin->SetBoolean("paired", false); pin->SetBoolean("incoming", false); - predefined_devices->Append(pin.Pass()); + predefined_devices->Append(std::move(pin)); scoped_ptr<base::DictionaryValue> vanishing(new base::DictionaryValue); vanishing->SetString("path", kVanishingDevicePath); @@ -808,7 +808,7 @@ FakeBluetoothDeviceClient::GetBluetoothDevicesAsDictionaries() const { vanishing->SetBoolean("discoverable", false); vanishing->SetBoolean("paired", false); vanishing->SetBoolean("incoming", false); - predefined_devices->Append(vanishing.Pass()); + predefined_devices->Append(std::move(vanishing)); scoped_ptr<base::DictionaryValue> connect_unpairable( new base::DictionaryValue); @@ -824,7 +824,7 @@ FakeBluetoothDeviceClient::GetBluetoothDevicesAsDictionaries() const { connect_unpairable->SetBoolean("discoverable", false); connect_unpairable->SetBoolean("paired", false); connect_unpairable->SetBoolean("incoming", false); - predefined_devices->Append(connect_unpairable.Pass()); + predefined_devices->Append(std::move(connect_unpairable)); scoped_ptr<base::DictionaryValue> passkey(new base::DictionaryValue); passkey->SetString("path", kDisplayPasskeyPath); @@ -839,7 +839,7 @@ FakeBluetoothDeviceClient::GetBluetoothDevicesAsDictionaries() const { passkey->SetBoolean("discoverable", false); passkey->SetBoolean("paired", false); passkey->SetBoolean("incoming", false); - predefined_devices->Append(passkey.Pass()); + predefined_devices->Append(std::move(passkey)); scoped_ptr<base::DictionaryValue> request_pin(new base::DictionaryValue); request_pin->SetString("path", kRequestPinCodePath); @@ -854,7 +854,7 @@ FakeBluetoothDeviceClient::GetBluetoothDevicesAsDictionaries() const { request_pin->SetBoolean("discoverable", false); request_pin->SetBoolean("paired", false); request_pin->SetBoolean("incoming", false); - predefined_devices->Append(request_pin.Pass()); + predefined_devices->Append(std::move(request_pin)); scoped_ptr<base::DictionaryValue> confirm(new base::DictionaryValue); confirm->SetString("path", kConfirmPasskeyPath); @@ -869,7 +869,7 @@ FakeBluetoothDeviceClient::GetBluetoothDevicesAsDictionaries() const { confirm->SetBoolean("discoverable", false); confirm->SetBoolean("paired", false); confirm->SetBoolean("incoming", false); - predefined_devices->Append(confirm.Pass()); + predefined_devices->Append(std::move(confirm)); scoped_ptr<base::DictionaryValue> request_passkey(new base::DictionaryValue); request_passkey->SetString("path", kRequestPasskeyPath); @@ -884,7 +884,7 @@ FakeBluetoothDeviceClient::GetBluetoothDevicesAsDictionaries() const { request_passkey->SetBoolean("discoverable", false); request_passkey->SetBoolean("paired", false); request_passkey->SetBoolean("incoming", false); - predefined_devices->Append(request_passkey.Pass()); + predefined_devices->Append(std::move(request_passkey)); scoped_ptr<base::DictionaryValue> unconnectable(new base::DictionaryValue); unconnectable->SetString("path", kUnconnectableDevicePath); @@ -899,7 +899,7 @@ FakeBluetoothDeviceClient::GetBluetoothDevicesAsDictionaries() const { unconnectable->SetBoolean("discoverable", false); unconnectable->SetBoolean("paired", false); unconnectable->SetBoolean("incoming", false); - predefined_devices->Append(unconnectable.Pass()); + predefined_devices->Append(std::move(unconnectable)); scoped_ptr<base::DictionaryValue> unpairable(new base::DictionaryValue); unpairable->SetString("path", kUnpairableDevicePath); @@ -914,7 +914,7 @@ FakeBluetoothDeviceClient::GetBluetoothDevicesAsDictionaries() const { unpairable->SetBoolean("discoverable", false); unpairable->SetBoolean("paired", false); unpairable->SetBoolean("incoming", false); - predefined_devices->Append(unpairable.Pass()); + predefined_devices->Append(std::move(unpairable)); scoped_ptr<base::DictionaryValue> just_works(new base::DictionaryValue); just_works->SetString("path", kJustWorksPath); @@ -929,7 +929,7 @@ FakeBluetoothDeviceClient::GetBluetoothDevicesAsDictionaries() const { just_works->SetBoolean("discoverable", false); just_works->SetBoolean("paired", false); just_works->SetBoolean("incoming", false); - predefined_devices->Append(just_works.Pass()); + predefined_devices->Append(std::move(just_works)); scoped_ptr<base::DictionaryValue> low_energy(new base::DictionaryValue); low_energy->SetString("path", kLowEnergyPath); @@ -944,7 +944,7 @@ FakeBluetoothDeviceClient::GetBluetoothDevicesAsDictionaries() const { low_energy->SetBoolean("discoverable", false); low_energy->SetBoolean("paireed", false); low_energy->SetBoolean("incoming", false); - predefined_devices->Append(low_energy.Pass()); + predefined_devices->Append(std::move(low_energy)); scoped_ptr<base::DictionaryValue> paired_unconnectable( new base::DictionaryValue); @@ -961,7 +961,7 @@ FakeBluetoothDeviceClient::GetBluetoothDevicesAsDictionaries() const { paired_unconnectable->SetBoolean("discoverable", true); paired_unconnectable->SetBoolean("paired", true); paired_unconnectable->SetBoolean("incoming", false); - predefined_devices->Append(paired_unconnectable.Pass()); + predefined_devices->Append(std::move(paired_unconnectable)); scoped_ptr<base::DictionaryValue> connected_trusted_not_paired( new base::DictionaryValue); @@ -982,9 +982,9 @@ FakeBluetoothDeviceClient::GetBluetoothDevicesAsDictionaries() const { connected_trusted_not_paired->SetBoolean("discoverable", true); connected_trusted_not_paired->SetBoolean("paired", false); connected_trusted_not_paired->SetBoolean("incoming", false); - predefined_devices->Append(connected_trusted_not_paired.Pass()); + predefined_devices->Append(std::move(connected_trusted_not_paired)); - return predefined_devices.Pass(); + return predefined_devices; } void FakeBluetoothDeviceClient::RemoveDevice( diff --git a/device/bluetooth/dbus/fake_bluetooth_profile_service_provider.cc b/device/bluetooth/dbus/fake_bluetooth_profile_service_provider.cc index 1089501..905a3af 100644 --- a/device/bluetooth/dbus/fake_bluetooth_profile_service_provider.cc +++ b/device/bluetooth/dbus/fake_bluetooth_profile_service_provider.cc @@ -4,6 +4,8 @@ #include "device/bluetooth/dbus/fake_bluetooth_profile_service_provider.h" +#include <utility> + #include "device/bluetooth/dbus/bluez_dbus_manager.h" #include "device/bluetooth/dbus/fake_bluetooth_profile_manager_client.h" @@ -42,7 +44,7 @@ void FakeBluetoothProfileServiceProvider::NewConnection( const Delegate::ConfirmationCallback& callback) { VLOG(1) << object_path_.value() << ": NewConnection for " << device_path.value(); - delegate_->NewConnection(device_path, fd.Pass(), options, callback); + delegate_->NewConnection(device_path, std::move(fd), options, callback); } void FakeBluetoothProfileServiceProvider::RequestDisconnection( diff --git a/device/bluetooth/test/mock_bluetooth_adapter.cc b/device/bluetooth/test/mock_bluetooth_adapter.cc index f2d7b2a..6972732 100644 --- a/device/bluetooth/test/mock_bluetooth_adapter.cc +++ b/device/bluetooth/test/mock_bluetooth_adapter.cc @@ -4,6 +4,8 @@ #include "device/bluetooth/test/mock_bluetooth_adapter.h" +#include <utility> + #include "build/build_config.h" #include "device/bluetooth/test/mock_bluetooth_advertisement.h" @@ -60,7 +62,7 @@ void MockBluetoothAdapter::StartDiscoverySessionWithFilter( void MockBluetoothAdapter::AddMockDevice( scoped_ptr<MockBluetoothDevice> mock_device) { - mock_devices_.push_back(mock_device.Pass()); + mock_devices_.push_back(std::move(mock_device)); } BluetoothAdapter::ConstDeviceList MockBluetoothAdapter::GetConstMockDevices() { diff --git a/device/bluetooth/test/mock_bluetooth_device.cc b/device/bluetooth/test/mock_bluetooth_device.cc index 230badaa..973b62a 100644 --- a/device/bluetooth/test/mock_bluetooth_device.cc +++ b/device/bluetooth/test/mock_bluetooth_device.cc @@ -4,6 +4,8 @@ #include "device/bluetooth/test/mock_bluetooth_device.h" +#include <utility> + #include "base/strings/utf_string_conversions.h" #include "device/bluetooth/bluetooth_gatt_service.h" #include "device/bluetooth/test/mock_bluetooth_adapter.h" @@ -62,7 +64,7 @@ MockBluetoothDevice::~MockBluetoothDevice() {} void MockBluetoothDevice::AddMockService( scoped_ptr<MockBluetoothGattService> mock_service) { - mock_services_.push_back(mock_service.Pass()); + mock_services_.push_back(std::move(mock_service)); } std::vector<BluetoothGattService*> MockBluetoothDevice::GetMockServices() diff --git a/device/bluetooth/test/mock_bluetooth_gatt_service.cc b/device/bluetooth/test/mock_bluetooth_gatt_service.cc index 93cbfc5..148208a 100644 --- a/device/bluetooth/test/mock_bluetooth_gatt_service.cc +++ b/device/bluetooth/test/mock_bluetooth_gatt_service.cc @@ -4,6 +4,8 @@ #include "device/bluetooth/test/mock_bluetooth_gatt_service.h" +#include <utility> + #include "device/bluetooth/test/mock_bluetooth_device.h" using testing::Return; @@ -35,7 +37,7 @@ MockBluetoothGattService::~MockBluetoothGattService() { void MockBluetoothGattService::AddMockCharacteristic( scoped_ptr<MockBluetoothGattCharacteristic> mock_characteristic) { - mock_characteristics_.push_back(mock_characteristic.Pass()); + mock_characteristics_.push_back(std::move(mock_characteristic)); } std::vector<BluetoothGattCharacteristic*> diff --git a/device/devices_app/devices_app.cc b/device/devices_app/devices_app.cc index 6767584..7c392ad 100644 --- a/device/devices_app/devices_app.cc +++ b/device/devices_app/devices_app.cc @@ -5,6 +5,7 @@ #include "device/devices_app/devices_app.h" #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/callback.h" @@ -105,8 +106,8 @@ void DevicesApp::Create(mojo::ApplicationConnection* connection, connection->ConnectToService(&permission_provider); // Owned by its message pipe. - usb::DeviceManagerImpl* device_manager = - new usb::DeviceManagerImpl(permission_provider.Pass(), request.Pass()); + usb::DeviceManagerImpl* device_manager = new usb::DeviceManagerImpl( + std::move(permission_provider), std::move(request)); device_manager->set_connection_error_handler( base::Bind(&DevicesApp::OnConnectionError, base::Unretained(this))); diff --git a/device/devices_app/usb/device_impl.cc b/device/devices_app/usb/device_impl.cc index c8268e6..bc1cf17 100644 --- a/device/devices_app/usb/device_impl.cc +++ b/device/devices_app/usb/device_impl.cc @@ -5,6 +5,7 @@ #include "device/devices_app/usb/device_impl.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/callback.h" @@ -74,7 +75,7 @@ void OnTransferIn(scoped_ptr<MojoTransferInCallback> callback, std::copy(buffer->data(), buffer->data() + buffer_size, bytes.begin()); data.Swap(&bytes); } - callback->Run(mojo::ConvertTo<TransferStatus>(status), data.Pass()); + callback->Run(mojo::ConvertTo<TransferStatus>(status), std::move(data)); } void OnControlTransferInPermissionCheckComplete( @@ -94,7 +95,7 @@ void OnControlTransferInPermissionCheckComplete( base::Bind(&OnTransferIn, base::Passed(&callback))); } else { mojo::Array<uint8_t> data; - callback->Run(TRANSFER_STATUS_PERMISSION_DENIED, data.Pass()); + callback->Run(TRANSFER_STATUS_PERMISSION_DENIED, std::move(data)); } } @@ -144,7 +145,7 @@ void OnIsochronousTransferIn( packets[i].Swap(&bytes); } } - callback->Run(mojo::ConvertTo<TransferStatus>(status), packets.Pass()); + callback->Run(mojo::ConvertTo<TransferStatus>(status), std::move(packets)); } void OnIsochronousTransferOut( @@ -160,9 +161,9 @@ void OnIsochronousTransferOut( DeviceImpl::DeviceImpl(scoped_refptr<UsbDevice> device, PermissionProviderPtr permission_provider, mojo::InterfaceRequest<Device> request) - : binding_(this, request.Pass()), + : binding_(this, std::move(request)), device_(device), - permission_provider_(permission_provider.Pass()), + permission_provider_(std::move(permission_provider)), weak_factory_(this) { // This object owns itself and will be destroyed if either the message pipe // it is bound to is closed or the PermissionProvider it depends on is diff --git a/device/devices_app/usb/device_impl_unittest.cc b/device/devices_app/usb/device_impl_unittest.cc index 15ece7c..3fbc702 100644 --- a/device/devices_app/usb/device_impl_unittest.cc +++ b/device/devices_app/usb/device_impl_unittest.cc @@ -2,12 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "device/devices_app/usb/device_impl.h" + #include <stddef.h> #include <stdint.h> - #include <map> #include <queue> #include <set> +#include <utility> #include <vector> #include "base/bind.h" @@ -15,7 +17,6 @@ #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/stl_util.h" -#include "device/devices_app/usb/device_impl.h" #include "device/devices_app/usb/fake_permission_provider.h" #include "device/usb/mock_usb_device.h" #include "device/usb/mock_usb_device_handle.h" @@ -157,7 +158,7 @@ class USBDeviceImplTest : public testing::Test { PermissionProviderPtr permission_provider; permission_provider_.Bind(mojo::GetProxy(&permission_provider)); DevicePtr proxy; - new DeviceImpl(mock_device_, permission_provider.Pass(), + new DeviceImpl(mock_device_, std::move(permission_provider), mojo::GetProxy(&proxy)); // Set up mock handle calls to respond based on mock device configs @@ -187,7 +188,7 @@ class USBDeviceImplTest : public testing::Test { ON_CALL(mock_handle(), IsochronousTransfer(_, _, _, _, _, _, _, _)) .WillByDefault(Invoke(this, &USBDeviceImplTest::IsochronousTransfer)); - return proxy.Pass(); + return proxy; } DevicePtr GetMockDeviceProxy() { @@ -662,7 +663,7 @@ TEST_F(USBDeviceImplTest, ControlTransfer) { params->index = 7; base::RunLoop loop; device->ControlTransferIn( - params.Pass(), static_cast<uint32_t>(fake_data.size()), 0, + std::move(params), static_cast<uint32_t>(fake_data.size()), 0, base::Bind(&ExpectTransferInAndThen, TRANSFER_STATUS_COMPLETED, fake_data, loop.QuitClosure())); loop.Run(); @@ -684,7 +685,7 @@ TEST_F(USBDeviceImplTest, ControlTransfer) { params->index = 7; base::RunLoop loop; device->ControlTransferOut( - params.Pass(), mojo::Array<uint8_t>::From(fake_data), 0, + std::move(params), mojo::Array<uint8_t>::From(fake_data), 0, base::Bind(&ExpectTransferStatusAndThen, TRANSFER_STATUS_COMPLETED, loop.QuitClosure())); loop.Run(); @@ -785,7 +786,7 @@ TEST_F(USBDeviceImplTest, IsochronousTransfer) { packets[i].Swap(&bytes); } device->IsochronousTransferOut( - 1, packets.Pass(), 0, + 1, std::move(packets), 0, base::Bind(&ExpectTransferStatusAndThen, TRANSFER_STATUS_COMPLETED, loop.QuitClosure())); loop.Run(); diff --git a/device/devices_app/usb/device_manager_impl.cc b/device/devices_app/usb/device_manager_impl.cc index 02b6bdd..b3f7784 100644 --- a/device/devices_app/usb/device_manager_impl.cc +++ b/device/devices_app/usb/device_manager_impl.cc @@ -5,6 +5,7 @@ #include "device/devices_app/usb/device_manager_impl.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/location.h" @@ -39,7 +40,7 @@ void FilterAndConvertDevicesAndThen( allowed_devices[i] = DeviceInfo::From(*it->second); } - callback.Run(allowed_devices.Pass()); + callback.Run(std::move(allowed_devices)); } } // namespace @@ -48,15 +49,15 @@ void FilterAndConvertDevicesAndThen( void DeviceManagerImpl::Create(PermissionProviderPtr permission_provider, mojo::InterfaceRequest<DeviceManager> request) { // The created object is owned by its binding. - new DeviceManagerImpl(permission_provider.Pass(), request.Pass()); + new DeviceManagerImpl(std::move(permission_provider), std::move(request)); } DeviceManagerImpl::DeviceManagerImpl( PermissionProviderPtr permission_provider, mojo::InterfaceRequest<DeviceManager> request) - : permission_provider_(permission_provider.Pass()), + : permission_provider_(std::move(permission_provider)), observer_(this), - binding_(this, request.Pass()), + binding_(this, std::move(request)), weak_factory_(this) { // This object owns itself and will be destroyed if either the message pipe // it is bound to is closed or the PermissionProvider it depends on is @@ -78,7 +79,7 @@ void DeviceManagerImpl::GetDevices(EnumerationOptionsPtr options, const GetDevicesCallback& callback) { if (!usb_service_) { mojo::Array<DeviceInfoPtr> no_devices; - callback.Run(no_devices.Pass()); + callback.Run(std::move(no_devices)); return; } @@ -106,7 +107,7 @@ void DeviceManagerImpl::GetDevice( mojo::Array<DeviceInfoPtr> requested_devices(1); requested_devices[0] = DeviceInfo::From(*device); permission_provider_->HasDevicePermission( - requested_devices.Pass(), + std::move(requested_devices), base::Bind(&DeviceManagerImpl::OnGetDevicePermissionCheckComplete, base::Unretained(this), device, base::Passed(&device_request))); @@ -122,7 +123,8 @@ void DeviceManagerImpl::OnGetDevicePermissionCheckComplete( DCHECK(allowed_guids.size() == 1); PermissionProviderPtr permission_provider; permission_provider_->Bind(mojo::GetProxy(&permission_provider)); - new DeviceImpl(device, permission_provider.Pass(), device_request.Pass()); + new DeviceImpl(device, std::move(permission_provider), + std::move(device_request)); } void DeviceManagerImpl::OnGetDevices(EnumerationOptionsPtr options, @@ -142,7 +144,7 @@ void DeviceManagerImpl::OnGetDevices(EnumerationOptionsPtr options, } permission_provider_->HasDevicePermission( - requested_devices.Pass(), + std::move(requested_devices), base::Bind(&FilterAndConvertDevicesAndThen, device_map, callback)); } @@ -182,7 +184,7 @@ void DeviceManagerImpl::MaybeRunDeviceChangesCallback() { permission_request_pending_ = true; permission_provider_->HasDevicePermission( - requested_devices.Pass(), + std::move(requested_devices), base::Bind(&DeviceManagerImpl::OnEnumerationPermissionCheckComplete, base::Unretained(this), devices_added, devices_removed)); } @@ -214,7 +216,7 @@ void DeviceManagerImpl::OnEnumerationPermissionCheckComplete( DCHECK(!device_change_callbacks_.empty()); const GetDeviceChangesCallback& callback = device_change_callbacks_.front(); - callback.Run(notification.Pass()); + callback.Run(std::move(notification)); device_change_callbacks_.pop(); } diff --git a/device/devices_app/usb/device_manager_impl_unittest.cc b/device/devices_app/usb/device_manager_impl_unittest.cc index c7f5f85..720c811 100644 --- a/device/devices_app/usb/device_manager_impl_unittest.cc +++ b/device/devices_app/usb/device_manager_impl_unittest.cc @@ -2,10 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <stddef.h> +#include "device/devices_app/usb/device_manager_impl.h" +#include <stddef.h> #include <set> #include <string> +#include <utility> #include "base/bind.h" #include "base/macros.h" @@ -15,7 +17,6 @@ #include "base/thread_task_runner_handle.h" #include "device/core/mock_device_client.h" #include "device/devices_app/usb/device_impl.h" -#include "device/devices_app/usb/device_manager_impl.h" #include "device/devices_app/usb/fake_permission_provider.h" #include "device/usb/mock_usb_device.h" #include "device/usb/mock_usb_device_handle.h" @@ -40,9 +41,9 @@ class USBDeviceManagerImplTest : public testing::Test { PermissionProviderPtr permission_provider; permission_provider_.Bind(mojo::GetProxy(&permission_provider)); DeviceManagerPtr device_manager; - DeviceManagerImpl::Create(permission_provider.Pass(), + DeviceManagerImpl::Create(std::move(permission_provider), mojo::GetProxy(&device_manager)); - return device_manager.Pass(); + return device_manager; } MockDeviceClient device_client_; @@ -120,7 +121,7 @@ TEST_F(USBDeviceManagerImplTest, GetDevices) { base::RunLoop loop; device_manager->GetDevices( - options.Pass(), + std::move(options), base::Bind(&ExpectDevicesAndThen, guids, loop.QuitClosure())); loop.Run(); } diff --git a/device/devices_app/usb/fake_permission_provider.cc b/device/devices_app/usb/fake_permission_provider.cc index b660b27..3a774a8 100644 --- a/device/devices_app/usb/fake_permission_provider.cc +++ b/device/devices_app/usb/fake_permission_provider.cc @@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <stddef.h> - #include "device/devices_app/usb/fake_permission_provider.h" +#include <stddef.h> +#include <utility> + namespace device { namespace usb { @@ -19,7 +20,7 @@ void FakePermissionProvider::HasDevicePermission( mojo::Array<mojo::String> allowed_guids(requested_devices.size()); for (size_t i = 0; i < requested_devices.size(); ++i) allowed_guids[i] = requested_devices[i]->guid; - callback.Run(allowed_guids.Pass()); + callback.Run(std::move(allowed_guids)); } void FakePermissionProvider::HasConfigurationPermission( @@ -38,7 +39,7 @@ void FakePermissionProvider::HasInterfacePermission( void FakePermissionProvider::Bind( mojo::InterfaceRequest<PermissionProvider> request) { - bindings_.AddBinding(this, request.Pass()); + bindings_.AddBinding(this, std::move(request)); } } // namespace usb diff --git a/device/devices_app/usb/type_converters.cc b/device/devices_app/usb/type_converters.cc index cc6852b..7152d45 100644 --- a/device/devices_app/usb/type_converters.cc +++ b/device/devices_app/usb/type_converters.cc @@ -143,7 +143,7 @@ TypeConverter<device::usb::EndpointInfoPtr, device::UsbEndpointDescriptor>:: ConvertTo<device::usb::TransferDirection>(endpoint.direction); info->type = ConvertTo<device::usb::EndpointType>(endpoint.transfer_type); info->packet_size = static_cast<uint32_t>(endpoint.maximum_packet_size); - return info.Pass(); + return info; } // static @@ -165,7 +165,7 @@ TypeConverter<device::usb::AlternateInterfaceInfoPtr, info->endpoints.push_back(device::usb::EndpointInfo::From(endpoint)); } - return info.Pass(); + return info; } // static @@ -187,12 +187,12 @@ TypeConverter<mojo::Array<device::usb::InterfaceInfoPtr>, auto info = device::usb::InterfaceInfo::New(); iter = interface_map.insert(std::make_pair(interfaces[i].interface_number, info.get())).first; - infos.push_back(info.Pass()); + infos.push_back(std::move(info)); } - iter->second->alternates.push_back(alternate.Pass()); + iter->second->alternates.push_back(std::move(alternate)); } - return infos.Pass(); + return infos; } // static @@ -204,7 +204,7 @@ TypeConverter<device::usb::ConfigurationInfoPtr, device::UsbConfigDescriptor>:: info->configuration_value = config.configuration_value; info->interfaces = mojo::Array<device::usb::InterfaceInfoPtr>::From(config.interfaces); - return info.Pass(); + return info; } // static @@ -216,7 +216,7 @@ device::usb::WebUsbFunctionSubsetPtr TypeConverter< device::usb::WebUsbFunctionSubset::New(); info->first_interface = function.first_interface; info->origins = mojo::Array<mojo::String>::From(function.origins); - return info.Pass(); + return info; } // static @@ -230,7 +230,7 @@ TypeConverter<device::usb::WebUsbConfigurationSubsetPtr, info->origins = mojo::Array<mojo::String>::From(config.origins); info->functions = mojo::Array<device::usb::WebUsbFunctionSubsetPtr>::From(config.functions); - return info.Pass(); + return info; } // static @@ -244,7 +244,7 @@ device::usb::WebUsbDescriptorSetPtr TypeConverter< info->configurations = mojo::Array<device::usb::WebUsbConfigurationSubsetPtr>::From( set.configurations); - return info.Pass(); + return info; } // static @@ -264,7 +264,7 @@ TypeConverter<device::usb::DeviceInfoPtr, device::UsbDevice>::Convert( info->webusb_allowed_origins = device::usb::WebUsbDescriptorSet::From( *device.webusb_allowed_origins()); } - return info.Pass(); + return info; } } // namespace mojo diff --git a/device/hid/device_monitor_linux.cc b/device/hid/device_monitor_linux.cc index 5dffc85..da78ca5 100644 --- a/device/hid/device_monitor_linux.cc +++ b/device/hid/device_monitor_linux.cc @@ -89,7 +89,7 @@ ScopedUdevDevicePtr DeviceMonitorLinux::GetDeviceFromPath( DCHECK(thread_checker_.CalledOnValidThread()); ScopedUdevDevicePtr device( udev_device_new_from_syspath(udev_.get(), path.c_str())); - return device.Pass(); + return device; } void DeviceMonitorLinux::Enumerate(const EnumerateCallback& callback) { diff --git a/device/hid/hid_connection_linux.cc b/device/hid/hid_connection_linux.cc index a2a4ebc..05fda64 100644 --- a/device/hid/hid_connection_linux.cc +++ b/device/hid/hid_connection_linux.cc @@ -7,8 +7,8 @@ #include <errno.h> #include <linux/hidraw.h> #include <sys/ioctl.h> - #include <string> +#include <utility> #include "base/bind.h" #include "base/files/file_path.h" @@ -136,7 +136,7 @@ HidConnectionLinux::HidConnectionLinux( file_task_runner_(file_task_runner), weak_factory_(this) { task_runner_ = base::ThreadTaskRunnerHandle::Get(); - device_file_ = device_file.Pass(); + device_file_ = std::move(device_file); // The helper is passed a weak pointer to this connection so that it can be // cleaned up after the connection is closed. diff --git a/device/hid/hid_service_linux.cc b/device/hid/hid_service_linux.cc index 6b48cda..f48e473 100644 --- a/device/hid/hid_service_linux.cc +++ b/device/hid/hid_service_linux.cc @@ -8,6 +8,7 @@ #include <stdint.h> #include <limits> #include <string> +#include <utility> #include "base/bind.h" #include "base/files/file.h" @@ -310,7 +311,7 @@ void HidServiceLinux::OpenOnBlockingThread(scoped_ptr<ConnectParams> params) { return; } - FinishOpen(params.Pass()); + FinishOpen(std::move(params)); } #endif // defined(OS_CHROMEOS) @@ -334,9 +335,9 @@ void HidServiceLinux::FinishOpen(scoped_ptr<ConnectParams> params) { // static void HidServiceLinux::CreateConnection(scoped_ptr<ConnectParams> params) { DCHECK(params->device_file.IsValid()); - params->callback.Run(make_scoped_refptr( - new HidConnectionLinux(params->device_info, params->device_file.Pass(), - params->file_task_runner))); + params->callback.Run(make_scoped_refptr(new HidConnectionLinux( + params->device_info, std::move(params->device_file), + params->file_task_runner))); } } // namespace device diff --git a/device/serial/data_receiver.cc b/device/serial/data_receiver.cc index 82d0153..508667f 100644 --- a/device/serial/data_receiver.cc +++ b/device/serial/data_receiver.cc @@ -5,6 +5,7 @@ #include "device/serial/data_receiver.h" #include <limits> +#include <utility> #include "base/bind.h" #include "base/message_loop/message_loop.h" @@ -83,7 +84,7 @@ class DataReceiver::PendingReceive::Buffer : public ReadOnlyBuffer { struct DataReceiver::DataFrame { explicit DataFrame(mojo::Array<uint8_t> data) : is_error(false), - data(data.Pass()), + data(std::move(data)), offset(0), error(0), dispatched(false) {} @@ -112,8 +113,8 @@ DataReceiver::DataReceiver( mojo::InterfaceRequest<serial::DataSourceClient> client, uint32_t buffer_size, int32_t fatal_error_value) - : source_(source.Pass()), - client_(this, client.Pass()), + : source_(std::move(source)), + client_(this, std::move(client)), fatal_error_value_(fatal_error_value), shut_down_(false), weak_factory_(this) { @@ -159,7 +160,8 @@ void DataReceiver::OnError(int32_t error) { } void DataReceiver::OnData(mojo::Array<uint8_t> data) { - pending_data_frames_.push(linked_ptr<DataFrame>(new DataFrame(data.Pass()))); + pending_data_frames_.push( + linked_ptr<DataFrame>(new DataFrame(std::move(data)))); if (pending_receive_) ReceiveInternal(); } diff --git a/device/serial/data_sender.cc b/device/serial/data_sender.cc index fdf5171..962b8fd 100644 --- a/device/serial/data_sender.cc +++ b/device/serial/data_sender.cc @@ -5,6 +5,7 @@ #include "device/serial/data_sender.h" #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/message_loop/message_loop.h" @@ -49,7 +50,7 @@ class DataSender::PendingSend { DataSender::DataSender(mojo::InterfacePtr<serial::DataSink> sink, uint32_t buffer_size, int32_t fatal_error_value) - : sink_(sink.Pass()), + : sink_(std::move(sink)), fatal_error_value_(fatal_error_value), shut_down_(false) { sink_.set_connection_error_handler( @@ -166,7 +167,7 @@ void DataSender::PendingSend::SendData() { mojo::Array<uint8_t> bytes(num_bytes_to_send); memcpy(&bytes[0], data_.data(), num_bytes_to_send); sender_->sink_->OnData( - bytes.Pass(), + std::move(bytes), base::Bind(&DataSender::PendingSend::OnDataSent, base::Unretained(this))); } diff --git a/device/serial/data_sink_receiver.cc b/device/serial/data_sink_receiver.cc index 64ddea1..e1d2b9c 100644 --- a/device/serial/data_sink_receiver.cc +++ b/device/serial/data_sink_receiver.cc @@ -5,6 +5,7 @@ #include "device/serial/data_sink_receiver.h" #include <limits> +#include <utility> #include "base/bind.h" #include "base/message_loop/message_loop.h" @@ -71,7 +72,7 @@ DataSinkReceiver::DataSinkReceiver( const ReadyCallback& ready_callback, const CancelCallback& cancel_callback, const ErrorCallback& error_callback) - : binding_(this, request.Pass()), + : binding_(this, std::move(request)), ready_callback_(ready_callback), cancel_callback_(cancel_callback), error_callback_(error_callback), @@ -123,7 +124,7 @@ void DataSinkReceiver::OnData( return; } pending_data_buffers_.push( - linked_ptr<DataFrame>(new DataFrame(data.Pass(), callback))); + linked_ptr<DataFrame>(new DataFrame(std::move(data), callback))); if (!buffer_in_use_) RunReadyCallback(); } @@ -254,7 +255,7 @@ void DataSinkReceiver::Buffer::DoneWithError(uint32_t bytes_read, DataSinkReceiver::DataFrame::DataFrame( mojo::Array<uint8_t> data, const mojo::Callback<void(uint32_t, int32_t)>& callback) - : data_(data.Pass()), offset_(0), callback_(callback) { + : data_(std::move(data)), offset_(0), callback_(callback) { DCHECK_LT(0u, data_.size()); } diff --git a/device/serial/data_sink_unittest.cc b/device/serial/data_sink_unittest.cc index 2b17791..a5872f5 100644 --- a/device/serial/data_sink_unittest.cc +++ b/device/serial/data_sink_unittest.cc @@ -4,6 +4,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/macros.h" @@ -47,7 +48,8 @@ class DataSinkTest : public testing::Test { base::Bind(&DataSinkTest::OnDataToRead, base::Unretained(this)), base::Bind(&DataSinkTest::OnCancel, base::Unretained(this)), base::Bind(&DataSinkTest::OnError, base::Unretained(this))); - sender_.reset(new DataSender(sink_handle.Pass(), kBufferSize, kFatalError)); + sender_.reset( + new DataSender(std::move(sink_handle), kBufferSize, kFatalError)); } void TearDown() override { @@ -158,7 +160,7 @@ class DataSinkTest : public testing::Test { } void OnDataToRead(scoped_ptr<ReadOnlyBuffer> buffer) { - read_buffer_ = buffer.Pass(); + read_buffer_ = std::move(buffer); read_buffer_contents_ = std::string(read_buffer_->GetData(), read_buffer_->GetSize()); EventReceived(EVENT_READ_BUFFER_READY); diff --git a/device/serial/data_source_sender.cc b/device/serial/data_source_sender.cc index 5b42992..af2ddcb 100644 --- a/device/serial/data_source_sender.cc +++ b/device/serial/data_source_sender.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <limits> +#include <utility> #include "base/bind.h" #include "base/message_loop/message_loop.h" @@ -76,8 +77,8 @@ DataSourceSender::DataSourceSender( mojo::InterfacePtr<serial::DataSourceClient> client, const ReadyCallback& ready_callback, const ErrorCallback& error_callback) - : binding_(this, source.Pass()), - client_(client.Pass()), + : binding_(this, std::move(source)), + client_(std::move(client)), ready_callback_(ready_callback), error_callback_(error_callback), available_buffer_capacity_(0), @@ -162,7 +163,7 @@ void DataSourceSender::DoneInternal(const std::vector<char>& data) { if (!data.empty()) { mojo::Array<uint8_t> data_to_send(data.size()); std::copy(data.begin(), data.end(), &data_to_send[0]); - client_->OnData(data_to_send.Pass()); + client_->OnData(std::move(data_to_send)); } pending_send_.reset(); } diff --git a/device/serial/data_source_unittest.cc b/device/serial/data_source_unittest.cc index ea871ed..5f30a6c 100644 --- a/device/serial/data_source_unittest.cc +++ b/device/serial/data_source_unittest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/macros.h" @@ -40,12 +41,12 @@ class DataSourceTest : public testing::Test { mojo::GetProxy(&source_sender_client_handle); source_sender_ = new DataSourceSender( mojo::GetProxy(&source_sender_handle), - source_sender_client_handle.Pass(), + std::move(source_sender_client_handle), base::Bind(&DataSourceTest::CanWriteData, base::Unretained(this)), base::Bind(&DataSourceTest::OnError, base::Unretained(this))); - receiver_ = - new DataReceiver(source_sender_handle.Pass(), - source_sender_client_request.Pass(), 100, kFatalError); + receiver_ = new DataReceiver(std::move(source_sender_handle), + std::move(source_sender_client_request), 100, + kFatalError); } void TearDown() override { @@ -101,7 +102,7 @@ class DataSourceTest : public testing::Test { void OnDataReceived(scoped_ptr<ReadOnlyBuffer> buffer) { ASSERT_TRUE(buffer); error_ = 0; - buffer_ = buffer.Pass(); + buffer_ = std::move(buffer); buffer_contents_ = std::string(buffer_->GetData(), buffer_->GetSize()); EventReceived(EVENT_RECEIVE_COMPLETE); } @@ -113,7 +114,7 @@ class DataSourceTest : public testing::Test { } void CanWriteData(scoped_ptr<WritableBuffer> buffer) { - write_buffer_ = buffer.Pass(); + write_buffer_ = std::move(buffer); EventReceived(EVENT_WRITE_BUFFER_READY); } diff --git a/device/serial/serial_connection.cc b/device/serial/serial_connection.cc index 6830cb3..249b892 100644 --- a/device/serial/serial_connection.cc +++ b/device/serial/serial_connection.cc @@ -4,6 +4,8 @@ #include "device/serial/serial_connection.h" +#include <utility> + #include "base/bind.h" #include "device/serial/buffer.h" #include "device/serial/data_sink_receiver.h" @@ -18,14 +20,14 @@ SerialConnection::SerialConnection( mojo::InterfaceRequest<serial::DataSource> source, mojo::InterfacePtr<serial::DataSourceClient> source_client, mojo::InterfaceRequest<serial::Connection> request) - : io_handler_(io_handler), binding_(this, request.Pass()) { + : io_handler_(io_handler), binding_(this, std::move(request)) { receiver_ = new DataSinkReceiver( - sink.Pass(), + std::move(sink), base::Bind(&SerialConnection::OnSendPipeReady, base::Unretained(this)), base::Bind(&SerialConnection::OnSendCancelled, base::Unretained(this)), base::Bind(base::DoNothing)); sender_ = new DataSourceSender( - source.Pass(), source_client.Pass(), + std::move(source), std::move(source_client), base::Bind(&SerialConnection::OnReceivePipeReady, base::Unretained(this)), base::Bind(base::DoNothing)); } @@ -68,11 +70,11 @@ void SerialConnection::OnSendCancelled(int32_t error) { } void SerialConnection::OnSendPipeReady(scoped_ptr<ReadOnlyBuffer> buffer) { - io_handler_->Write(buffer.Pass()); + io_handler_->Write(std::move(buffer)); } void SerialConnection::OnReceivePipeReady(scoped_ptr<WritableBuffer> buffer) { - io_handler_->Read(buffer.Pass()); + io_handler_->Read(std::move(buffer)); } } // namespace device diff --git a/device/serial/serial_connection_factory.cc b/device/serial/serial_connection_factory.cc index 49b9bc8..d167a78 100644 --- a/device/serial/serial_connection_factory.cc +++ b/device/serial/serial_connection_factory.cc @@ -4,6 +4,8 @@ #include "device/serial/serial_connection_factory.h" +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "base/macros.h" @@ -74,9 +76,9 @@ void SerialConnectionFactory::CreateConnection( mojo::InterfaceRequest<serial::DataSink> sink, mojo::InterfaceRequest<serial::DataSource> source, mojo::InterfacePtr<serial::DataSourceClient> source_client) { - scoped_refptr<ConnectTask> task( - new ConnectTask(this, path, options.Pass(), connection_request.Pass(), - sink.Pass(), source.Pass(), source_client.Pass())); + scoped_refptr<ConnectTask> task(new ConnectTask( + this, path, std::move(options), std::move(connection_request), + std::move(sink), std::move(source), std::move(source_client))); task->Run(); } @@ -93,10 +95,10 @@ SerialConnectionFactory::ConnectTask::ConnectTask( mojo::InterfacePtr<serial::DataSourceClient> source_client) : factory_(factory), path_(path), - options_(options.Pass()), - connection_request_(connection_request.Pass()), - sink_(sink.Pass()), - source_(source.Pass()), + options_(std::move(options)), + connection_request_(std::move(connection_request)), + sink_(std::move(sink)), + source_(std::move(source)), source_client_(source_client.PassInterface()) { if (!options_) { options_ = serial::ConnectionOptions::New(); @@ -126,9 +128,9 @@ void SerialConnectionFactory::ConnectTask::OnConnected(bool success) { return; } - new SerialConnection(io_handler_, sink_.Pass(), source_.Pass(), - mojo::MakeProxy(source_client_.Pass()), - connection_request_.Pass()); + new SerialConnection(io_handler_, std::move(sink_), std::move(source_), + mojo::MakeProxy(std::move(source_client_)), + std::move(connection_request_)); } } // namespace device diff --git a/device/serial/serial_connection_unittest.cc b/device/serial/serial_connection_unittest.cc index f5b153a..c310755 100644 --- a/device/serial/serial_connection_unittest.cc +++ b/device/serial/serial_connection_unittest.cc @@ -2,9 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <stdint.h> +#include "device/serial/serial_connection.h" +#include <stdint.h> #include <string> +#include <utility> #include "base/bind.h" #include "base/macros.h" @@ -15,7 +17,6 @@ #include "device/serial/data_sender.h" #include "device/serial/data_stream.mojom.h" #include "device/serial/serial.mojom.h" -#include "device/serial/serial_connection.h" #include "device/serial/serial_service_impl.h" #include "device/serial/test_serial_io_handler.h" #include "mojo/public/cpp/bindings/interface_ptr.h" @@ -30,7 +31,7 @@ class FakeSerialDeviceEnumerator : public SerialDeviceEnumerator { mojo::Array<serial::DeviceInfoPtr> devices(1); devices[0] = serial::DeviceInfo::New(); devices[0]->path = "device"; - return devices.Pass(); + return devices; } }; @@ -83,11 +84,11 @@ class SerialConnectionTest : public testing::Test { mojo::GetProxy(&source_client); service->Connect("device", serial::ConnectionOptions::New(), mojo::GetProxy(&connection_), mojo::GetProxy(&sink), - mojo::GetProxy(&source), source_client.Pass()); - sender_.reset(new DataSender(sink.Pass(), kBufferSize, + mojo::GetProxy(&source), std::move(source_client)); + sender_.reset(new DataSender(std::move(sink), kBufferSize, serial::SEND_ERROR_DISCONNECTED)); receiver_ = - new DataReceiver(source.Pass(), source_client_request.Pass(), + new DataReceiver(std::move(source), std::move(source_client_request), kBufferSize, serial::RECEIVE_ERROR_DISCONNECTED); connection_.set_connection_error_handler(base::Bind( &SerialConnectionTest::OnConnectionError, base::Unretained(this))); @@ -98,12 +99,12 @@ class SerialConnectionTest : public testing::Test { } void StoreInfo(serial::ConnectionInfoPtr options) { - info_ = options.Pass(); + info_ = std::move(options); EventReceived(EVENT_GOT_INFO); } void StoreControlSignals(serial::DeviceControlSignalsPtr signals) { - signals_ = signals.Pass(); + signals_ = std::move(signals); EventReceived(EVENT_GOT_CONTROL_SIGNALS); } @@ -218,10 +219,10 @@ TEST_F(SerialConnectionTest, SetOptions) { options->data_bits = serial::DATA_BITS_SEVEN; options->has_cts_flow_control = true; options->cts_flow_control = true; - connection_->SetOptions(options.Pass(), - base::Bind(&SerialConnectionTest::StoreSuccess, - base::Unretained(this), - EVENT_SET_OPTIONS)); + connection_->SetOptions( + std::move(options), + base::Bind(&SerialConnectionTest::StoreSuccess, base::Unretained(this), + EVENT_SET_OPTIONS)); WaitForEvent(EVENT_SET_OPTIONS); ASSERT_TRUE(success_); serial::ConnectionInfo* info = io_handler_->connection_info(); @@ -254,10 +255,10 @@ TEST_F(SerialConnectionTest, SetControlSignals) { signals->has_rts = true; signals->rts = true; - connection_->SetControlSignals(signals.Pass(), - base::Bind(&SerialConnectionTest::StoreSuccess, - base::Unretained(this), - EVENT_SET_CONTROL_SIGNALS)); + connection_->SetControlSignals( + std::move(signals), + base::Bind(&SerialConnectionTest::StoreSuccess, base::Unretained(this), + EVENT_SET_CONTROL_SIGNALS)); WaitForEvent(EVENT_SET_CONTROL_SIGNALS); ASSERT_TRUE(success_); EXPECT_TRUE(io_handler_->dtr()); diff --git a/device/serial/serial_device_enumerator_linux.cc b/device/serial/serial_device_enumerator_linux.cc index 9e308e7..d4af830 100644 --- a/device/serial/serial_device_enumerator_linux.cc +++ b/device/serial/serial_device_enumerator_linux.cc @@ -5,6 +5,7 @@ #include "device/serial/serial_device_enumerator_linux.h" #include <stdint.h> +#include <utility> #include "base/logging.h" #include "base/strings/string_number_conversions.h" @@ -39,15 +40,15 @@ mojo::Array<serial::DeviceInfoPtr> SerialDeviceEnumeratorLinux::GetDevices() { ScopedUdevEnumeratePtr enumerate(udev_enumerate_new(udev_.get())); if (!enumerate) { LOG(ERROR) << "Serial device enumeration failed."; - return devices.Pass(); + return devices; } if (udev_enumerate_add_match_subsystem(enumerate.get(), kSerialSubsystem)) { LOG(ERROR) << "Serial device enumeration failed."; - return devices.Pass(); + return devices; } if (udev_enumerate_scan_devices(enumerate.get())) { LOG(ERROR) << "Serial device enumeration failed."; - return devices.Pass(); + return devices; } udev_list_entry* entry = udev_enumerate_get_list_entry(enumerate.get()); @@ -84,10 +85,10 @@ mojo::Array<serial::DeviceInfoPtr> SerialDeviceEnumeratorLinux::GetDevices() { } if (product_name) info->display_name = product_name; - devices.push_back(info.Pass()); + devices.push_back(std::move(info)); } } - return devices.Pass(); + return devices; } } // namespace device diff --git a/device/serial/serial_io_handler.cc b/device/serial/serial_io_handler.cc index 480771b..ae63dab 100644 --- a/device/serial/serial_io_handler.cc +++ b/device/serial/serial_io_handler.cc @@ -4,6 +4,8 @@ #include "device/serial/serial_io_handler.h" +#include <utility> + #include "base/bind.h" #include "base/files/file_path.h" #include "base/message_loop/message_loop.h" @@ -146,7 +148,7 @@ void SerialIoHandler::FinishOpen(base::File file) { return; } - file_ = file.Pass(); + file_ = std::move(file); bool success = PostOpen() && ConfigurePortImpl(); if (!success) { @@ -164,7 +166,8 @@ void SerialIoHandler::Close() { if (file_.IsValid()) { DCHECK(file_thread_task_runner_.get()); file_thread_task_runner_->PostTask( - FROM_HERE, base::Bind(&SerialIoHandler::DoClose, Passed(file_.Pass()))); + FROM_HERE, + base::Bind(&SerialIoHandler::DoClose, Passed(std::move(file_)))); } } @@ -176,7 +179,7 @@ void SerialIoHandler::DoClose(base::File port) { void SerialIoHandler::Read(scoped_ptr<WritableBuffer> buffer) { DCHECK(CalledOnValidThread()); DCHECK(!IsReadPending()); - pending_read_buffer_ = buffer.Pass(); + pending_read_buffer_ = std::move(buffer); read_canceled_ = false; AddRef(); ReadImpl(); @@ -185,7 +188,7 @@ void SerialIoHandler::Read(scoped_ptr<WritableBuffer> buffer) { void SerialIoHandler::Write(scoped_ptr<ReadOnlyBuffer> buffer) { DCHECK(CalledOnValidThread()); DCHECK(!IsWritePending()); - pending_write_buffer_ = buffer.Pass(); + pending_write_buffer_ = std::move(buffer); write_canceled_ = false; AddRef(); WriteImpl(); @@ -195,7 +198,8 @@ void SerialIoHandler::ReadCompleted(int bytes_read, serial::ReceiveError error) { DCHECK(CalledOnValidThread()); DCHECK(IsReadPending()); - scoped_ptr<WritableBuffer> pending_read_buffer = pending_read_buffer_.Pass(); + scoped_ptr<WritableBuffer> pending_read_buffer = + std::move(pending_read_buffer_); if (error == serial::RECEIVE_ERROR_NONE) { pending_read_buffer->Done(bytes_read); } else { @@ -209,7 +213,7 @@ void SerialIoHandler::WriteCompleted(int bytes_written, DCHECK(CalledOnValidThread()); DCHECK(IsWritePending()); scoped_ptr<ReadOnlyBuffer> pending_write_buffer = - pending_write_buffer_.Pass(); + std::move(pending_write_buffer_); if (error == serial::SEND_ERROR_NONE) { pending_write_buffer->Done(bytes_written); } else { diff --git a/device/serial/serial_io_handler_posix.cc b/device/serial/serial_io_handler_posix.cc index b560174..45385e9 100644 --- a/device/serial/serial_io_handler_posix.cc +++ b/device/serial/serial_io_handler_posix.cc @@ -398,7 +398,7 @@ serial::DeviceControlSignalsPtr SerialIoHandlerPosix::GetControlSignals() signals->cts = (status & TIOCM_CTS) != 0; signals->dsr = (status & TIOCM_DSR) != 0; signals->ri = (status & TIOCM_RI) != 0; - return signals.Pass(); + return signals; } bool SerialIoHandlerPosix::SetControlSignals( @@ -478,7 +478,7 @@ serial::ConnectionInfoPtr SerialIoHandlerPosix::GetPortInfo() const { info->stop_bits = (config.c_cflag & CSTOPB) ? serial::STOP_BITS_TWO : serial::STOP_BITS_ONE; info->cts_flow_control = (config.c_cflag & CRTSCTS) != 0; - return info.Pass(); + return info; } bool SerialIoHandlerPosix::SetBreak() { diff --git a/device/serial/serial_service_impl.cc b/device/serial/serial_service_impl.cc index 962de63..3fc6a63 100644 --- a/device/serial/serial_service_impl.cc +++ b/device/serial/serial_service_impl.cc @@ -5,6 +5,7 @@ #include "device/serial/serial_service_impl.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/location.h" @@ -15,17 +16,16 @@ namespace device { SerialServiceImpl::SerialServiceImpl( scoped_refptr<SerialConnectionFactory> connection_factory, mojo::InterfaceRequest<serial::SerialService> request) - : connection_factory_(connection_factory), binding_(this, request.Pass()) { -} + : connection_factory_(connection_factory), + binding_(this, std::move(request)) {} SerialServiceImpl::SerialServiceImpl( scoped_refptr<SerialConnectionFactory> connection_factory, scoped_ptr<SerialDeviceEnumerator> device_enumerator, mojo::InterfaceRequest<serial::SerialService> request) - : device_enumerator_(device_enumerator.Pass()), + : device_enumerator_(std::move(device_enumerator)), connection_factory_(connection_factory), - binding_(this, request.Pass()) { -} + binding_(this, std::move(request)) {} SerialServiceImpl::~SerialServiceImpl() { } @@ -40,7 +40,7 @@ void SerialServiceImpl::Create( base::Bind(SerialIoHandler::Create, base::ThreadTaskRunnerHandle::Get(), ui_task_runner), io_task_runner), - request.Pass()); + std::move(request)); } // static @@ -68,9 +68,9 @@ void SerialServiceImpl::Connect( mojo::InterfacePtr<serial::DataSourceClient> source_client) { if (!IsValidPath(path)) return; - connection_factory_->CreateConnection(path, options.Pass(), - connection_request.Pass(), sink.Pass(), - source.Pass(), source_client.Pass()); + connection_factory_->CreateConnection( + path, std::move(options), std::move(connection_request), std::move(sink), + std::move(source), std::move(source_client)); } SerialDeviceEnumerator* SerialServiceImpl::GetDeviceEnumerator() { diff --git a/device/serial/serial_service_unittest.cc b/device/serial/serial_service_unittest.cc index e0105a0..2b0468c 100644 --- a/device/serial/serial_service_unittest.cc +++ b/device/serial/serial_service_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/bind.h" #include "base/macros.h" #include "base/message_loop/message_loop.h" @@ -21,7 +23,7 @@ class FakeSerialDeviceEnumerator : public SerialDeviceEnumerator { mojo::Array<serial::DeviceInfoPtr> devices(1); devices[0] = serial::DeviceInfo::New(); devices[0]->path = "device"; - return devices.Pass(); + return devices; } }; @@ -44,7 +46,7 @@ class SerialServiceTest : public testing::Test { SerialServiceTest() : connected_(false), expecting_error_(false) {} void StoreDevices(mojo::Array<serial::DeviceInfoPtr> devices) { - devices_ = devices.Pass(); + devices_ = std::move(devices); StopMessageLoop(); } @@ -88,7 +90,7 @@ class SerialServiceTest : public testing::Test { mojo::GetProxy(&source_client); service->Connect(path, serial::ConnectionOptions::New(), mojo::GetProxy(&connection), mojo::GetProxy(&sink), - mojo::GetProxy(&source), source_client.Pass()); + mojo::GetProxy(&source), std::move(source_client)); connection.set_connection_error_handler(base::Bind( &SerialServiceTest::OnConnectionError, base::Unretained(this))); expecting_error_ = !expecting_success; diff --git a/device/serial/test_serial_io_handler.cc b/device/serial/test_serial_io_handler.cc index dec8184..b112462 100644 --- a/device/serial/test_serial_io_handler.cc +++ b/device/serial/test_serial_io_handler.cc @@ -81,13 +81,13 @@ bool TestSerialIoHandler::ConfigurePortImpl() { serial::DeviceControlSignalsPtr TestSerialIoHandler::GetControlSignals() const { serial::DeviceControlSignalsPtr signals(serial::DeviceControlSignals::New()); *signals = device_control_signals_; - return signals.Pass(); + return signals; } serial::ConnectionInfoPtr TestSerialIoHandler::GetPortInfo() const { serial::ConnectionInfoPtr info(serial::ConnectionInfo::New()); *info = info_; - return info.Pass(); + return info; } bool TestSerialIoHandler::Flush() const { diff --git a/device/test/usb_test_gadget_impl.cc b/device/test/usb_test_gadget_impl.cc index be3b795..1515a4e 100644 --- a/device/test/usb_test_gadget_impl.cc +++ b/device/test/usb_test_gadget_impl.cc @@ -150,7 +150,7 @@ class URLRequestContextGetter : public net::URLRequestContextGetter { if (!context_) { net::URLRequestContextBuilder context_builder; context_builder.set_proxy_service(net::ProxyService::CreateDirect()); - context_ = context_builder.Build().Pass(); + context_ = context_builder.Build(); } return context_.get(); } @@ -522,7 +522,7 @@ bool UsbTestGadget::IsTestEnabled() { scoped_ptr<UsbTestGadget> UsbTestGadget::Claim( scoped_refptr<base::SingleThreadTaskRunner> io_task_runner) { UsbGadgetFactory gadget_factory(io_task_runner); - return gadget_factory.WaitForDevice().Pass(); + return gadget_factory.WaitForDevice(); } UsbTestGadgetImpl::UsbTestGadgetImpl( diff --git a/device/usb/usb_device_filter.cc b/device/usb/usb_device_filter.cc index 777d9fd..b8d47fa 100644 --- a/device/usb/usb_device_filter.cc +++ b/device/usb/usb_device_filter.cc @@ -4,6 +4,8 @@ #include "device/usb/usb_device_filter.h" +#include <utility> + #include "base/values.h" #include "device/usb/usb_descriptors.h" #include "device/usb/usb_device.h" @@ -106,7 +108,7 @@ scoped_ptr<base::Value> UsbDeviceFilter::ToValue() const { } } - return obj.Pass(); + return std::move(obj); } // static diff --git a/device/usb/usb_device_handle_impl.cc b/device/usb/usb_device_handle_impl.cc index 16401fe..5bbbffe 100644 --- a/device/usb/usb_device_handle_impl.cc +++ b/device/usb/usb_device_handle_impl.cc @@ -5,6 +5,7 @@ #include "device/usb/usb_device_handle_impl.h" #include <algorithm> +#include <utility> #include <vector> #include "base/bind.h" @@ -264,7 +265,7 @@ UsbDeviceHandleImpl::Transfer::CreateControlTransfer( &UsbDeviceHandleImpl::Transfer::PlatformCallback, transfer.get(), timeout); - return transfer.Pass(); + return transfer; } // static @@ -293,7 +294,7 @@ UsbDeviceHandleImpl::Transfer::CreateBulkTransfer( &UsbDeviceHandleImpl::Transfer::PlatformCallback, transfer.get(), timeout); - return transfer.Pass(); + return transfer; } // static @@ -322,7 +323,7 @@ UsbDeviceHandleImpl::Transfer::CreateInterruptTransfer( &UsbDeviceHandleImpl::Transfer::PlatformCallback, transfer.get(), timeout); - return transfer.Pass(); + return transfer; } // static @@ -357,7 +358,7 @@ UsbDeviceHandleImpl::Transfer::CreateIsochronousTransfer( packets, &Transfer::PlatformCallback, transfer.get(), timeout); libusb_set_iso_packet_lengths(transfer->platform_transfer_, packet_length); - return transfer.Pass(); + return transfer; } UsbDeviceHandleImpl::Transfer::Transfer( @@ -881,7 +882,7 @@ void UsbDeviceHandleImpl::ControlTransferInternal( return; } - SubmitTransfer(transfer.Pass()); + SubmitTransfer(std::move(transfer)); } void UsbDeviceHandleImpl::IsochronousTransferInternal( @@ -912,7 +913,7 @@ void UsbDeviceHandleImpl::IsochronousTransferInternal( this, endpoint_address, buffer, static_cast<int>(length), packets, packet_length, timeout, callback_task_runner, callback); - SubmitTransfer(transfer.Pass()); + SubmitTransfer(std::move(transfer)); } void UsbDeviceHandleImpl::GenericTransferInternal( @@ -965,7 +966,7 @@ void UsbDeviceHandleImpl::GenericTransferInternal( return; } - SubmitTransfer(transfer.Pass()); + SubmitTransfer(std::move(transfer)); } void UsbDeviceHandleImpl::SubmitTransfer(scoped_ptr<Transfer> transfer) { diff --git a/device/usb/usb_device_impl.h b/device/usb/usb_device_impl.h index fed3db8..337c0e8 100644 --- a/device/usb/usb_device_impl.h +++ b/device/usb/usb_device_impl.h @@ -6,7 +6,7 @@ #define DEVICE_USB_USB_DEVICE_IMPL_H_ #include <stdint.h> - +#include <utility> #include <vector> #include "base/callback.h" @@ -61,7 +61,7 @@ class UsbDeviceImpl : public UsbDevice { } void set_device_path(const std::string& value) { device_path_ = value; } void set_webusb_allowed_origins(scoped_ptr<WebUsbDescriptorSet> descriptors) { - webusb_allowed_origins_ = descriptors.Pass(); + webusb_allowed_origins_ = std::move(descriptors); } void set_webusb_landing_page(const GURL& url) { webusb_landing_page_ = url; } diff --git a/device/usb/usb_service_impl.cc b/device/usb/usb_service_impl.cc index 1f6ca57..b169d83 100644 --- a/device/usb/usb_service_impl.cc +++ b/device/usb/usb_service_impl.cc @@ -5,9 +5,9 @@ #include "device/usb/usb_service_impl.h" #include <stdint.h> - #include <list> #include <set> +#include <utility> #include "base/barrier_closure.h" #include "base/bind.h" @@ -197,7 +197,7 @@ void OnReadWebUsbAllowedOrigins(scoped_refptr<UsbDevice> device, if (descriptors->Parse( std::vector<uint8_t>(buffer->data(), buffer->data() + length))) { UsbDeviceImpl* device_impl = static_cast<UsbDeviceImpl*>(device.get()); - device_impl->set_webusb_allowed_origins(descriptors.Pass()); + device_impl->set_webusb_allowed_origins(std::move(descriptors)); } callback.Run(); } diff --git a/device/vibration/vibration_manager_impl_default.cc b/device/vibration/vibration_manager_impl_default.cc index 25dba50c..02c5a01 100644 --- a/device/vibration/vibration_manager_impl_default.cc +++ b/device/vibration/vibration_manager_impl_default.cc @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "device/vibration/vibration_manager_impl.h" - #include <stdint.h> +#include <utility> +#include "device/vibration/vibration_manager_impl.h" #include "mojo/public/cpp/bindings/strong_binding.h" namespace device { @@ -22,7 +22,7 @@ class VibrationManagerEmptyImpl : public VibrationManager { explicit VibrationManagerEmptyImpl( mojo::InterfaceRequest<VibrationManager> request) - : binding_(this, request.Pass()) {} + : binding_(this, std::move(request)) {} ~VibrationManagerEmptyImpl() override {} // The binding between this object and the other end of the pipe. @@ -34,7 +34,7 @@ class VibrationManagerEmptyImpl : public VibrationManager { // static void VibrationManagerImpl::Create( mojo::InterfaceRequest<VibrationManager> request) { - new VibrationManagerEmptyImpl(request.Pass()); + new VibrationManagerEmptyImpl(std::move(request)); } } // namespace device |