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

Side by Side Diff: chrome/browser/sync/engine/update_applicator.h

Issue 194065: Initial commit of sync engine code to browser/sync.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fixes to gtest include path, reverted syncapi. Created 11 years, 3 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 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 // An UpdateApplicator is used to iterate over a number of unapplied
6 // updates, applying them to the client using the given syncer session.
7 //
8 // UpdateApplicator might resemble an iterator, but it actually keeps retrying
9 // failed updates until no remaining updates can be successfully applied.
10
11 #ifndef CHROME_BROWSER_SYNC_ENGINE_UPDATE_APPLICATOR_H_
12 #define CHROME_BROWSER_SYNC_ENGINE_UPDATE_APPLICATOR_H_
13
14 #include <vector>
15 #include <set>
16
17 #include "base/basictypes.h"
18 #include "base/port.h"
19
20 namespace syncable {
21 class Id;
22 class WriteTransaction;
23 } // namespace syncable
24
25 namespace browser_sync {
26
27 class SyncerSession;
28
29 class UpdateApplicator {
30 public:
31 typedef std::vector<int64>::iterator vi64iter;
32
33 UpdateApplicator(SyncerSession* session, const vi64iter& begin,
34 const vi64iter& end);
35 // returns true if there's more we can do.
36 bool AttemptOneApplication(syncable::WriteTransaction* trans);
37 // return true if we've applied all updates.
38 bool AllUpdatesApplied() const;
39
40 // This class does not automatically save its progress into the
41 // SyncerSession -- to get that to happen, call this method after
42 // update application is finished (i.e., when AttemptOneAllocation
43 // stops returning true).
44 void SaveProgressIntoSessionState();
45
46 private:
47 SyncerSession* const session_;
48 vi64iter const begin_;
49 vi64iter end_;
50 vi64iter pointer_;
51 bool progress_;
52
53 // Track the result of the various items.
54 std::vector<syncable::Id> conflicting_ids_;
55 std::vector<syncable::Id> blocked_ids_;
56 std::vector<syncable::Id> successful_ids_;
57 };
58
59 } // namespace browser_sync
60
61 #endif // CHROME_BROWSER_SYNC_ENGINE_UPDATE_APPLICATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698