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

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: Add missing files 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.
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/stl_util.h"
12 #include "sync/base/sync_export.h"
13 #include "sync/internal_api/public/base/model_type.h"
14 #include "sync/internal_api/public/engine/model_safe_worker.h"
15
16 namespace sync_pb {
17 class GetUpdatesMessage;
18 class GetUpdatesResponse;
19 } // namespace sync_pb
20
21 namespace syncer {
22
23 namespace sessions {
24 class StatusController;
25 } // namespace sessions
26
27 namespace syncable {
28 class Directory;
29 } // namespace syncable
30
31 class SyncDirectoryUpdateHandler;
32
33 typedef std::vector<const sync_pb::SyncEntity*> SyncEntityList;
34 typedef std::map<ModelType, SyncEntityList> TypeSyncEntityMap;
35
36 // This class manages the set of per-type syncer objects.
37 //
38 // It owns these types and hides the details of iterating over all of them.
39 // Most methods allow the caller to specify a subset of types on which the
40 // operation is to be applied. It is a logic error if the supplied set of types
41 // contains a type which was not previously registered with the manager.
42 class SYNC_EXPORT_PRIVATE UpdaterList {
43 public:
44 UpdaterList();
45 ~UpdaterList();
46
47 // Registers an update handler directly.
48 void RegisterType(
49 ModelType type,
50 SyncDirectoryUpdateHandler* handler);
51
52 // Populates a GetUpdates request message with per-type information.
53 void PrepareGetUpdates(ModelTypeSet gu_types,
54 sync_pb::GetUpdatesMessage* get_updates);
55
56 // Processes a GetUpdates responses for each type.
57 bool ProcessGetUpdatesResponse(
58 ModelTypeSet gu_types,
59 const sync_pb::GetUpdatesResponse& gu_response,
60 sessions::StatusController* status_controller);
61
62 // Applies pending updates for all sync types known to the manager.
63 void ApplyUpdatesForAllTypes(sessions::StatusController* status_controller);
64
65 private:
66 typedef std::map<ModelType, SyncDirectoryUpdateHandler*> UpdateHandlerMap;
67
68 // A map of 'update handlers', one for each enabled type.
69 // This must be kept in sync with the routing info. Our temporary solution to
70 // that problem is to initialize this map in set_routing_info().
71 UpdateHandlerMap update_handler_map_;
72
73 // Deleter for the |update_handler_map_|.
74 STLValueDeleter<UpdateHandlerMap> update_handler_deleter_;
Nicolas Zea 2014/01/04 02:09:34 disallow copy and assign
rlarocque 2014/01/06 20:03:33 Done.
75 };
76
77 } // namespace syncer
78
79 #endif // SYNC_ENGINE_UPDATER_LIST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698