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

Unified Diff: sync/internal_api/attachments/on_disk_attachment_store.cc

Issue 1866243002: Convert //sync 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
Index: sync/internal_api/attachments/on_disk_attachment_store.cc
diff --git a/sync/internal_api/attachments/on_disk_attachment_store.cc b/sync/internal_api/attachments/on_disk_attachment_store.cc
index ebdc3f82a7186f8b281d050303897bfd6878736a..0778a7c5312a469d09c4234376a04d96b56fef3b 100644
--- a/sync/internal_api/attachments/on_disk_attachment_store.cc
+++ b/sync/internal_api/attachments/on_disk_attachment_store.cc
@@ -5,13 +5,14 @@
#include "sync/internal_api/public/attachments/on_disk_attachment_store.h"
#include <stdint.h>
+
+#include <memory>
#include <string>
#include <utility>
#include "base/bind.h"
#include "base/callback.h"
#include "base/location.h"
-#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram.h"
#include "base/sequenced_task_runner.h"
#include "sync/internal_api/attachments/proto/attachment_store.pb.h"
@@ -172,8 +173,9 @@ void OnDiskAttachmentStore::Read(
const AttachmentIdList& ids,
const AttachmentStore::ReadCallback& callback) {
DCHECK(CalledOnValidThread());
- scoped_ptr<AttachmentMap> result_map(new AttachmentMap());
- scoped_ptr<AttachmentIdList> unavailable_attachments(new AttachmentIdList());
+ std::unique_ptr<AttachmentMap> result_map(new AttachmentMap());
+ std::unique_ptr<AttachmentIdList> unavailable_attachments(
+ new AttachmentIdList());
AttachmentStore::Result result_code =
AttachmentStore::STORE_INITIALIZATION_FAILED;
@@ -181,7 +183,7 @@ void OnDiskAttachmentStore::Read(
if (db_) {
result_code = AttachmentStore::SUCCESS;
for (const auto& id : ids) {
- scoped_ptr<Attachment> attachment;
+ std::unique_ptr<Attachment> attachment;
attachment = ReadSingleAttachment(id, component);
if (attachment) {
result_map->insert(std::make_pair(id, *attachment));
@@ -283,7 +285,7 @@ void OnDiskAttachmentStore::ReadMetadataById(
DCHECK(CalledOnValidThread());
AttachmentStore::Result result_code =
AttachmentStore::STORE_INITIALIZATION_FAILED;
- scoped_ptr<AttachmentMetadataList> metadata_list(
+ std::unique_ptr<AttachmentMetadataList> metadata_list(
new AttachmentMetadataList());
if (db_) {
result_code = AttachmentStore::SUCCESS;
@@ -310,14 +312,14 @@ void OnDiskAttachmentStore::ReadMetadata(
DCHECK(CalledOnValidThread());
AttachmentStore::Result result_code =
AttachmentStore::STORE_INITIALIZATION_FAILED;
- scoped_ptr<AttachmentMetadataList> metadata_list(
+ std::unique_ptr<AttachmentMetadataList> metadata_list(
new AttachmentMetadataList());
if (db_) {
attachment_store_pb::RecordMetadata::Component proto_component =
ComponentToProto(component);
result_code = AttachmentStore::SUCCESS;
- scoped_ptr<leveldb::Iterator> db_iterator(
+ std::unique_ptr<leveldb::Iterator> db_iterator(
db_->NewIterator(MakeNonCachingReadOptions()));
DCHECK(db_iterator);
for (db_iterator->Seek(kMetadataPrefix); db_iterator->Valid();
@@ -359,7 +361,7 @@ AttachmentStore::Result OnDiskAttachmentStore::OpenOrCreate(
base::FilePath leveldb_path = path.Append(kLeveldbDirectory);
leveldb::DB* db_raw;
- scoped_ptr<leveldb::DB> db;
+ std::unique_ptr<leveldb::DB> db;
leveldb::Options options;
options.create_if_missing = true;
options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue;
@@ -403,10 +405,10 @@ AttachmentStore::Result OnDiskAttachmentStore::OpenOrCreate(
return AttachmentStore::SUCCESS;
}
-scoped_ptr<Attachment> OnDiskAttachmentStore::ReadSingleAttachment(
+std::unique_ptr<Attachment> OnDiskAttachmentStore::ReadSingleAttachment(
const AttachmentId& attachment_id,
AttachmentStore::Component component) {
- scoped_ptr<Attachment> attachment;
+ std::unique_ptr<Attachment> attachment;
attachment_store_pb::RecordMetadata record_metadata;
if (!ReadSingleRecordMetadata(attachment_id, &record_metadata)) {
return attachment;

Powered by Google App Engine
This is Rietveld 408576698