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

Side by Side Diff: components/sync/engine/attachments/on_disk_attachment_store.cc

Issue 2422253002: [Sync] Rewriting ".reset(new" pattern to use "= base::MakeUnique" instead. (Closed)
Patch Set: Fixing compile. Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/sync/engine/attachments/on_disk_attachment_store.h" 5 #include "components/sync/engine/attachments/on_disk_attachment_store.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/location.h" 14 #include "base/location.h"
15 #include "base/memory/ptr_util.h"
15 #include "base/metrics/histogram_macros.h" 16 #include "base/metrics/histogram_macros.h"
16 #include "base/sequenced_task_runner.h" 17 #include "base/sequenced_task_runner.h"
17 #include "components/sync/engine/attachments/attachment_util.h" 18 #include "components/sync/engine/attachments/attachment_util.h"
18 #include "components/sync/engine_impl/attachments/proto/attachment_store.pb.h" 19 #include "components/sync/engine_impl/attachments/proto/attachment_store.pb.h"
19 #include "components/sync/protocol/attachments.pb.h" 20 #include "components/sync/protocol/attachments.pb.h"
20 #include "third_party/leveldatabase/env_chromium.h" 21 #include "third_party/leveldatabase/env_chromium.h"
21 #include "third_party/leveldatabase/src/include/leveldb/db.h" 22 #include "third_party/leveldatabase/src/include/leveldb/db.h"
22 #include "third_party/leveldatabase/src/include/leveldb/options.h" 23 #include "third_party/leveldatabase/src/include/leveldb/options.h"
23 #include "third_party/leveldatabase/src/include/leveldb/slice.h" 24 #include "third_party/leveldatabase/src/include/leveldb/slice.h"
24 #include "third_party/leveldatabase/src/include/leveldb/status.h" 25 #include "third_party/leveldatabase/src/include/leveldb/status.h"
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 if (record_metadata.has_crc32c()) { 429 if (record_metadata.has_crc32c()) {
429 if (record_metadata.crc32c() != crc32c) { 430 if (record_metadata.crc32c() != crc32c) {
430 DVLOG(1) << "Attachment crc32c does not match value read from store"; 431 DVLOG(1) << "Attachment crc32c does not match value read from store";
431 return attachment; 432 return attachment;
432 } 433 }
433 if (record_metadata.crc32c() != attachment_id.GetCrc32c()) { 434 if (record_metadata.crc32c() != attachment_id.GetCrc32c()) {
434 DVLOG(1) << "Attachment crc32c does not match value in AttachmentId"; 435 DVLOG(1) << "Attachment crc32c does not match value in AttachmentId";
435 return attachment; 436 return attachment;
436 } 437 }
437 } 438 }
438 attachment.reset( 439 attachment = base::MakeUnique<Attachment>(
439 new Attachment(Attachment::CreateFromParts(attachment_id, data))); 440 Attachment::CreateFromParts(attachment_id, data));
440 return attachment; 441 return attachment;
441 } 442 }
442 443
443 bool OnDiskAttachmentStore::WriteSingleAttachment( 444 bool OnDiskAttachmentStore::WriteSingleAttachment(
444 const Attachment& attachment, 445 const Attachment& attachment,
445 AttachmentStore::Component component) { 446 AttachmentStore::Component component) {
446 const std::string metadata_key = 447 const std::string metadata_key =
447 MakeMetadataKeyFromAttachmentId(attachment.GetId()); 448 MakeMetadataKeyFromAttachmentId(attachment.GetId());
448 const std::string data_key = MakeDataKeyFromAttachmentId(attachment.GetId()); 449 const std::string data_key = MakeDataKeyFromAttachmentId(attachment.GetId());
449 450
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 return key; 532 return key;
532 } 533 }
533 534
534 AttachmentMetadata OnDiskAttachmentStore::MakeAttachmentMetadata( 535 AttachmentMetadata OnDiskAttachmentStore::MakeAttachmentMetadata(
535 const AttachmentId& attachment_id, 536 const AttachmentId& attachment_id,
536 const attachment_store_pb::RecordMetadata& record_metadata) { 537 const attachment_store_pb::RecordMetadata& record_metadata) {
537 return AttachmentMetadata(attachment_id, record_metadata.attachment_size()); 538 return AttachmentMetadata(attachment_id, record_metadata.attachment_size());
538 } 539 }
539 540
540 } // namespace syncer 541 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/engine/attachments/fake_attachment_downloader.cc ('k') | components/sync/engine/fake_sync_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698