Chromium Code Reviews| Index: components/sync_driver/generic_change_processor.cc |
| diff --git a/components/sync_driver/generic_change_processor.cc b/components/sync_driver/generic_change_processor.cc |
| index c44ce72a1bd23d1fa5a8e377c50903bc9ef83a6a..170378a746e8b3fac7a2356fa89467da53c91d7b 100644 |
| --- a/components/sync_driver/generic_change_processor.cc |
| +++ b/components/sync_driver/generic_change_processor.cc |
| @@ -92,19 +92,27 @@ GenericChangeProcessor::GenericChangeProcessor( |
| const base::WeakPtr<syncer::SyncableService>& local_service, |
| const base::WeakPtr<syncer::SyncMergeResult>& merge_result, |
| syncer::UserShare* user_share, |
| - SyncApiComponentFactory* sync_factory) |
| + SyncApiComponentFactory* sync_factory, |
| + const scoped_refptr<syncer::AttachmentStore>& attachment_store) |
| : ChangeProcessor(error_handler), |
| local_service_(local_service), |
| merge_result_(merge_result), |
| - share_handle_(user_share), |
| - attachment_service_( |
| - sync_factory->CreateAttachmentService(*user_share, this)), |
| - attachment_service_weak_ptr_factory_(attachment_service_.get()), |
| - attachment_service_proxy_( |
| - base::MessageLoopProxy::current(), |
| - attachment_service_weak_ptr_factory_.GetWeakPtr()) { |
| + share_handle_(user_share) { |
| DCHECK(CalledOnValidThread()); |
| - DCHECK(attachment_service_); |
| + if (attachment_store) { |
|
maniscalco
2014/09/08 21:56:35
I thought scoped_refptr no longer automatically co
pavely
2014/09/09 23:52:30
Done.
|
| + attachment_service_ = sync_factory->CreateAttachmentService( |
| + attachment_store, *user_share, this); |
| + attachment_service_weak_ptr_factory_.reset( |
| + new base::WeakPtrFactory<syncer::AttachmentService>( |
| + attachment_service_.get())); |
| + attachment_service_proxy_.reset(new syncer::AttachmentServiceProxy( |
| + base::MessageLoopProxy::current(), |
| + attachment_service_weak_ptr_factory_->GetWeakPtr())); |
| + } else { |
| + attachment_service_proxy_.reset(new syncer::AttachmentServiceProxy( |
| + base::MessageLoopProxy::current(), |
| + base::WeakPtr<syncer::AttachmentService>())); |
| + } |
| } |
| GenericChangeProcessor::~GenericChangeProcessor() { |
| @@ -136,7 +144,7 @@ void GenericChangeProcessor::ApplyChangesFromSyncModel( |
| specifics ? *specifics : it->specifics, |
| base::Time(), |
| empty_list_of_attachment_ids, |
| - attachment_service_proxy_))); |
| + *attachment_service_proxy_))); |
| } else { |
| syncer::SyncChange::SyncChangeType action = |
| (it->action == syncer::ChangeRecord::ACTION_ADD) ? |
| @@ -156,7 +164,7 @@ void GenericChangeProcessor::ApplyChangesFromSyncModel( |
| syncer_changes_.push_back(syncer::SyncChange( |
| FROM_HERE, |
| action, |
| - BuildRemoteSyncData(it->id, read_node, attachment_service_proxy_))); |
| + BuildRemoteSyncData(it->id, read_node, *attachment_service_proxy_))); |
| } |
| } |
| } |
| @@ -253,7 +261,7 @@ syncer::SyncError GenericChangeProcessor::GetAllSyncDataReturnError( |
| return error; |
| } |
| current_sync_data->push_back(BuildRemoteSyncData( |
| - sync_child_node.GetId(), sync_child_node, attachment_service_proxy_)); |
| + sync_child_node.GetId(), sync_child_node, *attachment_service_proxy_)); |
| } |
| return syncer::SyncError(); |
| } |