Chromium Code Reviews| Index: sync/engine/nudge_tracker.cc |
| diff --git a/sync/engine/nudge_tracker.cc b/sync/engine/nudge_tracker.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1d5b915404423e3294a24026bfb3219f57a8b266 |
| --- /dev/null |
| +++ b/sync/engine/nudge_tracker.cc |
| @@ -0,0 +1,45 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "sync/engine/nudge_tracker.h" |
| +#include "sync/protocol/sync.pb.h" |
| + |
| +namespace syncer { |
| + |
| +NudgeTracker::NudgeTracker() { } |
| + |
| +NudgeTracker::~NudgeTracker() { } |
| + |
| +void NudgeTracker::CoalesceSources(const sessions::SyncSourceInfo& source) { |
| + CoalesceStates(source.types, &source_info_.types); |
| + source_info_.updates_source = source.updates_source; |
| +} |
| + |
| +bool NudgeTracker::IsEmpty() { |
| + return source_info_.types.empty(); |
| +} |
| + |
| +void NudgeTracker::Reset() { |
| + source_info_ = sessions::SyncSourceInfo(); |
| +} |
| + |
| +// 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
|
| +// is compatible with the old behaviour. We would need to make the nudge |
| +// tracker stop overwriting its own information if we wanted to track this |
| +// properly and return correct results. |
| +ModelTypeSet NudgeTracker::GetLocallyModifiedTypes() const { |
| + ModelTypeSet locally_modified; |
| + |
| + if (source_info_.updates_source != sync_pb::GetUpdatesCallerInfo::LOCAL) { |
| + return locally_modified; |
| + } |
| + |
| + for (ModelTypeInvalidationMap::const_iterator i = source_info_.types.begin(); |
| + i != source_info().types.end(); ++i) { |
| + locally_modified.Put(i->first); |
| + } |
| + return locally_modified; |
| +} |
| + |
| +} // namespace syncer |