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

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

Issue 93433006: sync: Introduce ModelTypeRegistry and helpers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More review fixes 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
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
tim (not reviewing) 2014/01/08 19:33:42 2014
rlarocque 2014/01/09 00:31:18 Done.
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_UPDATER_LIST_H_
6 #define SYNC_ENGINE_UPDATER_LIST_H_
7
8 #include <map>
9 #include <vector>
10
11 #include "base/basictypes.h"
12 #include "base/stl_util.h"
13 #include "sync/base/sync_export.h"
14 #include "sync/internal_api/public/base/model_type.h"
15 #include "sync/internal_api/public/engine/model_safe_worker.h"
16
17 namespace sync_pb {
18 class GetUpdatesMessage;
19 class GetUpdatesResponse;
20 } // namespace sync_pb
21
22 namespace syncer {
23
24 namespace sessions {
25 class StatusController;
26 } // namespace sessions
27
28 namespace syncable {
29 class Directory;
30 } // namespace syncable
31
32 class SyncDirectoryUpdateHandler;
33
34 typedef std::vector<const sync_pb::SyncEntity*> SyncEntityList;
35 typedef std::map<ModelType, SyncEntityList> TypeSyncEntityMap;
36
37 // This class manages the set of per-type syncer objects.
38 //
39 // It owns these types and hides the details of iterating over all of them.
40 // Most methods allow the caller to specify a subset of types on which the
41 // operation is to be applied. It is a logic error if the supplied set of types
42 // contains a type which was not previously registered with the manager.
43 class SYNC_EXPORT_PRIVATE UpdaterList {
tim (not reviewing) 2014/01/08 19:33:42 I think UpdaterList is a poor name for this. This
rlarocque 2014/01/09 00:31:18 In what ways does this class have a different func
rlarocque 2014/01/09 05:10:39 Actually, never mind that last bit. That was a du
44 public:
45 UpdaterList();
46 ~UpdaterList();
47
48 // Registers an update handler directly.
49 void RegisterType(
50 ModelType type,
51 SyncDirectoryUpdateHandler* handler);
52
53 // Populates a GetUpdates request message with per-type information.
54 void PrepareGetUpdates(ModelTypeSet gu_types,
55 sync_pb::GetUpdatesMessage* get_updates);
56
57 // Processes a GetUpdates responses for each type.
58 bool ProcessGetUpdatesResponse(
59 ModelTypeSet gu_types,
60 const sync_pb::GetUpdatesResponse& gu_response,
61 sessions::StatusController* status_controller);
62
63 // Applies pending updates for all sync types known to the manager.
64 void ApplyUpdatesForAllTypes(sessions::StatusController* status_controller);
65
66 private:
67 typedef std::map<ModelType, SyncDirectoryUpdateHandler*> UpdateHandlerMap;
68
69 // A map of 'update handlers', one for each enabled type.
70 // This must be kept in sync with the routing info. Our temporary solution to
71 // that problem is to initialize this map in set_routing_info().
72 UpdateHandlerMap update_handler_map_;
73
74 // Deleter for the |update_handler_map_|.
75 STLValueDeleter<UpdateHandlerMap> update_handler_deleter_;
76
77 DISALLOW_COPY_AND_ASSIGN(UpdaterList);
78 };
79
80 } // namespace syncer
81
82 #endif // SYNC_ENGINE_UPDATER_LIST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698