| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_sessions/favicon_cache.h" | 5 #include "components/sync_sessions/favicon_cache.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/location.h" | 9 #include "base/location.h" |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 10 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 11 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
| 12 #include "components/favicon/core/favicon_service.h" | 14 #include "components/favicon/core/favicon_service.h" |
| 13 #include "components/history/core/browser/history_service.h" | 15 #include "components/history/core/browser/history_service.h" |
| 14 #include "components/history/core/browser/history_types.h" | 16 #include "components/history/core/browser/history_types.h" |
| 15 #include "sync/api/time.h" | 17 #include "sync/api/time.h" |
| 16 #include "sync/protocol/favicon_image_specifics.pb.h" | 18 #include "sync/protocol/favicon_image_specifics.pb.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 238 |
| 237 FaviconCache::~FaviconCache() {} | 239 FaviconCache::~FaviconCache() {} |
| 238 | 240 |
| 239 syncer::SyncMergeResult FaviconCache::MergeDataAndStartSyncing( | 241 syncer::SyncMergeResult FaviconCache::MergeDataAndStartSyncing( |
| 240 syncer::ModelType type, | 242 syncer::ModelType type, |
| 241 const syncer::SyncDataList& initial_sync_data, | 243 const syncer::SyncDataList& initial_sync_data, |
| 242 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | 244 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, |
| 243 scoped_ptr<syncer::SyncErrorFactory> error_handler) { | 245 scoped_ptr<syncer::SyncErrorFactory> error_handler) { |
| 244 DCHECK(type == syncer::FAVICON_IMAGES || type == syncer::FAVICON_TRACKING); | 246 DCHECK(type == syncer::FAVICON_IMAGES || type == syncer::FAVICON_TRACKING); |
| 245 if (type == syncer::FAVICON_IMAGES) | 247 if (type == syncer::FAVICON_IMAGES) |
| 246 favicon_images_sync_processor_ = sync_processor.Pass(); | 248 favicon_images_sync_processor_ = std::move(sync_processor); |
| 247 else | 249 else |
| 248 favicon_tracking_sync_processor_ = sync_processor.Pass(); | 250 favicon_tracking_sync_processor_ = std::move(sync_processor); |
| 249 | 251 |
| 250 syncer::SyncMergeResult merge_result(type); | 252 syncer::SyncMergeResult merge_result(type); |
| 251 merge_result.set_num_items_before_association(synced_favicons_.size()); | 253 merge_result.set_num_items_before_association(synced_favicons_.size()); |
| 252 std::set<GURL> unsynced_favicon_urls; | 254 std::set<GURL> unsynced_favicon_urls; |
| 253 for (FaviconMap::const_iterator iter = synced_favicons_.begin(); | 255 for (FaviconMap::const_iterator iter = synced_favicons_.begin(); |
| 254 iter != synced_favicons_.end(); ++iter) { | 256 iter != synced_favicons_.end(); ++iter) { |
| 255 if (FaviconInfoHasValidTypeData(*(iter->second), type)) | 257 if (FaviconInfoHasValidTypeData(*(iter->second), type)) |
| 256 unsynced_favicon_urls.insert(iter->first); | 258 unsynced_favicon_urls.insert(iter->first); |
| 257 } | 259 } |
| 258 | 260 |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 favicon_images_sync_processor_->ProcessSyncChanges(FROM_HERE, | 1049 favicon_images_sync_processor_->ProcessSyncChanges(FROM_HERE, |
| 1048 image_deletions); | 1050 image_deletions); |
| 1049 } | 1051 } |
| 1050 if (favicon_tracking_sync_processor_.get()) { | 1052 if (favicon_tracking_sync_processor_.get()) { |
| 1051 favicon_tracking_sync_processor_->ProcessSyncChanges(FROM_HERE, | 1053 favicon_tracking_sync_processor_->ProcessSyncChanges(FROM_HERE, |
| 1052 tracking_deletions); | 1054 tracking_deletions); |
| 1053 } | 1055 } |
| 1054 } | 1056 } |
| 1055 | 1057 |
| 1056 } // namespace browser_sync | 1058 } // namespace browser_sync |
| OLD | NEW |