OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_DIRECTORY_UPDATE_HANDLER_H_ | 5 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_DIRECTORY_UPDATE_HANDLER_H_ |
6 #define COMPONENTS_SYNC_ENGINE_IMPL_DIRECTORY_UPDATE_HANDLER_H_ | 6 #define COMPONENTS_SYNC_ENGINE_IMPL_DIRECTORY_UPDATE_HANDLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "components/sync/base/model_type.h" | 13 #include "components/sync/base/model_type.h" |
14 #include "components/sync/base/syncer_error.h" | 14 #include "components/sync/base/syncer_error.h" |
15 #include "components/sync/engine_impl/process_updates_util.h" | 15 #include "components/sync/engine_impl/process_updates_util.h" |
16 #include "components/sync/engine_impl/update_handler.h" | 16 #include "components/sync/engine_impl/update_handler.h" |
17 | 17 |
18 namespace sync_pb { | 18 namespace sync_pb { |
19 class DataTypeProgressMarker; | 19 class DataTypeProgressMarker; |
20 class GarbageCollectionDirective; | 20 class GarbageCollectionDirective; |
21 class GetUpdatesResponse; | 21 class GetUpdatesResponse; |
22 } | 22 } |
23 | 23 |
24 namespace syncer { | 24 namespace syncer { |
25 | 25 |
26 class DirectoryTypeDebugInfoEmitter; | 26 class DataTypeDebugInfoEmitter; |
27 class ModelSafeWorker; | 27 class ModelSafeWorker; |
28 class StatusController; | 28 class StatusController; |
29 | 29 |
30 namespace syncable { | 30 namespace syncable { |
31 class Directory; | 31 class Directory; |
32 } | 32 } |
33 | 33 |
34 // This class represents the syncable::Directory's processes for requesting and | 34 // This class represents the syncable::Directory's processes for requesting and |
35 // processing updates from the sync server. | 35 // processing updates from the sync server. |
36 // | 36 // |
37 // Each instance of this class represents a particular type in the | 37 // Each instance of this class represents a particular type in the |
38 // syncable::Directory. It can store and retreive that type's progress markers. | 38 // syncable::Directory. It can store and retreive that type's progress markers. |
39 // It can also process a set of received SyncEntities and store their data. | 39 // It can also process a set of received SyncEntities and store their data. |
40 class DirectoryUpdateHandler : public UpdateHandler { | 40 class DirectoryUpdateHandler : public UpdateHandler { |
41 public: | 41 public: |
42 DirectoryUpdateHandler(syncable::Directory* dir, | 42 DirectoryUpdateHandler(syncable::Directory* dir, |
43 ModelType type, | 43 ModelType type, |
44 scoped_refptr<ModelSafeWorker> worker, | 44 scoped_refptr<ModelSafeWorker> worker, |
45 DirectoryTypeDebugInfoEmitter* debug_info_emitter); | 45 DataTypeDebugInfoEmitter* debug_info_emitter); |
46 ~DirectoryUpdateHandler() override; | 46 ~DirectoryUpdateHandler() override; |
47 | 47 |
48 // UpdateHandler implementation. | 48 // UpdateHandler implementation. |
49 bool IsInitialSyncEnded() const override; | 49 bool IsInitialSyncEnded() const override; |
50 void GetDownloadProgress( | 50 void GetDownloadProgress( |
51 sync_pb::DataTypeProgressMarker* progress_marker) const override; | 51 sync_pb::DataTypeProgressMarker* progress_marker) const override; |
52 void GetDataTypeContext(sync_pb::DataTypeContext* context) const override; | 52 void GetDataTypeContext(sync_pb::DataTypeContext* context) const override; |
53 SyncerError ProcessGetUpdatesResponse( | 53 SyncerError ProcessGetUpdatesResponse( |
54 const sync_pb::DataTypeProgressMarker& progress_marker, | 54 const sync_pb::DataTypeProgressMarker& progress_marker, |
55 const sync_pb::DataTypeContext& mutated_context, | 55 const sync_pb::DataTypeContext& mutated_context, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 // Skips all checks and goes straight to applying the updates. | 92 // Skips all checks and goes straight to applying the updates. |
93 SyncerError ApplyUpdatesImpl(StatusController* status); | 93 SyncerError ApplyUpdatesImpl(StatusController* status); |
94 | 94 |
95 // Creates root node for the handled model type. | 95 // Creates root node for the handled model type. |
96 void CreateTypeRoot(syncable::ModelNeutralWriteTransaction* trans); | 96 void CreateTypeRoot(syncable::ModelNeutralWriteTransaction* trans); |
97 | 97 |
98 syncable::Directory* dir_; | 98 syncable::Directory* dir_; |
99 ModelType type_; | 99 ModelType type_; |
100 scoped_refptr<ModelSafeWorker> worker_; | 100 scoped_refptr<ModelSafeWorker> worker_; |
101 DirectoryTypeDebugInfoEmitter* debug_info_emitter_; | 101 DataTypeDebugInfoEmitter* debug_info_emitter_; |
102 | 102 |
103 std::unique_ptr<sync_pb::GarbageCollectionDirective> cached_gc_directive_; | 103 std::unique_ptr<sync_pb::GarbageCollectionDirective> cached_gc_directive_; |
104 | 104 |
105 DISALLOW_COPY_AND_ASSIGN(DirectoryUpdateHandler); | 105 DISALLOW_COPY_AND_ASSIGN(DirectoryUpdateHandler); |
106 }; | 106 }; |
107 | 107 |
108 } // namespace syncer | 108 } // namespace syncer |
109 | 109 |
110 #endif // COMPONENTS_SYNC_ENGINE_IMPL_DIRECTORY_UPDATE_HANDLER_H_ | 110 #endif // COMPONENTS_SYNC_ENGINE_IMPL_DIRECTORY_UPDATE_HANDLER_H_ |
OLD | NEW |