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

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

Issue 996473005: Revert of [Sync] Refactor AttachmentStore classes. Introduce concept of referrer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 "base/location.h" 7 #include "base/location.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "components/sync_driver/sync_api_component_factory.h" 10 #include "components/sync_driver/sync_api_component_factory.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 } // namespace 88 } // namespace
89 89
90 GenericChangeProcessor::GenericChangeProcessor( 90 GenericChangeProcessor::GenericChangeProcessor(
91 syncer::ModelType type, 91 syncer::ModelType type,
92 DataTypeErrorHandler* error_handler, 92 DataTypeErrorHandler* error_handler,
93 const base::WeakPtr<syncer::SyncableService>& local_service, 93 const base::WeakPtr<syncer::SyncableService>& local_service,
94 const base::WeakPtr<syncer::SyncMergeResult>& merge_result, 94 const base::WeakPtr<syncer::SyncMergeResult>& merge_result,
95 syncer::UserShare* user_share, 95 syncer::UserShare* user_share,
96 SyncApiComponentFactory* sync_factory, 96 SyncApiComponentFactory* sync_factory,
97 scoped_ptr<syncer::AttachmentStore> attachment_store) 97 const scoped_refptr<syncer::AttachmentStore>& attachment_store)
98 : ChangeProcessor(error_handler), 98 : ChangeProcessor(error_handler),
99 type_(type), 99 type_(type),
100 local_service_(local_service), 100 local_service_(local_service),
101 merge_result_(merge_result), 101 merge_result_(merge_result),
102 share_handle_(user_share), 102 share_handle_(user_share),
103 weak_ptr_factory_(this) { 103 weak_ptr_factory_(this) {
104 DCHECK(CalledOnValidThread()); 104 DCHECK(CalledOnValidThread());
105 DCHECK_NE(type_, syncer::UNSPECIFIED); 105 DCHECK_NE(type_, syncer::UNSPECIFIED);
106 if (attachment_store) { 106 if (attachment_store.get()) {
107 std::string store_birthday; 107 std::string store_birthday;
108 { 108 {
109 syncer::ReadTransaction trans(FROM_HERE, share_handle()); 109 syncer::ReadTransaction trans(FROM_HERE, share_handle());
110 store_birthday = trans.GetStoreBirthday(); 110 store_birthday = trans.GetStoreBirthday();
111 } 111 }
112 attachment_service_ = sync_factory->CreateAttachmentService( 112 attachment_service_ = sync_factory->CreateAttachmentService(
113 attachment_store.Pass(), *user_share, store_birthday, type, this); 113 attachment_store, *user_share, store_birthday, type, this);
114 attachment_service_weak_ptr_factory_.reset( 114 attachment_service_weak_ptr_factory_.reset(
115 new base::WeakPtrFactory<syncer::AttachmentService>( 115 new base::WeakPtrFactory<syncer::AttachmentService>(
116 attachment_service_.get())); 116 attachment_service_.get()));
117 attachment_service_proxy_ = syncer::AttachmentServiceProxy( 117 attachment_service_proxy_ = syncer::AttachmentServiceProxy(
118 base::MessageLoopProxy::current(), 118 base::MessageLoopProxy::current(),
119 attachment_service_weak_ptr_factory_->GetWeakPtr()); 119 attachment_service_weak_ptr_factory_->GetWeakPtr());
120 UploadAllAttachmentsNotOnServer(); 120 UploadAllAttachmentsNotOnServer();
121 } else { 121 } else {
122 attachment_service_proxy_ = syncer::AttachmentServiceProxy( 122 attachment_service_proxy_ = syncer::AttachmentServiceProxy(
123 base::MessageLoopProxy::current(), 123 base::MessageLoopProxy::current(),
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 } 715 }
716 } 716 }
717 717
718 scoped_ptr<syncer::AttachmentService> 718 scoped_ptr<syncer::AttachmentService>
719 GenericChangeProcessor::GetAttachmentService() const { 719 GenericChangeProcessor::GetAttachmentService() const {
720 return scoped_ptr<syncer::AttachmentService>( 720 return scoped_ptr<syncer::AttachmentService>(
721 new syncer::AttachmentServiceProxy(attachment_service_proxy_)); 721 new syncer::AttachmentServiceProxy(attachment_service_proxy_));
722 } 722 }
723 723
724 } // namespace sync_driver 724 } // namespace sync_driver
OLDNEW
« no previous file with comments | « components/sync_driver/generic_change_processor.h ('k') | components/sync_driver/generic_change_processor_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698