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 <stddef.h> | 7 #include <stddef.h> |
8 | |
9 #include <algorithm> | 8 #include <algorithm> |
10 #include <string> | 9 #include <string> |
| 10 #include <utility> |
11 | 11 |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
16 #include "components/sync_driver/sync_api_component_factory.h" | 16 #include "components/sync_driver/sync_api_component_factory.h" |
17 #include "components/sync_driver/sync_client.h" | 17 #include "components/sync_driver/sync_client.h" |
18 #include "sync/api/sync_change.h" | 18 #include "sync/api/sync_change.h" |
19 #include "sync/api/sync_error.h" | 19 #include "sync/api/sync_error.h" |
20 #include "sync/api/syncable_service.h" | 20 #include "sync/api/syncable_service.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; |
115 { | 115 { |
116 syncer::ReadTransaction trans(FROM_HERE, share_handle()); | 116 syncer::ReadTransaction trans(FROM_HERE, share_handle()); |
117 store_birthday = trans.GetStoreBirthday(); | 117 store_birthday = trans.GetStoreBirthday(); |
118 } | 118 } |
119 attachment_service_ = | 119 attachment_service_ = |
120 sync_client->GetSyncApiComponentFactory()->CreateAttachmentService( | 120 sync_client->GetSyncApiComponentFactory()->CreateAttachmentService( |
121 attachment_store.Pass(), *user_share, store_birthday, type, this); | 121 std::move(attachment_store), *user_share, store_birthday, type, |
| 122 this); |
122 attachment_service_weak_ptr_factory_.reset( | 123 attachment_service_weak_ptr_factory_.reset( |
123 new base::WeakPtrFactory<syncer::AttachmentService>( | 124 new base::WeakPtrFactory<syncer::AttachmentService>( |
124 attachment_service_.get())); | 125 attachment_service_.get())); |
125 attachment_service_proxy_ = syncer::AttachmentServiceProxy( | 126 attachment_service_proxy_ = syncer::AttachmentServiceProxy( |
126 base::ThreadTaskRunnerHandle::Get(), | 127 base::ThreadTaskRunnerHandle::Get(), |
127 attachment_service_weak_ptr_factory_->GetWeakPtr()); | 128 attachment_service_weak_ptr_factory_->GetWeakPtr()); |
128 UploadAllAttachmentsNotOnServer(); | 129 UploadAllAttachmentsNotOnServer(); |
129 } else { | 130 } else { |
130 attachment_service_proxy_ = syncer::AttachmentServiceProxy( | 131 attachment_service_proxy_ = syncer::AttachmentServiceProxy( |
131 base::ThreadTaskRunnerHandle::Get(), | 132 base::ThreadTaskRunnerHandle::Get(), |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 } | 712 } |
712 } | 713 } |
713 | 714 |
714 scoped_ptr<syncer::AttachmentService> | 715 scoped_ptr<syncer::AttachmentService> |
715 GenericChangeProcessor::GetAttachmentService() const { | 716 GenericChangeProcessor::GetAttachmentService() const { |
716 return scoped_ptr<syncer::AttachmentService>( | 717 return scoped_ptr<syncer::AttachmentService>( |
717 new syncer::AttachmentServiceProxy(attachment_service_proxy_)); | 718 new syncer::AttachmentServiceProxy(attachment_service_proxy_)); |
718 } | 719 } |
719 | 720 |
720 } // namespace sync_driver | 721 } // namespace sync_driver |
OLD | NEW |