Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(646)

Unified Diff: sync/internal_api/model_type_store_impl.cc

Issue 1539843002: Convert Pass()→std::move() in sync/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sync/internal_api/model_type_store_impl.cc
diff --git a/sync/internal_api/model_type_store_impl.cc b/sync/internal_api/model_type_store_impl.cc
index fa5a6b780ba08fc1e5714ec639d7f5758e7d31c4..4505f107af362a2a3aa4b6712f0e3fcd3cc14cdc 100644
--- a/sync/internal_api/model_type_store_impl.cc
+++ b/sync/internal_api/model_type_store_impl.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "sync/internal_api/public/model_type_store_impl.h"
+#include <utility>
#include "base/bind.h"
#include "base/location.h"
@@ -11,6 +11,7 @@
#include "base/task_runner_util.h"
#include "base/thread_task_runner_handle.h"
#include "sync/internal_api/public/model_type_store_backend.h"
+#include "sync/internal_api/public/model_type_store_impl.h"
Nicolas Zea 2015/12/18 23:46:55 keep up top
#include "third_party/leveldatabase/src/include/leveldb/env.h"
#include "third_party/leveldatabase/src/include/leveldb/write_batch.h"
@@ -50,7 +51,7 @@ leveldb::WriteBatch* ModelTypeStoreImpl::GetLeveldbWriteBatch(
ModelTypeStoreImpl::ModelTypeStoreImpl(
scoped_ptr<ModelTypeStoreBackend> backend,
scoped_refptr<base::SequencedTaskRunner> backend_task_runner)
- : backend_(backend.Pass()),
+ : backend_(std::move(backend)),
backend_task_runner_(backend_task_runner),
weak_ptr_factory_(this) {
DCHECK(backend_);
@@ -73,7 +74,7 @@ void ModelTypeStoreImpl::CreateStore(
scoped_ptr<ModelTypeStoreBackend> backend(new ModelTypeStoreBackend());
scoped_ptr<ModelTypeStoreImpl> store(
- new ModelTypeStoreImpl(backend.Pass(), blocking_task_runner));
+ new ModelTypeStoreImpl(std::move(backend), blocking_task_runner));
auto task =
base::Bind(&ModelTypeStoreBackend::Init,
@@ -97,13 +98,13 @@ void ModelTypeStoreImpl::CreateInMemoryStoreForTest(
leveldb::Env* env_ptr = env.get();
scoped_ptr<ModelTypeStoreBackend> backend(new ModelTypeStoreBackend());
- backend->TakeEnvOwnership(env.Pass());
+ backend->TakeEnvOwnership(std::move(env));
// In-memory store backend works on the same thread as test.
scoped_refptr<base::SequencedTaskRunner> task_runner =
base::ThreadTaskRunnerHandle::Get();
scoped_ptr<ModelTypeStoreImpl> store(
- new ModelTypeStoreImpl(backend.Pass(), task_runner));
+ new ModelTypeStoreImpl(std::move(backend), task_runner));
std::string path;
env_ptr->GetTestDirectory(&path);
@@ -126,7 +127,7 @@ void ModelTypeStoreImpl::BackendInitDone(const InitCallback& callback,
if (result != Result::SUCCESS) {
store.reset();
}
- callback.Run(result, store.Pass());
+ callback.Run(result, std::move(store));
}
// Note on pattern for communicating with backend:
@@ -163,7 +164,7 @@ void ModelTypeStoreImpl::ReadDataDone(const ReadDataCallback& callback,
scoped_ptr<IdList> missing_id_list,
Result result) {
DCHECK(CalledOnValidThread());
- callback.Run(result, record_list.Pass(), missing_id_list.Pass());
+ callback.Run(result, std::move(record_list), std::move(missing_id_list));
}
void ModelTypeStoreImpl::ReadAllData(const ReadAllDataCallback& callback) {
@@ -184,7 +185,7 @@ void ModelTypeStoreImpl::ReadAllDataDone(const ReadAllDataCallback& callback,
scoped_ptr<RecordList> record_list,
Result result) {
DCHECK(CalledOnValidThread());
- callback.Run(result, record_list.Pass());
+ callback.Run(result, std::move(record_list));
}
void ModelTypeStoreImpl::ReadAllMetadata(const ReadMetadataCallback& callback) {
@@ -212,7 +213,7 @@ void ModelTypeStoreImpl::ReadMetadataRecordsDone(
Result result) {
DCHECK(CalledOnValidThread());
if (result != Result::SUCCESS) {
- callback.Run(result, metadata_records.Pass(), std::string());
+ callback.Run(result, std::move(metadata_records), std::string());
return;
}
@@ -241,7 +242,7 @@ void ModelTypeStoreImpl::ReadAllMetadataDone(
Result result) {
DCHECK(CalledOnValidThread());
if (result != Result::SUCCESS) {
- callback.Run(result, metadata_records.Pass(), std::string());
+ callback.Run(result, std::move(metadata_records), std::string());
return;
}
@@ -250,12 +251,12 @@ void ModelTypeStoreImpl::ReadAllMetadataDone(
// string in this case.
DCHECK((*missing_id_list)[0] == kGlobalMetadataKey);
DCHECK(global_metadata_records->empty());
- callback.Run(Result::SUCCESS, metadata_records.Pass(), std::string());
+ callback.Run(Result::SUCCESS, std::move(metadata_records), std::string());
return;
}
DCHECK(!global_metadata_records->empty());
DCHECK((*global_metadata_records)[0].id == kGlobalMetadataKey);
- callback.Run(Result::SUCCESS, metadata_records.Pass(),
+ callback.Run(Result::SUCCESS, std::move(metadata_records),
(*global_metadata_records)[0].value);
}

Powered by Google App Engine
This is Rietveld 408576698