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

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

Issue 386030: Relieve SyncerSession,SyncCycleState, SyncProcessState, SyncerSession, Syncer... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 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 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 // An UpdateApplicator is used to iterate over a number of unapplied updates, 5 // An UpdateApplicator is used to iterate over a number of unapplied updates,
6 // applying them to the client using the given syncer session. 6 // applying them to the client using the given syncer session.
7 // 7 //
8 // UpdateApplicator might resemble an iterator, but it actually keeps retrying 8 // UpdateApplicator might resemble an iterator, but it actually keeps retrying
9 // failed updates until no remaining updates can be successfully applied. 9 // failed updates until no remaining updates can be successfully applied.
10 10
11 #ifndef CHROME_BROWSER_SYNC_ENGINE_UPDATE_APPLICATOR_H_ 11 #ifndef CHROME_BROWSER_SYNC_ENGINE_UPDATE_APPLICATOR_H_
12 #define CHROME_BROWSER_SYNC_ENGINE_UPDATE_APPLICATOR_H_ 12 #define CHROME_BROWSER_SYNC_ENGINE_UPDATE_APPLICATOR_H_
13 13
14 #include <set> 14 #include <set>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/basictypes.h" 17 #include "base/basictypes.h"
18 #include "base/port.h" 18 #include "base/port.h"
19 #include "chrome/browser/sync/syncable/syncable.h" 19 #include "chrome/browser/sync/syncable/syncable.h"
20 20
21 namespace browser_sync { 21 namespace browser_sync {
22 22
23 namespace sessions {
24 class ConflictProgress;
25 class UpdateProgress;
26 }
27
23 class ConflictResolver; 28 class ConflictResolver;
24 class SyncerSession;
25 29
26 class UpdateApplicator { 30 class UpdateApplicator {
27 public: 31 public:
28 typedef syncable::Directory::UnappliedUpdateMetaHandles::iterator 32 typedef syncable::Directory::UnappliedUpdateMetaHandles::iterator
29 UpdateIterator; 33 UpdateIterator;
30 34
31 UpdateApplicator(ConflictResolver* resolver, 35 UpdateApplicator(ConflictResolver* resolver,
32 const UpdateIterator& begin, 36 const UpdateIterator& begin,
33 const UpdateIterator& end); 37 const UpdateIterator& end);
34 38
35 // returns true if there's more we can do. 39 // returns true if there's more we can do.
36 bool AttemptOneApplication(syncable::WriteTransaction* trans); 40 bool AttemptOneApplication(syncable::WriteTransaction* trans);
37 // return true if we've applied all updates. 41 // return true if we've applied all updates.
38 bool AllUpdatesApplied() const; 42 bool AllUpdatesApplied() const;
39 43
40 // This class does not automatically save its progress into the 44 // This class does not automatically save its progress into the
41 // SyncerSession -- to get that to happen, call this method after update 45 // SyncSession -- to get that to happen, call this method after update
42 // application is finished (i.e., when AttemptOneAllocation stops returning 46 // application is finished (i.e., when AttemptOneAllocation stops returning
43 // true). 47 // true).
44 void SaveProgressIntoSessionState(SyncerSession* session); 48 void SaveProgressIntoSessionState(
49 sessions::ConflictProgress* conflict_progress,
50 sessions::UpdateProgress* update_progress);
45 51
46 private: 52 private:
47 // Used to resolve conflicts when trying to apply updates. 53 // Used to resolve conflicts when trying to apply updates.
48 ConflictResolver* const resolver_; 54 ConflictResolver* const resolver_;
49 55
50 UpdateIterator const begin_; 56 UpdateIterator const begin_;
51 UpdateIterator end_; 57 UpdateIterator end_;
52 UpdateIterator pointer_; 58 UpdateIterator pointer_;
53 bool progress_; 59 bool progress_;
54 60
55 // Track the result of the various items. 61 // Track the result of the various items.
56 std::vector<syncable::Id> conflicting_ids_; 62 std::vector<syncable::Id> conflicting_ids_;
57 std::vector<syncable::Id> successful_ids_; 63 std::vector<syncable::Id> successful_ids_;
58 }; 64 };
59 65
60 } // namespace browser_sync 66 } // namespace browser_sync
61 67
62 #endif // CHROME_BROWSER_SYNC_ENGINE_UPDATE_APPLICATOR_H_ 68 #endif // CHROME_BROWSER_SYNC_ENGINE_UPDATE_APPLICATOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/syncer_unittest.cc ('k') | chrome/browser/sync/engine/update_applicator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698