| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |