Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "sync/engine/nudge_tracker.h" | |
| 6 #include "sync/protocol/sync.pb.h" | |
| 7 | |
| 8 namespace syncer { | |
| 9 | |
| 10 NudgeTracker::NudgeTracker() { } | |
| 11 | |
| 12 NudgeTracker::~NudgeTracker() { } | |
| 13 | |
| 14 void NudgeTracker::CoalesceSources(const sessions::SyncSourceInfo& source) { | |
| 15 CoalesceStates(source.types, &source_info_.types); | |
| 16 source_info_.updates_source = source.updates_source; | |
| 17 } | |
| 18 | |
| 19 bool NudgeTracker::IsEmpty() { | |
| 20 return source_info_.types.empty(); | |
| 21 } | |
| 22 | |
| 23 void NudgeTracker::Reset() { | |
| 24 source_info_ = sessions::SyncSourceInfo(); | |
| 25 } | |
| 26 | |
| 27 // TODO(rlarocque): This function often reports incorrect results. However, it | |
|
tim (not reviewing)
2013/04/15 22:37:49
Is there a bug you can reference that details what
rlarocque
2013/04/16 01:30:26
I created crbug.com/231693, which is sort of relat
| |
| 28 // is compatible with the old behaviour. We would need to make the nudge | |
| 29 // tracker stop overwriting its own information if we wanted to track this | |
| 30 // properly and return correct results. | |
| 31 ModelTypeSet NudgeTracker::GetLocallyModifiedTypes() const { | |
| 32 ModelTypeSet locally_modified; | |
| 33 | |
| 34 if (source_info_.updates_source != sync_pb::GetUpdatesCallerInfo::LOCAL) { | |
| 35 return locally_modified; | |
| 36 } | |
| 37 | |
| 38 for (ModelTypeInvalidationMap::const_iterator i = source_info_.types.begin(); | |
| 39 i != source_info().types.end(); ++i) { | |
| 40 locally_modified.Put(i->first); | |
| 41 } | |
| 42 return locally_modified; | |
| 43 } | |
| 44 | |
| 45 } // namespace syncer | |
| OLD | NEW |