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

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

Issue 38803003: sync: Implement per-type update processing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes Created 7 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
« no previous file with comments | « sync/engine/download.cc ('k') | sync/engine/process_updates_command.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 2012 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 #ifndef SYNC_ENGINE_PROCESS_UPDATES_COMMAND_H_
6 #define SYNC_ENGINE_PROCESS_UPDATES_COMMAND_H_
7
8 #include "base/compiler_specific.h"
9 #include "sync/base/sync_export.h"
10 #include "sync/engine/model_changing_syncer_command.h"
11 #include "sync/engine/syncer_types.h"
12
13 namespace sync_pb {
14 class GetUpdatesResponse;
15 class SyncEntity;
16 }
17
18 namespace syncer {
19
20 namespace syncable {
21 class ModelNeutralWriteTransaction;
22 }
23
24 class Cryptographer;
25
26 // A syncer command for verifying and processing updates.
27 //
28 // Preconditions - Updates in the SyncerSesssion have been downloaded.
29 //
30 // Postconditions - All of the verified SyncEntity data will be copied to
31 // the server fields of the corresponding syncable entries.
32 class SYNC_EXPORT_PRIVATE ProcessUpdatesCommand : public SyncerCommand {
33 public:
34 ProcessUpdatesCommand();
35 virtual ~ProcessUpdatesCommand();
36
37 protected:
38 // SyncerCommand implementation.
39 virtual SyncerError ExecuteImpl(sessions::SyncSession* session) OVERRIDE;
40
41 private:
42 typedef std::vector<const sync_pb::SyncEntity*> SyncEntityList;
43 typedef std::map<ModelType, SyncEntityList> TypeSyncEntityMap;
44
45 // Given a GetUpdates response, iterates over all the returned items and
46 // divides them according to their type. Outputs a map from model types to
47 // received SyncEntities. ModelTypes that had no items in the update response
48 // will not be included in this map.
49 static void PartitionUpdatesByType(
50 const sync_pb::GetUpdatesResponse& updates,
51 TypeSyncEntityMap* updates_by_type);
52
53 VerifyResult VerifyUpdate(
54 syncable::ModelNeutralWriteTransaction* trans,
55 const sync_pb::SyncEntity& entry,
56 ModelTypeSet requested_types,
57 const ModelSafeRoutingInfo& routes);
58 void ProcessUpdate(
59 const sync_pb::SyncEntity& proto_update,
60 const Cryptographer* cryptographer,
61 syncable::ModelNeutralWriteTransaction* const trans);
62 DISALLOW_COPY_AND_ASSIGN(ProcessUpdatesCommand);
63 };
64
65 } // namespace syncer
66
67 #endif // SYNC_ENGINE_PROCESS_UPDATES_COMMAND_H_
OLDNEW
« no previous file with comments | « sync/engine/download.cc ('k') | sync/engine/process_updates_command.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698