Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2014 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_GET_UPDATES_PROCESSOR_H | |
| 6 #define SYNC_ENGINE_GET_UPDATES_PROCESSOR_H | |
| 7 | |
| 8 #include <map> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/basictypes.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 #include "sync/sessions/model_type_registry.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 GetUpdatesProcessor { | |
| 44 public: | |
| 45 GetUpdatesProcessor(UpdateHandlerMap* update_handler_map); | |
|
Nicolas Zea
2014/01/16 21:08:26
explicit
rlarocque
2014/01/16 21:51:29
Done.
| |
| 46 ~GetUpdatesProcessor(); | |
| 47 | |
| 48 // Populates a GetUpdates request message with per-type information. | |
| 49 void PrepareGetUpdates(ModelTypeSet gu_types, | |
| 50 sync_pb::GetUpdatesMessage* get_updates); | |
| 51 | |
| 52 // Processes a GetUpdates responses for each type. | |
| 53 bool ProcessGetUpdatesResponse( | |
| 54 ModelTypeSet gu_types, | |
| 55 const sync_pb::GetUpdatesResponse& gu_response, | |
| 56 sessions::StatusController* status_controller); | |
| 57 | |
| 58 // Applies pending updates for all sync types known to the manager. | |
| 59 void ApplyUpdatesForAllTypes(sessions::StatusController* status_controller); | |
| 60 | |
| 61 private: | |
| 62 // A map of 'update handlers', one for each enabled type. | |
| 63 // This must be kept in sync with the routing info. Our temporary solution to | |
| 64 // that problem is to initialize this map in set_routing_info(). | |
| 65 UpdateHandlerMap* update_handler_map_; | |
| 66 | |
| 67 DISALLOW_COPY_AND_ASSIGN(GetUpdatesProcessor); | |
| 68 }; | |
| 69 | |
| 70 } // namespace syncer | |
| 71 | |
| 72 #endif // SYNC_ENGINE_GET_UPDATES_PROCESSOR_H_ | |
| OLD | NEW |