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

Side by Side Diff: sync/engine/process_updates_util.h

Issue 93433006: sync: Introduce ModelTypeRegistry and helpers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renames and moves Created 6 years, 11 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef SYNC_ENGINE_PROCESS_UPDATES_UTIL_H_ 5 #ifndef SYNC_ENGINE_PROCESS_UPDATES_UTIL_H_
6 #define SYNC_ENGINE_PROCESS_UPDATES_UTIL_H_ 6 #define SYNC_ENGINE_PROCESS_UPDATES_UTIL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 13 matching lines...) Expand all
24 class StatusController; 24 class StatusController;
25 } 25 }
26 26
27 namespace syncable { 27 namespace syncable {
28 class ModelNeutralWriteTransaction; 28 class ModelNeutralWriteTransaction;
29 class Directory; 29 class Directory;
30 } 30 }
31 31
32 class Cryptographer; 32 class Cryptographer;
33 33
34 // TODO(rlarocque): Move these definitions somewhere else?
35 typedef std::vector<const sync_pb::SyncEntity*> SyncEntityList; 34 typedef std::vector<const sync_pb::SyncEntity*> SyncEntityList;
36 typedef std::map<ModelType, SyncEntityList> TypeSyncEntityMap;
37
38 // Given a GetUpdates response, iterates over all the returned items and
39 // divides them according to their type. Outputs a map from model types to
40 // received SyncEntities. The output map will have entries (possibly empty)
41 // for all types in |requested_types|.
42 void PartitionUpdatesByType(
43 const sync_pb::GetUpdatesResponse& updates,
44 ModelTypeSet requested_types,
45 TypeSyncEntityMap* updates_by_type);
46 35
47 // Processes all the updates associated with a single ModelType. 36 // Processes all the updates associated with a single ModelType.
48 void ProcessDownloadedUpdates( 37 void ProcessDownloadedUpdates(
49 syncable::Directory* dir, 38 syncable::Directory* dir,
50 syncable::ModelNeutralWriteTransaction* trans, 39 syncable::ModelNeutralWriteTransaction* trans,
51 ModelType type, 40 ModelType type,
52 const SyncEntityList& applicable_updates, 41 const SyncEntityList& applicable_updates,
53 sessions::StatusController* status); 42 sessions::StatusController* status);
54 43
55 // Checks whether or not an update is fit for processing. 44 // Checks whether or not an update is fit for processing.
56 // 45 //
57 // The answer may be "no" if the update appears invalid, or it's not releveant 46 // The answer may be "no" if the update appears invalid, or it's not releveant
58 // (ie. a delete for an item we've never heard of), or other reasons. 47 // (ie. a delete for an item we've never heard of), or other reasons.
59 VerifyResult VerifyUpdate( 48 VerifyResult VerifyUpdate(
60 syncable::ModelNeutralWriteTransaction* trans, 49 syncable::ModelNeutralWriteTransaction* trans,
61 const sync_pb::SyncEntity& entry, 50 const sync_pb::SyncEntity& entry,
62 ModelType requested_type); 51 ModelType requested_type);
63 52
64 // If the update passes a series of checks, this function will copy 53 // If the update passes a series of checks, this function will copy
65 // the SyncEntity's data into the SERVER side of the syncable::Directory. 54 // the SyncEntity's data into the SERVER side of the syncable::Directory.
66 void ProcessUpdate( 55 void ProcessUpdate(
tim (not reviewing) 2014/01/16 18:28:22 As far as I can tell, nothing calls this, or Verif
rlarocque 2014/01/16 20:28:42 You're right, there's no reason to expose these he
67 const sync_pb::SyncEntity& proto_update, 56 const sync_pb::SyncEntity& proto_update,
68 const Cryptographer* cryptographer, 57 const Cryptographer* cryptographer,
69 syncable::ModelNeutralWriteTransaction* const trans); 58 syncable::ModelNeutralWriteTransaction* const trans);
70 59
71 } // namespace syncer 60 } // namespace syncer
72 61
73 #endif // SYNC_ENGINE_PROCESS_UPDATES_UTIL_H_ 62 #endif // SYNC_ENGINE_PROCESS_UPDATES_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698