Commit dc5f1240 authored by dcheng's avatar dcheng Committed by Commit bot

Convert Pass()→std::move() in //components (CrOS edition)

(╯^□^)╯︵ 

BUG=557422
R=avi@chromium.org
TBR=caitkp@chromium.org

Review URL: https://codereview.chromium.org/1552023002

Cr-Commit-Position: refs/heads/master@{#367228}
parent 902fcc5c
......@@ -127,7 +127,7 @@ class ChangeListLoaderTest : public testing::Test {
google_apis::test_util::CreateCopyResultCallback(&error, &entry));
base::RunLoop().RunUntilIdle();
EXPECT_EQ(google_apis::HTTP_CREATED, error);
return entry.Pass();
return entry;
}
content::TestBrowserThreadBundle thread_bundle_;
......
......@@ -6,6 +6,7 @@
#include <stddef.h>
#include <stdint.h>
#include <utility>
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
......@@ -98,7 +99,7 @@ ScopedVector<ChangeList> CreateBaseChangeList() {
change_lists[0]->mutable_parent_resource_ids()->push_back("");
change_lists[0]->set_largest_changestamp(kBaseResourceListChangestamp);
return change_lists.Pass();
return change_lists;
}
class ChangeListProcessorTest : public testing::Test {
......@@ -132,8 +133,7 @@ class ChangeListProcessorTest : public testing::Test {
about_resource->set_root_folder_id(kRootId);
ChangeListProcessor processor(metadata_.get(), nullptr);
return processor.Apply(about_resource.Pass(),
changes.Pass(),
return processor.Apply(std::move(about_resource), std::move(changes),
false /* is_delta_update */);
}
......@@ -147,9 +147,9 @@ class ChangeListProcessorTest : public testing::Test {
about_resource->set_root_folder_id(kRootId);
ChangeListProcessor processor(metadata_.get(), nullptr);
FileError error = processor.Apply(about_resource.Pass(),
changes.Pass(),
true /* is_delta_update */);
FileError error =
processor.Apply(std::move(about_resource), std::move(changes),
true /* is_delta_update */);
*changed_files = processor.changed_files();
return error;
}
......@@ -162,7 +162,7 @@ class ChangeListProcessorTest : public testing::Test {
base::FilePath::FromUTF8Unsafe(path), entry.get());
if (error != FILE_ERROR_OK)
entry.reset();
return entry.Pass();
return entry;
}
content::TestBrowserThreadBundle thread_bundle_;
......@@ -246,7 +246,7 @@ TEST_F(ChangeListProcessorTest, DeltaFileAddedInNewDirectory) {
FileChange changed_files;
EXPECT_EQ(FILE_ERROR_OK,
ApplyChangeList(change_lists.Pass(), &changed_files));
ApplyChangeList(std::move(change_lists), &changed_files));
int64_t changestamp = 0;
EXPECT_EQ(FILE_ERROR_OK, metadata_->GetLargestChangestamp(&changestamp));
......@@ -281,7 +281,7 @@ TEST_F(ChangeListProcessorTest, DeltaDirMovedFromRootToDirectory) {
FileChange changed_files;
EXPECT_EQ(FILE_ERROR_OK,
ApplyChangeList(change_lists.Pass(), &changed_files));
ApplyChangeList(std::move(change_lists), &changed_files));
int64_t changestamp = 0;
EXPECT_EQ(FILE_ERROR_OK, metadata_->GetLargestChangestamp(&changestamp));
......@@ -317,7 +317,7 @@ TEST_F(ChangeListProcessorTest, DeltaFileMovedFromDirectoryToRoot) {
EXPECT_EQ(FILE_ERROR_OK, ApplyFullResourceList(CreateBaseChangeList()));
FileChange changed_files;
EXPECT_EQ(FILE_ERROR_OK,
ApplyChangeList(change_lists.Pass(), &changed_files));
ApplyChangeList(std::move(change_lists), &changed_files));
int64_t changestamp = 0;
EXPECT_EQ(FILE_ERROR_OK, metadata_->GetLargestChangestamp(&changestamp));
......@@ -350,7 +350,7 @@ TEST_F(ChangeListProcessorTest, DeltaFileRenamedInDirectory) {
EXPECT_EQ(FILE_ERROR_OK, ApplyFullResourceList(CreateBaseChangeList()));
FileChange changed_files;
EXPECT_EQ(FILE_ERROR_OK,
ApplyChangeList(change_lists.Pass(), &changed_files));
ApplyChangeList(std::move(change_lists), &changed_files));
EXPECT_EQ(2U, changed_files.size());
EXPECT_TRUE(changed_files.count(base::FilePath::FromUTF8Unsafe(
"drive/root/Directory 1/SubDirectory File 1.txt")));
......@@ -389,7 +389,7 @@ TEST_F(ChangeListProcessorTest, DeltaAddAndDeleteFileInRoot) {
EXPECT_EQ(FILE_ERROR_OK, ApplyFullResourceList(CreateBaseChangeList()));
FileChange changed_files;
EXPECT_EQ(FILE_ERROR_OK,
ApplyChangeList(change_lists.Pass(), &changed_files));
ApplyChangeList(std::move(change_lists), &changed_files));
int64_t changestamp = 0;
EXPECT_EQ(FILE_ERROR_OK, metadata_->GetLargestChangestamp(&changestamp));
......@@ -410,7 +410,7 @@ TEST_F(ChangeListProcessorTest, DeltaAddAndDeleteFileInRoot) {
// Apply.
EXPECT_EQ(FILE_ERROR_OK,
ApplyChangeList(change_lists.Pass(), &changed_files));
ApplyChangeList(std::move(change_lists), &changed_files));
EXPECT_EQ(FILE_ERROR_OK, metadata_->GetLargestChangestamp(&changestamp));
EXPECT_EQ(16687, changestamp);
EXPECT_FALSE(GetResourceEntry("drive/root/Added file.txt"));
......@@ -438,7 +438,7 @@ TEST_F(ChangeListProcessorTest, DeltaAddAndDeleteFileFromExistingDirectory) {
EXPECT_EQ(FILE_ERROR_OK, ApplyFullResourceList(CreateBaseChangeList()));
FileChange changed_files;
EXPECT_EQ(FILE_ERROR_OK,
ApplyChangeList(change_lists.Pass(), &changed_files));
ApplyChangeList(std::move(change_lists), &changed_files));
int64_t changestamp = 0;
EXPECT_EQ(FILE_ERROR_OK, metadata_->GetLargestChangestamp(&changestamp));
EXPECT_EQ(16730, changestamp);
......@@ -460,7 +460,7 @@ TEST_F(ChangeListProcessorTest, DeltaAddAndDeleteFileFromExistingDirectory) {
// Apply.
EXPECT_EQ(FILE_ERROR_OK,
ApplyChangeList(change_lists.Pass(), &changed_files));
ApplyChangeList(std::move(change_lists), &changed_files));
EXPECT_EQ(FILE_ERROR_OK, metadata_->GetLargestChangestamp(&changestamp));
EXPECT_EQ(16770, changestamp);
EXPECT_FALSE(GetResourceEntry("drive/root/Directory 1/Added file.txt"));
......@@ -500,7 +500,7 @@ TEST_F(ChangeListProcessorTest, DeltaAddFileToNewButDeletedDirectory) {
EXPECT_EQ(FILE_ERROR_OK, ApplyFullResourceList(CreateBaseChangeList()));
FileChange changed_files;
EXPECT_EQ(FILE_ERROR_OK,
ApplyChangeList(change_lists.Pass(), &changed_files));
ApplyChangeList(std::move(change_lists), &changed_files));
int64_t changestamp = 0;
EXPECT_EQ(FILE_ERROR_OK, metadata_->GetLargestChangestamp(&changestamp));
......@@ -538,11 +538,11 @@ TEST_F(ChangeListProcessorTest, RefreshDirectory) {
util::GetDriveMyDriveRootPath(), &root));
const int64_t kNewChangestamp = 12345;
ResourceEntryVector refreshed_entries;
EXPECT_EQ(FILE_ERROR_OK, ChangeListProcessor::RefreshDirectory(
metadata_.get(),
DirectoryFetchInfo(root.local_id(), kRootId, kNewChangestamp),
change_list.Pass(),
&refreshed_entries));
EXPECT_EQ(FILE_ERROR_OK,
ChangeListProcessor::RefreshDirectory(
metadata_.get(),
DirectoryFetchInfo(root.local_id(), kRootId, kNewChangestamp),
std::move(change_list), &refreshed_entries));
// "new_file" should be added.
ResourceEntry entry;
......@@ -575,11 +575,11 @@ TEST_F(ChangeListProcessorTest, RefreshDirectory_WrongParentId) {
util::GetDriveMyDriveRootPath(), &root));
const int64_t kNewChangestamp = 12345;
ResourceEntryVector refreshed_entries;
EXPECT_EQ(FILE_ERROR_OK, ChangeListProcessor::RefreshDirectory(
metadata_.get(),
DirectoryFetchInfo(root.local_id(), kRootId, kNewChangestamp),
change_list.Pass(),
&refreshed_entries));
EXPECT_EQ(FILE_ERROR_OK,
ChangeListProcessor::RefreshDirectory(
metadata_.get(),
DirectoryFetchInfo(root.local_id(), kRootId, kNewChangestamp),
std::move(change_list), &refreshed_entries));
// "new_file" should not be added.
ResourceEntry entry;
......@@ -605,7 +605,7 @@ TEST_F(ChangeListProcessorTest, SharedFilesWithNoParentInFeed) {
FileChange changed_files;
EXPECT_EQ(FILE_ERROR_OK,
ApplyChangeList(change_lists.Pass(), &changed_files));
ApplyChangeList(std::move(change_lists), &changed_files));
// "new_file" should be added under drive/other.
ResourceEntry entry;
......@@ -650,7 +650,7 @@ TEST_F(ChangeListProcessorTest, ModificationDate) {
// Apply the change.
FileChange changed_files;
EXPECT_EQ(FILE_ERROR_OK,
ApplyChangeList(change_lists.Pass(), &changed_files));
ApplyChangeList(std::move(change_lists), &changed_files));
// The change is rejected due to the old modification date.
ResourceEntry entry;
......
......@@ -122,7 +122,7 @@ class DirectoryLoaderTest : public testing::Test {
google_apis::test_util::CreateCopyResultCallback(&error, &entry));
base::RunLoop().RunUntilIdle();
EXPECT_EQ(google_apis::HTTP_CREATED, error);
return entry.Pass();
return entry;
}
content::TestBrowserThreadBundle thread_bundle_;
......
......@@ -178,7 +178,7 @@ class FileSystemTest : public testing::Test {
google_apis::test_util::CreateCopyResultCallback(&error, &entry));
content::RunAllBlockingPoolTasksUntilIdle();
return entry.Pass();
return entry;
}
// Gets directory info by path synchronously.
......@@ -193,7 +193,7 @@ class FileSystemTest : public testing::Test {
content::RunAllBlockingPoolTasksUntilIdle();
if (error != FILE_ERROR_OK)
entries.reset();
return entries.Pass();
return entries;
}
// Used to implement ReadDirectorySync().
......
......@@ -480,7 +480,7 @@ void GCMDriverDesktop::IOWorker::WakeFromSuspendForHeartbeat(bool wake) {
else
timer.reset(new base::Timer(true, false));
gcm_client_->UpdateHeartbeatTimer(timer.Pass());
gcm_client_->UpdateHeartbeatTimer(std::move(timer));
#endif
}
......
......@@ -4,6 +4,8 @@
#include "components/ownership/owner_key_util.h"
#include <utility>
namespace ownership {
///////////////////////////////////////////////////////////////////////////
......@@ -18,8 +20,8 @@ PublicKey::~PublicKey() {
///////////////////////////////////////////////////////////////////////////
// PrivateKey
PrivateKey::PrivateKey(crypto::ScopedSECKEYPrivateKey key) : key_(key.Pass()) {
}
PrivateKey::PrivateKey(crypto::ScopedSECKEYPrivateKey key)
: key_(std::move(key)) {}
PrivateKey::~PrivateKey() {
}
......
......@@ -63,7 +63,7 @@ crypto::ScopedSECKEYPrivateKey OwnerKeyUtilImpl::FindPrivateKeyInSlot(
crypto::FindNSSKeyFromPublicKeyInfoInSlot(key, slot));
if (!private_key || SECKEY_GetPrivateKeyType(private_key.get()) != rsaKey)
return nullptr;
return private_key.Pass();
return private_key;
}
bool OwnerKeyUtilImpl::IsPublicKeyPresent() {
......
......@@ -37,7 +37,7 @@ scoped_ptr<em::PolicyFetchResponse> AssembleAndSignPolicy(
new em::PolicyFetchResponse());
if (!policy->SerializeToString(policy_response->mutable_policy_data())) {
LOG(ERROR) << "Failed to encode policy payload.";
return scoped_ptr<em::PolicyFetchResponse>(nullptr).Pass();
return scoped_ptr<em::PolicyFetchResponse>(nullptr);
}
ScopedSGNContext sign_context(
......@@ -62,7 +62,7 @@ scoped_ptr<em::PolicyFetchResponse> AssembleAndSignPolicy(
reinterpret_cast<const char*>(signature_item.data), signature_item.len);
SECITEM_FreeItem(&signature_item, PR_FALSE);
return policy_response.Pass();
return policy_response;
}
} // namepace
......
......@@ -4,6 +4,8 @@
#include "components/pairing/bluetooth_controller_pairing_controller.h"
#include <utility>
#include "base/bind.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
......@@ -132,7 +134,7 @@ void BluetoothControllerPairingController::OnGetAdapter(
void BluetoothControllerPairingController::OnStartDiscoverySession(
scoped_ptr<device::BluetoothDiscoverySession> discovery_session) {
DCHECK(thread_checker_.CalledOnValidThread());
discovery_session_ = discovery_session.Pass();
discovery_session_ = std::move(discovery_session);
ChangeStage(STAGE_DEVICES_DISCOVERY);
for (const auto& device : adapter_->GetDevices())
......
......@@ -4,6 +4,8 @@
#include "components/pairing/shark_connection_listener.h"
#include <utility>
#include "base/logging.h"
#include "base/threading/thread_restrictions.h"
#include "components/pairing/bluetooth_host_pairing_controller.h"
......@@ -25,7 +27,7 @@ SharkConnectionListener::~SharkConnectionListener() {
void SharkConnectionListener::PairingStageChanged(Stage new_stage) {
if (new_stage == HostPairingController::STAGE_WAITING_FOR_CODE_CONFIRMATION) {
controller_->RemoveObserver(this);
callback_.Run(controller_.Pass());
callback_.Run(std::move(controller_));
callback_.Reset();
}
}
......
......@@ -4,6 +4,8 @@
#include "components/policy/core/common/proxy_policy_provider.h"
#include <utility>
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "components/policy/core/common/policy_bundle.h"
......@@ -48,7 +50,7 @@ void ProxyPolicyProvider::RefreshPolicies() {
// if SetDelegate() was never called before.
scoped_ptr<PolicyBundle> bundle(new PolicyBundle());
bundle->CopyFrom(policies());
UpdatePolicy(bundle.Pass());
UpdatePolicy(std::move(bundle));
}
}
......@@ -57,7 +59,7 @@ void ProxyPolicyProvider::OnUpdatePolicy(
DCHECK_EQ(delegate_, provider);
scoped_ptr<PolicyBundle> bundle(new PolicyBundle());
bundle->CopyFrom(delegate_->policies());
UpdatePolicy(bundle.Pass());
UpdatePolicy(std::move(bundle));
}
} // namespace policy
......@@ -38,7 +38,7 @@ class ProxyPolicyProviderTest : public testing::Test {
static scoped_ptr<PolicyBundle> CopyBundle(const PolicyBundle& bundle) {
scoped_ptr<PolicyBundle> copy(new PolicyBundle());
copy->CopyFrom(bundle);
return copy.Pass();
return copy;
}
private:
......
......@@ -9,6 +9,7 @@
#include "components/rlz/rlz_tracker.h"
#include <algorithm>
#include <utility>
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
......@@ -177,14 +178,14 @@ void RLZTracker::SetRlzDelegate(scoped_ptr<RLZTrackerDelegate> delegate) {
// RLZTracker::SetRlzDelegate is called at Profile creation time which can
// happens multiple time on ChromeOS, so do nothing if the delegate already
// exists.
tracker->SetDelegate(delegate.Pass());
tracker->SetDelegate(std::move(delegate));
}
}
void RLZTracker::SetDelegate(scoped_ptr<RLZTrackerDelegate> delegate) {
DCHECK(delegate);
DCHECK(!delegate_);
delegate_ = delegate.Pass();
delegate_ = std::move(delegate);
worker_pool_token_ = delegate_->GetBlockingPool()->GetSequenceToken();
}
......
......@@ -5,6 +5,7 @@
#include "components/storage_monitor/storage_monitor_chromeos.h"
#include <stdint.h>
#include <utility>
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
......@@ -173,7 +174,7 @@ void StorageMonitorCrosTest::SetUp() {
TestStorageMonitor::Destroy();
monitor_ = new TestStorageMonitorCros();
scoped_ptr<StorageMonitor> pass_monitor(monitor_);
StorageMonitor::SetStorageMonitorForTesting(pass_monitor.Pass());
StorageMonitor::SetStorageMonitorForTesting(std::move(pass_monitor));
monitor_->Init();
monitor_->AddObserver(mock_storage_observer_.get());
......
......@@ -6,6 +6,7 @@
#include <stdint.h>
#include <sys/timerfd.h>
#include <utility>
#include "base/bind.h"
#include "base/bind_helpers.h"
......@@ -425,7 +426,7 @@ void AlarmTimer::OnTimerFired() {
// Take ownership of the pending user task, which is going to be cleared by
// the Stop() or Reset() functions below.
scoped_ptr<base::PendingTask> pending_user_task(pending_task_.Pass());
scoped_ptr<base::PendingTask> pending_user_task(std::move(pending_task_));
// Re-schedule or stop the timer as requested.
if (base::Timer::is_repeating())
......
......@@ -5,8 +5,8 @@
#include "components/user_manager/user_manager_base.h"
#include <stddef.h>
#include <set>
#include <utility>
#include "base/bind.h"
#include "base/bind_helpers.h"
......@@ -1092,7 +1092,7 @@ void UserManagerBase::UpdateUserAccountLocale(const AccountId& account_id,
base::Passed(&resolved_locale)));
} else {
resolved_locale.reset(new std::string(locale));
DoUpdateAccountLocale(account_id, resolved_locale.Pass());
DoUpdateAccountLocale(account_id, std::move(resolved_locale));
}
}
......
......@@ -5,6 +5,7 @@
#include "components/wifi_sync/wifi_credential_syncable_service.h"
#include <stdint.h>
#include <utility>
#include <vector>
#include "base/logging.h"
......@@ -107,7 +108,7 @@ const syncer::ModelType WifiCredentialSyncableService::kModelType =
WifiCredentialSyncableService::WifiCredentialSyncableService(
scoped_ptr<WifiConfigDelegate> network_config_delegate)
: network_config_delegate_(network_config_delegate.Pass()) {
: network_config_delegate_(std::move(network_config_delegate)) {
DCHECK(network_config_delegate_);
}
......@@ -123,7 +124,7 @@ syncer::SyncMergeResult WifiCredentialSyncableService::MergeDataAndStartSyncing(
DCHECK(sync_processor.get());
DCHECK_EQ(kModelType, type);
sync_processor_ = sync_processor.Pass();
sync_processor_ = std::move(sync_processor);
// TODO(quiche): Update local WiFi configuration from |initial_sync_data|.
// TODO(quiche): Notify upper layers that sync is ready.
......
......@@ -5,8 +5,8 @@
#include "components/wifi_sync/wifi_credential_syncable_service.h"
#include <stdint.h>
#include <string>
#include <utility>
#include <vector>
#include "base/macros.h"
......@@ -144,7 +144,8 @@ class WifiCredentialSyncableServiceTest : public testing::Test {
change_processor_ = change_processor.get();
syncable_service_->MergeDataAndStartSyncing(
syncer::WIFI_CREDENTIALS, syncer::SyncDataList(),
change_processor.Pass(), make_scoped_ptr(new SyncErrorFactoryMock()));
std::move(change_processor),
make_scoped_ptr(new SyncErrorFactoryMock()));
}
private:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment