Chromium Code Reviews| 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 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 674 invalidator_->UpdateRegisteredIds(handler, ids); | 674 invalidator_->UpdateRegisteredIds(handler, ids); |
| 675 } | 675 } |
| 676 | 676 |
| 677 void SyncManagerImpl::UnregisterInvalidationHandler( | 677 void SyncManagerImpl::UnregisterInvalidationHandler( |
| 678 InvalidationHandler* handler) { | 678 InvalidationHandler* handler) { |
| 679 DCHECK(thread_checker_.CalledOnValidThread()); | 679 DCHECK(thread_checker_.CalledOnValidThread()); |
| 680 DCHECK(initialized_); | 680 DCHECK(initialized_); |
| 681 invalidator_->UnregisterHandler(handler); | 681 invalidator_->UnregisterHandler(handler); |
| 682 } | 682 } |
| 683 | 683 |
| 684 void SyncManagerImpl::AcknowledgeInvalidation( | |
| 685 const invalidation::ObjectId& id, const syncer::AckHandle& ack_handle) { | |
| 686 DCHECK(thread_checker_.CalledOnValidThread()); | |
| 687 DCHECK(initialized_); | |
| 688 invalidator_->Acknowledge(id, ack_handle); | |
| 689 } | |
| 690 | |
| 684 void SyncManagerImpl::AddObserver(SyncManager::Observer* observer) { | 691 void SyncManagerImpl::AddObserver(SyncManager::Observer* observer) { |
| 685 DCHECK(thread_checker_.CalledOnValidThread()); | 692 DCHECK(thread_checker_.CalledOnValidThread()); |
| 686 observers_.AddObserver(observer); | 693 observers_.AddObserver(observer); |
| 687 } | 694 } |
| 688 | 695 |
| 689 void SyncManagerImpl::RemoveObserver(SyncManager::Observer* observer) { | 696 void SyncManagerImpl::RemoveObserver(SyncManager::Observer* observer) { |
| 690 DCHECK(thread_checker_.CalledOnValidThread()); | 697 DCHECK(thread_checker_.CalledOnValidThread()); |
| 691 observers_.RemoveObserver(observer); | 698 observers_.RemoveObserver(observer); |
| 692 } | 699 } |
| 693 | 700 |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1271 NUDGE_SOURCE_LOCAL_REFRESH, | 1278 NUDGE_SOURCE_LOCAL_REFRESH, |
| 1272 type_state_map, FROM_HERE); | 1279 type_state_map, FROM_HERE); |
| 1273 } else if (!type_state_map.empty()) { | 1280 } else if (!type_state_map.empty()) { |
| 1274 scheduler_->ScheduleNudgeWithStatesAsync( | 1281 scheduler_->ScheduleNudgeWithStatesAsync( |
| 1275 TimeDelta::FromMilliseconds(kSyncSchedulerDelayMsec), | 1282 TimeDelta::FromMilliseconds(kSyncSchedulerDelayMsec), |
| 1276 NUDGE_SOURCE_NOTIFICATION, | 1283 NUDGE_SOURCE_NOTIFICATION, |
| 1277 type_state_map, FROM_HERE); | 1284 type_state_map, FROM_HERE); |
| 1278 allstatus_.IncrementNotificationsReceived(); | 1285 allstatus_.IncrementNotificationsReceived(); |
| 1279 UpdateNotificationInfo(type_state_map); | 1286 UpdateNotificationInfo(type_state_map); |
| 1280 debug_info_event_listener_.OnIncomingNotification(type_state_map); | 1287 debug_info_event_listener_.OnIncomingNotification(type_state_map); |
| 1288 // TODO(dcheng): Acknowledge immediately for now. Fix this logic eventually. | |
|
Pete Williamson
2012/09/14 18:28:22
What fix is needed here? Ack later instead of imm
dcheng
2012/09/14 19:08:49
Eventually, the final patches for crbug.com/124149
| |
| 1289 for (ObjectIdStateMap::const_iterator it = id_state_map.begin(); | |
| 1290 it != id_state_map.end(); ++it) { | |
| 1291 invalidator_->Acknowledge(it->first, it->second.ack_handle); | |
| 1292 } | |
| 1281 } else { | 1293 } else { |
| 1282 LOG(WARNING) << "Sync received invalidation without any type information."; | 1294 LOG(WARNING) << "Sync received invalidation without any type information."; |
| 1283 } | 1295 } |
| 1284 | 1296 |
| 1285 if (js_event_handler_.IsInitialized()) { | 1297 if (js_event_handler_.IsInitialized()) { |
| 1286 DictionaryValue details; | 1298 DictionaryValue details; |
| 1287 ListValue* changed_types = new ListValue(); | 1299 ListValue* changed_types = new ListValue(); |
| 1288 details.Set("changedTypes", changed_types); | 1300 details.Set("changedTypes", changed_types); |
| 1289 for (ModelTypeStateMap::const_iterator it = type_state_map.begin(); | 1301 for (ModelTypeStateMap::const_iterator it = type_state_map.begin(); |
| 1290 it != type_state_map.end(); ++it) { | 1302 it != type_state_map.end(); ++it) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1346 int SyncManagerImpl::GetDefaultNudgeDelay() { | 1358 int SyncManagerImpl::GetDefaultNudgeDelay() { |
| 1347 return kDefaultNudgeDelayMilliseconds; | 1359 return kDefaultNudgeDelayMilliseconds; |
| 1348 } | 1360 } |
| 1349 | 1361 |
| 1350 // static. | 1362 // static. |
| 1351 int SyncManagerImpl::GetPreferencesNudgeDelay() { | 1363 int SyncManagerImpl::GetPreferencesNudgeDelay() { |
| 1352 return kPreferencesNudgeDelayMilliseconds; | 1364 return kPreferencesNudgeDelayMilliseconds; |
| 1353 } | 1365 } |
| 1354 | 1366 |
| 1355 } // namespace syncer | 1367 } // namespace syncer |
| OLD | NEW |