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

Side by Side Diff: sync/sessions/nudge_tracker.cc

Issue 19309002: sync: Add pre-commit update avoidance mode + flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/sessions/nudge_tracker.h" 5 #include "sync/sessions/nudge_tracker.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "sync/internal_api/public/base/invalidation.h" 8 #include "sync/internal_api/public/base/invalidation.h"
9 #include "sync/internal_api/public/sessions/sync_source_info.h" 9 #include "sync/internal_api/public/sessions/sync_source_info.h"
10 #include "sync/protocol/sync.pb.h" 10 #include "sync/protocol/sync.pb.h"
(...skipping 20 matching lines...) Expand all
31 bool NudgeTracker::IsSyncRequired() const { 31 bool NudgeTracker::IsSyncRequired() const {
32 for (TypeTrackerMap::const_iterator it = type_trackers_.begin(); 32 for (TypeTrackerMap::const_iterator it = type_trackers_.begin();
33 it != type_trackers_.end(); ++it) { 33 it != type_trackers_.end(); ++it) {
34 if (it->second.IsSyncRequired()) { 34 if (it->second.IsSyncRequired()) {
35 return true; 35 return true;
36 } 36 }
37 } 37 }
38 return false; 38 return false;
39 } 39 }
40 40
41 bool NudgeTracker::IsGetUpdatesRequired() const {
42 for (TypeTrackerMap::const_iterator it = type_trackers_.begin();
43 it != type_trackers_.end(); ++it) {
44 if (it->second.IsGetUpdatesRequired()) {
45 return true;
46 }
47 }
48 return false;
49 }
50
41 void NudgeTracker::RecordSuccessfulSyncCycle() { 51 void NudgeTracker::RecordSuccessfulSyncCycle() {
42 updates_source_ = sync_pb::GetUpdatesCallerInfo::UNKNOWN; 52 updates_source_ = sync_pb::GetUpdatesCallerInfo::UNKNOWN;
43 53
44 // A successful cycle while invalidations are enabled puts us back into sync. 54 // A successful cycle while invalidations are enabled puts us back into sync.
45 invalidations_out_of_sync_ = !invalidations_enabled_; 55 invalidations_out_of_sync_ = !invalidations_enabled_;
46 56
47 for (TypeTrackerMap::iterator it = type_trackers_.begin(); 57 for (TypeTrackerMap::iterator it = type_trackers_.begin();
48 it != type_trackers_.end(); ++it) { 58 it != type_trackers_.end(); ++it) {
49 it->second.RecordSuccessfulSyncCycle(); 59 it->second.RecordSuccessfulSyncCycle();
50 } 60 }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 231
222 void NudgeTracker::SetHintBufferSize(size_t size) { 232 void NudgeTracker::SetHintBufferSize(size_t size) {
223 for (TypeTrackerMap::iterator it = type_trackers_.begin(); 233 for (TypeTrackerMap::iterator it = type_trackers_.begin();
224 it != type_trackers_.end(); ++it) { 234 it != type_trackers_.end(); ++it) {
225 it->second.UpdatePayloadBufferSize(size); 235 it->second.UpdatePayloadBufferSize(size);
226 } 236 }
227 } 237 }
228 238
229 } // namespace sessions 239 } // namespace sessions
230 } // namespace syncer 240 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698