| OLD | NEW |
| 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 "base/thread_task_runner_handle.h" |
| 10 #include "components/sync_driver/sync_api_component_factory.h" | 11 #include "components/sync_driver/sync_api_component_factory.h" |
| 11 #include "sync/api/sync_change.h" | 12 #include "sync/api/sync_change.h" |
| 12 #include "sync/api/sync_error.h" | 13 #include "sync/api/sync_error.h" |
| 13 #include "sync/api/syncable_service.h" | 14 #include "sync/api/syncable_service.h" |
| 14 #include "sync/internal_api/public/base_node.h" | 15 #include "sync/internal_api/public/base_node.h" |
| 15 #include "sync/internal_api/public/change_record.h" | 16 #include "sync/internal_api/public/change_record.h" |
| 16 #include "sync/internal_api/public/read_node.h" | 17 #include "sync/internal_api/public/read_node.h" |
| 17 #include "sync/internal_api/public/read_transaction.h" | 18 #include "sync/internal_api/public/read_transaction.h" |
| 18 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" | 19 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" |
| 19 #include "sync/internal_api/public/write_node.h" | 20 #include "sync/internal_api/public/write_node.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 { | 109 { |
| 109 syncer::ReadTransaction trans(FROM_HERE, share_handle()); | 110 syncer::ReadTransaction trans(FROM_HERE, share_handle()); |
| 110 store_birthday = trans.GetStoreBirthday(); | 111 store_birthday = trans.GetStoreBirthday(); |
| 111 } | 112 } |
| 112 attachment_service_ = sync_factory->CreateAttachmentService( | 113 attachment_service_ = sync_factory->CreateAttachmentService( |
| 113 attachment_store.Pass(), *user_share, store_birthday, type, this); | 114 attachment_store.Pass(), *user_share, store_birthday, type, this); |
| 114 attachment_service_weak_ptr_factory_.reset( | 115 attachment_service_weak_ptr_factory_.reset( |
| 115 new base::WeakPtrFactory<syncer::AttachmentService>( | 116 new base::WeakPtrFactory<syncer::AttachmentService>( |
| 116 attachment_service_.get())); | 117 attachment_service_.get())); |
| 117 attachment_service_proxy_ = syncer::AttachmentServiceProxy( | 118 attachment_service_proxy_ = syncer::AttachmentServiceProxy( |
| 118 base::MessageLoopProxy::current(), | 119 base::ThreadTaskRunnerHandle::Get(), |
| 119 attachment_service_weak_ptr_factory_->GetWeakPtr()); | 120 attachment_service_weak_ptr_factory_->GetWeakPtr()); |
| 120 UploadAllAttachmentsNotOnServer(); | 121 UploadAllAttachmentsNotOnServer(); |
| 121 } else { | 122 } else { |
| 122 attachment_service_proxy_ = syncer::AttachmentServiceProxy( | 123 attachment_service_proxy_ = syncer::AttachmentServiceProxy( |
| 123 base::MessageLoopProxy::current(), | 124 base::ThreadTaskRunnerHandle::Get(), |
| 124 base::WeakPtr<syncer::AttachmentService>()); | 125 base::WeakPtr<syncer::AttachmentService>()); |
| 125 } | 126 } |
| 126 } | 127 } |
| 127 | 128 |
| 128 GenericChangeProcessor::~GenericChangeProcessor() { | 129 GenericChangeProcessor::~GenericChangeProcessor() { |
| 129 DCHECK(CalledOnValidThread()); | 130 DCHECK(CalledOnValidThread()); |
| 130 } | 131 } |
| 131 | 132 |
| 132 void GenericChangeProcessor::ApplyChangesFromSyncModel( | 133 void GenericChangeProcessor::ApplyChangesFromSyncModel( |
| 133 const syncer::BaseTransaction* trans, | 134 const syncer::BaseTransaction* trans, |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 } | 720 } |
| 720 } | 721 } |
| 721 | 722 |
| 722 scoped_ptr<syncer::AttachmentService> | 723 scoped_ptr<syncer::AttachmentService> |
| 723 GenericChangeProcessor::GetAttachmentService() const { | 724 GenericChangeProcessor::GetAttachmentService() const { |
| 724 return scoped_ptr<syncer::AttachmentService>( | 725 return scoped_ptr<syncer::AttachmentService>( |
| 725 new syncer::AttachmentServiceProxy(attachment_service_proxy_)); | 726 new syncer::AttachmentServiceProxy(attachment_service_proxy_)); |
| 726 } | 727 } |
| 727 | 728 |
| 728 } // namespace sync_driver | 729 } // namespace sync_driver |
| OLD | NEW |