| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "sync/internal_api/sync_manager_impl.h" | 5 #include "sync/internal_api/sync_manager_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 } | 270 } |
| 271 | 271 |
| 272 void SyncManagerImpl::ThrowUnrecoverableError() { | 272 void SyncManagerImpl::ThrowUnrecoverableError() { |
| 273 DCHECK(thread_checker_.CalledOnValidThread()); | 273 DCHECK(thread_checker_.CalledOnValidThread()); |
| 274 ReadTransaction trans(FROM_HERE, GetUserShare()); | 274 ReadTransaction trans(FROM_HERE, GetUserShare()); |
| 275 trans.GetWrappedTrans()->OnUnrecoverableError( | 275 trans.GetWrappedTrans()->OnUnrecoverableError( |
| 276 FROM_HERE, "Simulating unrecoverable error for testing purposes."); | 276 FROM_HERE, "Simulating unrecoverable error for testing purposes."); |
| 277 } | 277 } |
| 278 | 278 |
| 279 ModelTypeSet SyncManagerImpl::InitialSyncEndedTypes() { | 279 ModelTypeSet SyncManagerImpl::InitialSyncEndedTypes() { |
| 280 return directory()->initial_sync_ended_types(); | 280 return directory()->InitialSyncEndedTypes(); |
| 281 } | 281 } |
| 282 | 282 |
| 283 ModelTypeSet SyncManagerImpl::GetTypesWithEmptyProgressMarkerToken( | 283 ModelTypeSet SyncManagerImpl::GetTypesWithEmptyProgressMarkerToken( |
| 284 ModelTypeSet types) { | 284 ModelTypeSet types) { |
| 285 ModelTypeSet result; | 285 ModelTypeSet result; |
| 286 for (ModelTypeSet::Iterator i = types.First(); i.Good(); i.Inc()) { | 286 for (ModelTypeSet::Iterator i = types.First(); i.Good(); i.Inc()) { |
| 287 sync_pb::DataTypeProgressMarker marker; | 287 sync_pb::DataTypeProgressMarker marker; |
| 288 directory()->GetDownloadProgress(i.Get(), &marker); | 288 directory()->GetDownloadProgress(i.Get(), &marker); |
| 289 | 289 |
| 290 if (marker.token().empty()) | 290 if (marker.token().empty()) |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 | 565 |
| 566 return true; | 566 return true; |
| 567 } | 567 } |
| 568 | 568 |
| 569 bool SyncManagerImpl::PurgePartiallySyncedTypes() { | 569 bool SyncManagerImpl::PurgePartiallySyncedTypes() { |
| 570 ModelTypeSet partially_synced_types = ModelTypeSet::All(); | 570 ModelTypeSet partially_synced_types = ModelTypeSet::All(); |
| 571 partially_synced_types.RemoveAll(InitialSyncEndedTypes()); | 571 partially_synced_types.RemoveAll(InitialSyncEndedTypes()); |
| 572 partially_synced_types.RemoveAll(GetTypesWithEmptyProgressMarkerToken( | 572 partially_synced_types.RemoveAll(GetTypesWithEmptyProgressMarkerToken( |
| 573 ModelTypeSet::All())); | 573 ModelTypeSet::All())); |
| 574 | 574 |
| 575 DVLOG(1) << "Purging partially synced types " |
| 576 << ModelTypeSetToString(partially_synced_types); |
| 575 UMA_HISTOGRAM_COUNTS("Sync.PartiallySyncedTypes", | 577 UMA_HISTOGRAM_COUNTS("Sync.PartiallySyncedTypes", |
| 576 partially_synced_types.Size()); | 578 partially_synced_types.Size()); |
| 577 if (partially_synced_types.Empty()) | 579 if (partially_synced_types.Empty()) |
| 578 return true; | 580 return true; |
| 579 return directory()->PurgeEntriesWithTypeIn(partially_synced_types); | 581 return directory()->PurgeEntriesWithTypeIn(partially_synced_types); |
| 580 } | 582 } |
| 581 | 583 |
| 582 bool SyncManagerImpl::PurgeDisabledTypes( | 584 bool SyncManagerImpl::PurgeDisabledTypes( |
| 583 ModelTypeSet previously_enabled_types, | 585 ModelTypeSet previously_enabled_types, |
| 584 ModelTypeSet currently_enabled_types) { | 586 ModelTypeSet currently_enabled_types) { |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1354 int SyncManagerImpl::GetDefaultNudgeDelay() { | 1356 int SyncManagerImpl::GetDefaultNudgeDelay() { |
| 1355 return kDefaultNudgeDelayMilliseconds; | 1357 return kDefaultNudgeDelayMilliseconds; |
| 1356 } | 1358 } |
| 1357 | 1359 |
| 1358 // static. | 1360 // static. |
| 1359 int SyncManagerImpl::GetPreferencesNudgeDelay() { | 1361 int SyncManagerImpl::GetPreferencesNudgeDelay() { |
| 1360 return kPreferencesNudgeDelayMilliseconds; | 1362 return kPreferencesNudgeDelayMilliseconds; |
| 1361 } | 1363 } |
| 1362 | 1364 |
| 1363 } // namespace syncer | 1365 } // namespace syncer |
| OLD | NEW |