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

Unified Diff: components/leveldb_proto/proto_database_impl.h

Issue 1918083002: Convert //components/[f-n]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: … Created 4 years, 8 months 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
« no previous file with comments | « components/leveldb_proto/proto_database.h ('k') | components/leveldb_proto/proto_database_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/leveldb_proto/proto_database_impl.h
diff --git a/components/leveldb_proto/proto_database_impl.h b/components/leveldb_proto/proto_database_impl.h
index 6a1b9d2abc57afefd55ba36b04fc0dc400c76792..4de21e9d4ff805232cfd2b3f33ad0aaa66602c5a 100644
--- a/components/leveldb_proto/proto_database_impl.h
+++ b/components/leveldb_proto/proto_database_impl.h
@@ -5,6 +5,7 @@
#ifndef COMPONENTS_LEVELDB_PROTO_PROTO_DATABASE_IMPL_H_
#define COMPONENTS_LEVELDB_PROTO_PROTO_DATABASE_IMPL_H_
+#include <memory>
#include <string>
#include <utility>
#include <vector>
@@ -12,7 +13,7 @@
#include "base/bind.h"
#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "base/sequenced_task_runner.h"
#include "base/strings/string_split.h"
@@ -46,8 +47,9 @@ class ProtoDatabaseImpl : public ProtoDatabase<T> {
const base::FilePath& database_dir,
const typename ProtoDatabase<T>::InitCallback& callback) override;
void UpdateEntries(
- scoped_ptr<typename ProtoDatabase<T>::KeyEntryVector> entries_to_save,
- scoped_ptr<KeyVector> keys_to_remove,
+ std::unique_ptr<typename ProtoDatabase<T>::KeyEntryVector>
+ entries_to_save,
+ std::unique_ptr<KeyVector> keys_to_remove,
const typename ProtoDatabase<T>::UpdateCallback& callback) override;
void LoadEntries(
const typename ProtoDatabase<T>::LoadCallback& callback) override;
@@ -56,7 +58,7 @@ class ProtoDatabaseImpl : public ProtoDatabase<T> {
// Allow callers to provide their own Database implementation.
void InitWithDatabase(
- scoped_ptr<LevelDB> database,
+ std::unique_ptr<LevelDB> database,
const base::FilePath& database_dir,
const typename ProtoDatabase<T>::InitCallback& callback);
@@ -66,7 +68,7 @@ class ProtoDatabaseImpl : public ProtoDatabase<T> {
// Used to run blocking tasks in-order.
scoped_refptr<base::SequencedTaskRunner> task_runner_;
- scoped_ptr<LevelDB> db_;
+ std::unique_ptr<LevelDB> db_;
base::FilePath database_dir_;
DISALLOW_COPY_AND_ASSIGN(ProtoDatabaseImpl);
@@ -90,7 +92,7 @@ void RunUpdateCallback(
template <typename T>
void RunLoadCallback(const typename ProtoDatabase<T>::LoadCallback& callback,
const bool* success,
- scoped_ptr<std::vector<T>> entries) {
+ std::unique_ptr<std::vector<T>> entries) {
callback.Run(*success, std::move(entries));
}
@@ -120,8 +122,8 @@ inline void DestroyFromTaskRunner(const base::FilePath& database_dir,
template <typename T>
void UpdateEntriesFromTaskRunner(
LevelDB* database,
- scoped_ptr<typename ProtoDatabase<T>::KeyEntryVector> entries_to_save,
- scoped_ptr<KeyVector> keys_to_remove,
+ std::unique_ptr<typename ProtoDatabase<T>::KeyEntryVector> entries_to_save,
+ std::unique_ptr<KeyVector> keys_to_remove,
bool* success) {
DCHECK(success);
@@ -179,7 +181,7 @@ void ProtoDatabaseImpl<T>::Init(
const typename ProtoDatabase<T>::InitCallback& callback) {
DCHECK(thread_checker_.CalledOnValidThread());
database_dir_ = database_dir;
- InitWithDatabase(make_scoped_ptr(new LevelDB(client_name)), database_dir,
+ InitWithDatabase(base::WrapUnique(new LevelDB(client_name)), database_dir,
callback);
}
@@ -206,7 +208,7 @@ void ProtoDatabaseImpl<T>::Destroy(
template <typename T>
void ProtoDatabaseImpl<T>::InitWithDatabase(
- scoped_ptr<LevelDB> database,
+ std::unique_ptr<LevelDB> database,
const base::FilePath& database_dir,
const typename ProtoDatabase<T>::InitCallback& callback) {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -222,8 +224,8 @@ void ProtoDatabaseImpl<T>::InitWithDatabase(
template <typename T>
void ProtoDatabaseImpl<T>::UpdateEntries(
- scoped_ptr<typename ProtoDatabase<T>::KeyEntryVector> entries_to_save,
- scoped_ptr<KeyVector> keys_to_remove,
+ std::unique_ptr<typename ProtoDatabase<T>::KeyEntryVector> entries_to_save,
+ std::unique_ptr<KeyVector> keys_to_remove,
const typename ProtoDatabase<T>::UpdateCallback& callback) {
DCHECK(thread_checker_.CalledOnValidThread());
bool* success = new bool(false);
@@ -241,7 +243,7 @@ void ProtoDatabaseImpl<T>::LoadEntries(
DCHECK(thread_checker_.CalledOnValidThread());
bool* success = new bool(false);
- scoped_ptr<std::vector<T> > entries(new std::vector<T>());
+ std::unique_ptr<std::vector<T>> entries(new std::vector<T>());
// Get this pointer before entries is base::Passed() so we can use it below.
std::vector<T>* entries_ptr = entries.get();
« no previous file with comments | « components/leveldb_proto/proto_database.h ('k') | components/leveldb_proto/proto_database_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698