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

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

Issue 10991005: Added nudge source counters to about:sync. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 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
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 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 972
973 void SyncManagerImpl::RequestNudgeForDataTypes( 973 void SyncManagerImpl::RequestNudgeForDataTypes(
974 const tracked_objects::Location& nudge_location, 974 const tracked_objects::Location& nudge_location,
975 ModelTypeSet types) { 975 ModelTypeSet types) {
976 debug_info_event_listener_.OnNudgeFromDatatype(types.First().Get()); 976 debug_info_event_listener_.OnNudgeFromDatatype(types.First().Get());
977 977
978 // TODO(lipalani) : Calculate the nudge delay based on all types. 978 // TODO(lipalani) : Calculate the nudge delay based on all types.
979 base::TimeDelta nudge_delay = NudgeStrategy::GetNudgeDelayTimeDelta( 979 base::TimeDelta nudge_delay = NudgeStrategy::GetNudgeDelayTimeDelta(
980 types.First().Get(), 980 types.First().Get(),
981 this); 981 this);
982 scheduler_->ScheduleNudgeAsync(nudge_delay, 982 ScheduleNudgeAsync(nudge_delay,
983 NUDGE_SOURCE_LOCAL, 983 NUDGE_SOURCE_LOCAL,
984 types, 984 types,
985 nudge_location); 985 nudge_location);
986 } 986 }
987 987
988 void SyncManagerImpl::OnSyncEngineEvent(const SyncEngineEvent& event) { 988 void SyncManagerImpl::OnSyncEngineEvent(const SyncEngineEvent& event) {
989 DCHECK(thread_checker_.CalledOnValidThread()); 989 DCHECK(thread_checker_.CalledOnValidThread());
990 // Only send an event if this is due to a cycle ending and this cycle 990 // Only send an event if this is due to a cycle ending and this cycle
991 // concludes a canonical "sync" process; that is, based on what is known 991 // concludes a canonical "sync" process; that is, based on what is known
992 // locally we are "all happy" and up-to-date. There may be new changes on 992 // locally we are "all happy" and up-to-date. There may be new changes on
993 // the server, but we'll get them on a subsequent sync. 993 // the server, but we'll get them on a subsequent sync.
994 // 994 //
995 // Notifications are sent at the end of every sync cycle, regardless of 995 // Notifications are sent at the end of every sync cycle, regardless of
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 } 1266 }
1267 } 1267 }
1268 1268
1269 void SyncManagerImpl::OnIncomingInvalidation( 1269 void SyncManagerImpl::OnIncomingInvalidation(
1270 const ObjectIdStateMap& id_state_map, 1270 const ObjectIdStateMap& id_state_map,
1271 IncomingInvalidationSource source) { 1271 IncomingInvalidationSource source) {
1272 DCHECK(thread_checker_.CalledOnValidThread()); 1272 DCHECK(thread_checker_.CalledOnValidThread());
1273 const ModelTypeStateMap& type_state_map = 1273 const ModelTypeStateMap& type_state_map =
1274 ObjectIdStateMapToModelTypeStateMap(id_state_map); 1274 ObjectIdStateMapToModelTypeStateMap(id_state_map);
1275 if (source == LOCAL_INVALIDATION) { 1275 if (source == LOCAL_INVALIDATION) {
1276 scheduler_->ScheduleNudgeWithStatesAsync( 1276 ScheduleNudgeWithStatesAsync(
1277 TimeDelta::FromMilliseconds(kSyncRefreshDelayMsec), 1277 TimeDelta::FromMilliseconds(kSyncRefreshDelayMsec),
1278 NUDGE_SOURCE_LOCAL_REFRESH, 1278 NUDGE_SOURCE_LOCAL_REFRESH,
1279 type_state_map, FROM_HERE); 1279 type_state_map, FROM_HERE);
1280 } else if (!type_state_map.empty()) { 1280 } else if (!type_state_map.empty()) {
1281 scheduler_->ScheduleNudgeWithStatesAsync( 1281 ScheduleNudgeWithStatesAsync(
1282 TimeDelta::FromMilliseconds(kSyncSchedulerDelayMsec), 1282 TimeDelta::FromMilliseconds(kSyncSchedulerDelayMsec),
1283 NUDGE_SOURCE_NOTIFICATION, 1283 NUDGE_SOURCE_NOTIFICATION,
1284 type_state_map, FROM_HERE); 1284 type_state_map, FROM_HERE);
1285 allstatus_.IncrementNotificationsReceived(); 1285 allstatus_.IncrementNotificationsReceived();
1286 UpdateNotificationInfo(type_state_map); 1286 UpdateNotificationInfo(type_state_map);
1287 debug_info_event_listener_.OnIncomingNotification(type_state_map); 1287 debug_info_event_listener_.OnIncomingNotification(type_state_map);
1288 } else { 1288 } else {
1289 LOG(WARNING) << "Sync received invalidation without any type information."; 1289 LOG(WARNING) << "Sync received invalidation without any type information.";
1290 } 1290 }
1291 1291
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 1342
1343 bool SyncManagerImpl::HasUnsyncedItems() { 1343 bool SyncManagerImpl::HasUnsyncedItems() {
1344 ReadTransaction trans(FROM_HERE, GetUserShare()); 1344 ReadTransaction trans(FROM_HERE, GetUserShare());
1345 return (trans.GetWrappedTrans()->directory()->unsynced_entity_count() != 0); 1345 return (trans.GetWrappedTrans()->directory()->unsynced_entity_count() != 0);
1346 } 1346 }
1347 1347
1348 SyncEncryptionHandler* SyncManagerImpl::GetEncryptionHandler() { 1348 SyncEncryptionHandler* SyncManagerImpl::GetEncryptionHandler() {
1349 return sync_encryption_handler_.get(); 1349 return sync_encryption_handler_.get();
1350 } 1350 }
1351 1351
1352 void SyncManagerImpl::ScheduleNudgeAsync(
1353 const base::TimeDelta& delay,
rlarocque 2012/09/24 23:24:37 A TimeDelta isn't very big. It would be cheaper t
1354 NudgeSource source,
1355 ModelTypeSet types,
1356 const tracked_objects::Location& nudge_location) {
1357 allstatus_.IncrementNudgeCounter(source);
1358 scheduler_->ScheduleNudgeAsync(delay, source,
rlarocque 2012/09/24 23:24:37 nit: This style of line wrapping for parameters is
1359 types, nudge_location);
1360 }
1361
1362
1363 void SyncManagerImpl::ScheduleNudgeWithStatesAsync(
1364 const base::TimeDelta& delay, NudgeSource source,
1365 const ModelTypeStateMap& type_state_map,
1366 const tracked_objects::Location& nudge_location) {
1367 allstatus_.IncrementNudgeCounter(source);
1368 scheduler_->ScheduleNudgeWithStatesAsync(delay, source,
1369 type_state_map, nudge_location);
1370 }
1371
1352 // static. 1372 // static.
1353 int SyncManagerImpl::GetDefaultNudgeDelay() { 1373 int SyncManagerImpl::GetDefaultNudgeDelay() {
1354 return kDefaultNudgeDelayMilliseconds; 1374 return kDefaultNudgeDelayMilliseconds;
1355 } 1375 }
1356 1376
1357 // static. 1377 // static.
1358 int SyncManagerImpl::GetPreferencesNudgeDelay() { 1378 int SyncManagerImpl::GetPreferencesNudgeDelay() {
1359 return kPreferencesNudgeDelayMilliseconds; 1379 return kPreferencesNudgeDelayMilliseconds;
1360 } 1380 }
1361 1381
1362 } // namespace syncer 1382 } // namespace syncer
OLDNEW
« sync/engine/all_status.cc ('K') | « sync/internal_api/sync_manager_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698