Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: sync/internal_api/sync_manager_impl.cc

Issue 10911084: Implement Invalidator::Acknowledge (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restart test + more cleanup Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 invalidator_->UpdateRegisteredIds(handler, ids); 635 invalidator_->UpdateRegisteredIds(handler, ids);
636 } 636 }
637 637
638 void SyncManagerImpl::UnregisterInvalidationHandler( 638 void SyncManagerImpl::UnregisterInvalidationHandler(
639 InvalidationHandler* handler) { 639 InvalidationHandler* handler) {
640 DCHECK(thread_checker_.CalledOnValidThread()); 640 DCHECK(thread_checker_.CalledOnValidThread());
641 DCHECK(initialized_); 641 DCHECK(initialized_);
642 invalidator_->UnregisterHandler(handler); 642 invalidator_->UnregisterHandler(handler);
643 } 643 }
644 644
645 void SyncManagerImpl::AcknowledgeInvalidation(
646 const invalidation::ObjectId& id, const syncer::AckHandle& ack_handle) {
647 DCHECK(thread_checker_.CalledOnValidThread());
648 DCHECK(initialized_);
649 invalidator_->Acknowledge(id, ack_handle);
650 }
651
645 void SyncManagerImpl::AddObserver(SyncManager::Observer* observer) { 652 void SyncManagerImpl::AddObserver(SyncManager::Observer* observer) {
646 DCHECK(thread_checker_.CalledOnValidThread()); 653 DCHECK(thread_checker_.CalledOnValidThread());
647 observers_.AddObserver(observer); 654 observers_.AddObserver(observer);
648 } 655 }
649 656
650 void SyncManagerImpl::RemoveObserver(SyncManager::Observer* observer) { 657 void SyncManagerImpl::RemoveObserver(SyncManager::Observer* observer) {
651 DCHECK(thread_checker_.CalledOnValidThread()); 658 DCHECK(thread_checker_.CalledOnValidThread());
652 observers_.RemoveObserver(observer); 659 observers_.RemoveObserver(observer);
653 } 660 }
654 661
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 type_invalidation_map, FROM_HERE); 1243 type_invalidation_map, FROM_HERE);
1237 } else if (!type_invalidation_map.empty()) { 1244 } else if (!type_invalidation_map.empty()) {
1238 allstatus_.IncrementNudgeCounter(NUDGE_SOURCE_NOTIFICATION); 1245 allstatus_.IncrementNudgeCounter(NUDGE_SOURCE_NOTIFICATION);
1239 scheduler_->ScheduleNudgeWithStatesAsync( 1246 scheduler_->ScheduleNudgeWithStatesAsync(
1240 TimeDelta::FromMilliseconds(kSyncSchedulerDelayMsec), 1247 TimeDelta::FromMilliseconds(kSyncSchedulerDelayMsec),
1241 NUDGE_SOURCE_NOTIFICATION, 1248 NUDGE_SOURCE_NOTIFICATION,
1242 type_invalidation_map, FROM_HERE); 1249 type_invalidation_map, FROM_HERE);
1243 allstatus_.IncrementNotificationsReceived(); 1250 allstatus_.IncrementNotificationsReceived();
1244 UpdateNotificationInfo(type_invalidation_map); 1251 UpdateNotificationInfo(type_invalidation_map);
1245 debug_info_event_listener_.OnIncomingNotification(type_invalidation_map); 1252 debug_info_event_listener_.OnIncomingNotification(type_invalidation_map);
1253 // TODO(dcheng): Acknowledge immediately for now. Fix this logic eventually.
1254 // crbug.com/124149
1255 for (ObjectIdInvalidationMap::const_iterator it = invalidation_map.begin();
akalin 2012/10/19 13:27:16 move this outside if block and after?
dcheng 2012/10/19 19:38:11 Done.
1256 it != invalidation_map.end(); ++it) {
1257 invalidator_->Acknowledge(it->first, it->second.ack_handle);
1258 }
1246 } else { 1259 } else {
1247 LOG(WARNING) << "Sync received invalidation without any type information."; 1260 LOG(WARNING) << "Sync received invalidation without any type information.";
1248 } 1261 }
1249 1262
1250 if (js_event_handler_.IsInitialized()) { 1263 if (js_event_handler_.IsInitialized()) {
1251 DictionaryValue details; 1264 DictionaryValue details;
1252 ListValue* changed_types = new ListValue(); 1265 ListValue* changed_types = new ListValue();
1253 details.Set("changedTypes", changed_types); 1266 details.Set("changedTypes", changed_types);
1254 for (ModelTypeInvalidationMap::const_iterator it = 1267 for (ModelTypeInvalidationMap::const_iterator it =
1255 type_invalidation_map.begin(); it != type_invalidation_map.end(); 1268 type_invalidation_map.begin(); it != type_invalidation_map.end();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 int SyncManagerImpl::GetDefaultNudgeDelay() { 1325 int SyncManagerImpl::GetDefaultNudgeDelay() {
1313 return kDefaultNudgeDelayMilliseconds; 1326 return kDefaultNudgeDelayMilliseconds;
1314 } 1327 }
1315 1328
1316 // static. 1329 // static.
1317 int SyncManagerImpl::GetPreferencesNudgeDelay() { 1330 int SyncManagerImpl::GetPreferencesNudgeDelay() {
1318 return kPreferencesNudgeDelayMilliseconds; 1331 return kPreferencesNudgeDelayMilliseconds;
1319 } 1332 }
1320 1333
1321 } // namespace syncer 1334 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698