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

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

Issue 2828021: Take 2: sync changes to support encryption (Closed)
Patch Set: fix flaky password test under valgrind Created 10 years, 6 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
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/engine/model_safe_worker.h" 19 #include "chrome/browser/sync/engine/model_safe_worker.h"
20 #include "chrome/browser/sync/syncable/syncable.h" 20 #include "chrome/browser/sync/syncable/syncable.h"
21 21
22 namespace browser_sync { 22 namespace browser_sync {
23 23
24 namespace sessions { 24 namespace sessions {
25 class ConflictProgress; 25 class ConflictProgress;
26 class UpdateProgress; 26 class UpdateProgress;
27 } 27 }
28 28
29 class ConflictResolver; 29 class ConflictResolver;
30 class Cryptographer;
30 31
31 class UpdateApplicator { 32 class UpdateApplicator {
32 public: 33 public:
33 typedef syncable::Directory::UnappliedUpdateMetaHandles::iterator 34 typedef syncable::Directory::UnappliedUpdateMetaHandles::iterator
34 UpdateIterator; 35 UpdateIterator;
35 36
36 UpdateApplicator(ConflictResolver* resolver, 37 UpdateApplicator(ConflictResolver* resolver,
38 Cryptographer* cryptographer,
37 const UpdateIterator& begin, 39 const UpdateIterator& begin,
38 const UpdateIterator& end, 40 const UpdateIterator& end,
39 const ModelSafeRoutingInfo& routes, 41 const ModelSafeRoutingInfo& routes,
40 ModelSafeGroup group_filter); 42 ModelSafeGroup group_filter);
41 43
42 // returns true if there's more we can do. 44 // returns true if there's more we can do.
43 bool AttemptOneApplication(syncable::WriteTransaction* trans); 45 bool AttemptOneApplication(syncable::WriteTransaction* trans);
44 // return true if we've applied all updates. 46 // return true if we've applied all updates.
45 bool AllUpdatesApplied() const; 47 bool AllUpdatesApplied() const;
46 48
47 // This class does not automatically save its progress into the 49 // This class does not automatically save its progress into the
48 // SyncSession -- to get that to happen, call this method after update 50 // SyncSession -- to get that to happen, call this method after update
49 // application is finished (i.e., when AttemptOneAllocation stops returning 51 // application is finished (i.e., when AttemptOneAllocation stops returning
50 // true). 52 // true).
51 void SaveProgressIntoSessionState( 53 void SaveProgressIntoSessionState(
52 sessions::ConflictProgress* conflict_progress, 54 sessions::ConflictProgress* conflict_progress,
53 sessions::UpdateProgress* update_progress); 55 sessions::UpdateProgress* update_progress);
54 56
55 private: 57 private:
56 // If true, AttemptOneApplication will skip over |entry| and return true. 58 // If true, AttemptOneApplication will skip over |entry| and return true.
57 bool SkipUpdate(const syncable::Entry& entry); 59 bool SkipUpdate(const syncable::Entry& entry);
58 60
59 // Adjusts the UpdateIterator members to move ahead by one update. 61 // Adjusts the UpdateIterator members to move ahead by one update.
60 void Advance(); 62 void Advance();
61 63
62 // Used to resolve conflicts when trying to apply updates. 64 // Used to resolve conflicts when trying to apply updates.
63 ConflictResolver* const resolver_; 65 ConflictResolver* const resolver_;
64 66
67 // Used to decrypt sensitive sync nodes.
68 Cryptographer* cryptographer_;
69
65 UpdateIterator const begin_; 70 UpdateIterator const begin_;
66 UpdateIterator end_; 71 UpdateIterator end_;
67 UpdateIterator pointer_; 72 UpdateIterator pointer_;
68 ModelSafeGroup group_filter_; 73 ModelSafeGroup group_filter_;
69 bool progress_; 74 bool progress_;
70 75
71 const ModelSafeRoutingInfo routing_info_; 76 const ModelSafeRoutingInfo routing_info_;
72 77
73 // Track the result of the various items. 78 // Track the result of the various items.
74 std::vector<syncable::Id> conflicting_ids_; 79 std::vector<syncable::Id> conflicting_ids_;
75 std::vector<syncable::Id> successful_ids_; 80 std::vector<syncable::Id> successful_ids_;
76 }; 81 };
77 82
78 } // namespace browser_sync 83 } // namespace browser_sync
79 84
80 #endif // CHROME_BROWSER_SYNC_ENGINE_UPDATE_APPLICATOR_H_ 85 #endif // CHROME_BROWSER_SYNC_ENGINE_UPDATE_APPLICATOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/syncer_util.cc ('k') | chrome/browser/sync/engine/update_applicator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698