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

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

Issue 13743003: sync: Finish the SyncScheduler refactor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix AuthErrorTest Created 7 years, 8 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/sessions/nudge_tracker.h ('k') | sync/sessions/nudge_tracker_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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/sessions/nudge_tracker.h"
6 #include "sync/protocol/sync.pb.h"
7
8 namespace syncer {
9 namespace sessions {
10
11 NudgeTracker::NudgeTracker() { }
12
13 NudgeTracker::~NudgeTracker() { }
14
15 void NudgeTracker::CoalesceSources(const SyncSourceInfo& source) {
16 CoalesceStates(source.types, &source_info_.types);
17 source_info_.updates_source = source.updates_source;
18 }
19
20 bool NudgeTracker::IsEmpty() {
21 return source_info_.types.empty();
22 }
23
24 void NudgeTracker::Reset() {
25 source_info_ = SyncSourceInfo();
26 }
27
28 // TODO(rlarocque): This function often reports incorrect results. However, it
29 // is compatible with the "classic" behaviour. We would need to make the nudge
30 // tracker stop overwriting its own information (ie. fix crbug.com/231693)
31 // before we could even try to report correct results. The main issue is that
32 // an notifications and local modifications nudges may overlap with each other
33 // in sych a way that we lose track of which types were or were not locally
34 // modified.
35 ModelTypeSet NudgeTracker::GetLocallyModifiedTypes() const {
36 ModelTypeSet locally_modified;
37
38 if (source_info_.updates_source != sync_pb::GetUpdatesCallerInfo::LOCAL) {
39 return locally_modified;
40 }
41
42 for (ModelTypeInvalidationMap::const_iterator i = source_info_.types.begin();
43 i != source_info().types.end(); ++i) {
44 locally_modified.Put(i->first);
45 }
46 return locally_modified;
47 }
48
49 } // namespace sessions
50 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/sessions/nudge_tracker.h ('k') | sync/sessions/nudge_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698