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

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: Removed SyncManagerImpl::ScheduleNudge*() functions. 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
« no previous file with comments | « sync/internal_api/public/engine/sync_status.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 allstatus_.IncrementNudgeCounter(NUDGE_SOURCE_LOCAL);
982 scheduler_->ScheduleNudgeAsync(nudge_delay, 983 scheduler_->ScheduleNudgeAsync(nudge_delay,
983 NUDGE_SOURCE_LOCAL, 984 NUDGE_SOURCE_LOCAL,
rlarocque 2012/09/25 16:49:27 nit: fix indentation
984 types, 985 types,
985 nudge_location); 986 nudge_location);
986 } 987 }
987 988
988 void SyncManagerImpl::OnSyncEngineEvent(const SyncEngineEvent& event) { 989 void SyncManagerImpl::OnSyncEngineEvent(const SyncEngineEvent& event) {
989 DCHECK(thread_checker_.CalledOnValidThread()); 990 DCHECK(thread_checker_.CalledOnValidThread());
990 // Only send an event if this is due to a cycle ending and this cycle 991 // 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 992 // 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 993 // 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. 994 // the server, but we'll get them on a subsequent sync.
994 // 995 //
995 // Notifications are sent at the end of every sync cycle, regardless of 996 // 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 } 1267 }
1267 } 1268 }
1268 1269
1269 void SyncManagerImpl::OnIncomingInvalidation( 1270 void SyncManagerImpl::OnIncomingInvalidation(
1270 const ObjectIdStateMap& id_state_map, 1271 const ObjectIdStateMap& id_state_map,
1271 IncomingInvalidationSource source) { 1272 IncomingInvalidationSource source) {
1272 DCHECK(thread_checker_.CalledOnValidThread()); 1273 DCHECK(thread_checker_.CalledOnValidThread());
1273 const ModelTypeStateMap& type_state_map = 1274 const ModelTypeStateMap& type_state_map =
1274 ObjectIdStateMapToModelTypeStateMap(id_state_map); 1275 ObjectIdStateMapToModelTypeStateMap(id_state_map);
1275 if (source == LOCAL_INVALIDATION) { 1276 if (source == LOCAL_INVALIDATION) {
1277 allstatus_.IncrementNudgeCounter(NUDGE_SOURCE_LOCAL_REFRESH);
1276 scheduler_->ScheduleNudgeWithStatesAsync( 1278 scheduler_->ScheduleNudgeWithStatesAsync(
1277 TimeDelta::FromMilliseconds(kSyncRefreshDelayMsec), 1279 TimeDelta::FromMilliseconds(kSyncRefreshDelayMsec),
1278 NUDGE_SOURCE_LOCAL_REFRESH, 1280 NUDGE_SOURCE_LOCAL_REFRESH,
1279 type_state_map, FROM_HERE); 1281 type_state_map, FROM_HERE);
1280 } else if (!type_state_map.empty()) { 1282 } else if (!type_state_map.empty()) {
1283 allstatus_.IncrementNudgeCounter(NUDGE_SOURCE_NOTIFICATION);
1281 scheduler_->ScheduleNudgeWithStatesAsync( 1284 scheduler_->ScheduleNudgeWithStatesAsync(
1282 TimeDelta::FromMilliseconds(kSyncSchedulerDelayMsec), 1285 TimeDelta::FromMilliseconds(kSyncSchedulerDelayMsec),
1283 NUDGE_SOURCE_NOTIFICATION, 1286 NUDGE_SOURCE_NOTIFICATION,
1284 type_state_map, FROM_HERE); 1287 type_state_map, FROM_HERE);
1285 allstatus_.IncrementNotificationsReceived(); 1288 allstatus_.IncrementNotificationsReceived();
1286 UpdateNotificationInfo(type_state_map); 1289 UpdateNotificationInfo(type_state_map);
1287 debug_info_event_listener_.OnIncomingNotification(type_state_map); 1290 debug_info_event_listener_.OnIncomingNotification(type_state_map);
1288 } else { 1291 } else {
1289 LOG(WARNING) << "Sync received invalidation without any type information."; 1292 LOG(WARNING) << "Sync received invalidation without any type information.";
1290 } 1293 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 int SyncManagerImpl::GetDefaultNudgeDelay() { 1356 int SyncManagerImpl::GetDefaultNudgeDelay() {
1354 return kDefaultNudgeDelayMilliseconds; 1357 return kDefaultNudgeDelayMilliseconds;
1355 } 1358 }
1356 1359
1357 // static. 1360 // static.
1358 int SyncManagerImpl::GetPreferencesNudgeDelay() { 1361 int SyncManagerImpl::GetPreferencesNudgeDelay() {
1359 return kPreferencesNudgeDelayMilliseconds; 1362 return kPreferencesNudgeDelayMilliseconds;
1360 } 1363 }
1361 1364
1362 } // namespace syncer 1365 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/public/engine/sync_status.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698