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

Side by Side Diff: components/sync_driver/generic_change_processor.cc

Issue 1907683003: Convert //components/sync_driver from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build fix, address feedback 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 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_driver/generic_change_processor.h" 5 #include "components/sync_driver/generic_change_processor.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 } // namespace 95 } // namespace
96 96
97 GenericChangeProcessor::GenericChangeProcessor( 97 GenericChangeProcessor::GenericChangeProcessor(
98 syncer::ModelType type, 98 syncer::ModelType type,
99 DataTypeErrorHandler* error_handler, 99 DataTypeErrorHandler* error_handler,
100 const base::WeakPtr<syncer::SyncableService>& local_service, 100 const base::WeakPtr<syncer::SyncableService>& local_service,
101 const base::WeakPtr<syncer::SyncMergeResult>& merge_result, 101 const base::WeakPtr<syncer::SyncMergeResult>& merge_result,
102 syncer::UserShare* user_share, 102 syncer::UserShare* user_share,
103 SyncClient* sync_client, 103 SyncClient* sync_client,
104 scoped_ptr<syncer::AttachmentStoreForSync> attachment_store) 104 std::unique_ptr<syncer::AttachmentStoreForSync> attachment_store)
105 : ChangeProcessor(error_handler), 105 : ChangeProcessor(error_handler),
106 type_(type), 106 type_(type),
107 local_service_(local_service), 107 local_service_(local_service),
108 merge_result_(merge_result), 108 merge_result_(merge_result),
109 share_handle_(user_share), 109 share_handle_(user_share),
110 weak_ptr_factory_(this) { 110 weak_ptr_factory_(this) {
111 DCHECK(CalledOnValidThread()); 111 DCHECK(CalledOnValidThread());
112 DCHECK_NE(type_, syncer::UNSPECIFIED); 112 DCHECK_NE(type_, syncer::UNSPECIFIED);
113 if (attachment_store) { 113 if (attachment_store) {
114 std::string store_birthday; 114 std::string store_birthday;
(...skipping 25 matching lines...) Expand all
140 140
141 void GenericChangeProcessor::ApplyChangesFromSyncModel( 141 void GenericChangeProcessor::ApplyChangesFromSyncModel(
142 const syncer::BaseTransaction* trans, 142 const syncer::BaseTransaction* trans,
143 int64_t model_version, 143 int64_t model_version,
144 const syncer::ImmutableChangeRecordList& changes) { 144 const syncer::ImmutableChangeRecordList& changes) {
145 DCHECK(CalledOnValidThread()); 145 DCHECK(CalledOnValidThread());
146 DCHECK(syncer_changes_.empty()); 146 DCHECK(syncer_changes_.empty());
147 for (syncer::ChangeRecordList::const_iterator it = 147 for (syncer::ChangeRecordList::const_iterator it =
148 changes.Get().begin(); it != changes.Get().end(); ++it) { 148 changes.Get().begin(); it != changes.Get().end(); ++it) {
149 if (it->action == syncer::ChangeRecord::ACTION_DELETE) { 149 if (it->action == syncer::ChangeRecord::ACTION_DELETE) {
150 scoped_ptr<sync_pb::EntitySpecifics> specifics; 150 std::unique_ptr<sync_pb::EntitySpecifics> specifics;
151 if (it->specifics.has_password()) { 151 if (it->specifics.has_password()) {
152 DCHECK(it->extra.get()); 152 DCHECK(it->extra.get());
153 specifics.reset(new sync_pb::EntitySpecifics(it->specifics)); 153 specifics.reset(new sync_pb::EntitySpecifics(it->specifics));
154 specifics->mutable_password()->mutable_client_only_encrypted_data()-> 154 specifics->mutable_password()->mutable_client_only_encrypted_data()->
155 CopyFrom(it->extra->unencrypted()); 155 CopyFrom(it->extra->unencrypted());
156 } 156 }
157 const syncer::AttachmentIdList empty_list_of_attachment_ids; 157 const syncer::AttachmentIdList empty_list_of_attachment_ids;
158 syncer_changes_.push_back(syncer::SyncChange( 158 syncer_changes_.push_back(syncer::SyncChange(
159 FROM_HERE, syncer::SyncChange::ACTION_DELETE, 159 FROM_HERE, syncer::SyncChange::ACTION_DELETE,
160 syncer::SyncData::CreateRemoteData( 160 syncer::SyncData::CreateRemoteData(
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 syncer::AttachmentIdList ids; 705 syncer::AttachmentIdList ids;
706 { 706 {
707 syncer::ReadTransaction trans(FROM_HERE, share_handle()); 707 syncer::ReadTransaction trans(FROM_HERE, share_handle());
708 trans.GetAttachmentIdsToUpload(type_, &ids); 708 trans.GetAttachmentIdsToUpload(type_, &ids);
709 } 709 }
710 if (!ids.empty()) { 710 if (!ids.empty()) {
711 attachment_service_->UploadAttachments(ids); 711 attachment_service_->UploadAttachments(ids);
712 } 712 }
713 } 713 }
714 714
715 scoped_ptr<syncer::AttachmentService> 715 std::unique_ptr<syncer::AttachmentService>
716 GenericChangeProcessor::GetAttachmentService() const { 716 GenericChangeProcessor::GetAttachmentService() const {
717 return scoped_ptr<syncer::AttachmentService>( 717 return std::unique_ptr<syncer::AttachmentService>(
718 new syncer::AttachmentServiceProxy(attachment_service_proxy_)); 718 new syncer::AttachmentServiceProxy(attachment_service_proxy_));
719 } 719 }
720 720
721 } // namespace sync_driver 721 } // namespace sync_driver
OLDNEW
« no previous file with comments | « components/sync_driver/generic_change_processor.h ('k') | components/sync_driver/generic_change_processor_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698