Index: sync/engine/updater_list.h |
diff --git a/sync/engine/updater_list.h b/sync/engine/updater_list.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..40f0b70e6f9a6fa0139d22127bc59c5d47c4f012 |
--- /dev/null |
+++ b/sync/engine/updater_list.h |
@@ -0,0 +1,82 @@ |
+// 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.
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef SYNC_ENGINE_UPDATER_LIST_H_ |
+#define SYNC_ENGINE_UPDATER_LIST_H_ |
+ |
+#include <map> |
+#include <vector> |
+ |
+#include "base/basictypes.h" |
+#include "base/stl_util.h" |
+#include "sync/base/sync_export.h" |
+#include "sync/internal_api/public/base/model_type.h" |
+#include "sync/internal_api/public/engine/model_safe_worker.h" |
+ |
+namespace sync_pb { |
+class GetUpdatesMessage; |
+class GetUpdatesResponse; |
+} // namespace sync_pb |
+ |
+namespace syncer { |
+ |
+namespace sessions { |
+class StatusController; |
+} // namespace sessions |
+ |
+namespace syncable { |
+class Directory; |
+} // namespace syncable |
+ |
+class SyncDirectoryUpdateHandler; |
+ |
+typedef std::vector<const sync_pb::SyncEntity*> SyncEntityList; |
+typedef std::map<ModelType, SyncEntityList> TypeSyncEntityMap; |
+ |
+// This class manages the set of per-type syncer objects. |
+// |
+// It owns these types and hides the details of iterating over all of them. |
+// Most methods allow the caller to specify a subset of types on which the |
+// operation is to be applied. It is a logic error if the supplied set of types |
+// contains a type which was not previously registered with the manager. |
+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
|
+ public: |
+ UpdaterList(); |
+ ~UpdaterList(); |
+ |
+ // Registers an update handler directly. |
+ void RegisterType( |
+ ModelType type, |
+ SyncDirectoryUpdateHandler* handler); |
+ |
+ // Populates a GetUpdates request message with per-type information. |
+ void PrepareGetUpdates(ModelTypeSet gu_types, |
+ sync_pb::GetUpdatesMessage* get_updates); |
+ |
+ // Processes a GetUpdates responses for each type. |
+ bool ProcessGetUpdatesResponse( |
+ ModelTypeSet gu_types, |
+ const sync_pb::GetUpdatesResponse& gu_response, |
+ sessions::StatusController* status_controller); |
+ |
+ // Applies pending updates for all sync types known to the manager. |
+ void ApplyUpdatesForAllTypes(sessions::StatusController* status_controller); |
+ |
+ private: |
+ typedef std::map<ModelType, SyncDirectoryUpdateHandler*> UpdateHandlerMap; |
+ |
+ // A map of 'update handlers', one for each enabled type. |
+ // This must be kept in sync with the routing info. Our temporary solution to |
+ // that problem is to initialize this map in set_routing_info(). |
+ UpdateHandlerMap update_handler_map_; |
+ |
+ // Deleter for the |update_handler_map_|. |
+ STLValueDeleter<UpdateHandlerMap> update_handler_deleter_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(UpdaterList); |
+}; |
+ |
+} // namespace syncer |
+ |
+#endif // SYNC_ENGINE_UPDATER_LIST_H_ |