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 SYNC_ENGINE_DIRECTORY_UPDATE_HANDLER_H_ | 5 #ifndef SYNC_ENGINE_DIRECTORY_UPDATE_HANDLER_H_ |
6 #define SYNC_ENGINE_DIRECTORY_UPDATE_HANDLER_H_ | 6 #define SYNC_ENGINE_DIRECTORY_UPDATE_HANDLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // Each instance of this class represents a particular type in the | 40 // Each instance of this class represents a particular type in the |
41 // syncable::Directory. It can store and retreive that type's progress markers. | 41 // syncable::Directory. It can store and retreive that type's progress markers. |
42 // It can also process a set of received SyncEntities and store their data. | 42 // It can also process a set of received SyncEntities and store their data. |
43 class SYNC_EXPORT_PRIVATE DirectoryUpdateHandler : public UpdateHandler { | 43 class SYNC_EXPORT_PRIVATE DirectoryUpdateHandler : public UpdateHandler { |
44 public: | 44 public: |
45 DirectoryUpdateHandler(syncable::Directory* dir, | 45 DirectoryUpdateHandler(syncable::Directory* dir, |
46 ModelType type, | 46 ModelType type, |
47 scoped_refptr<ModelSafeWorker> worker); | 47 scoped_refptr<ModelSafeWorker> worker); |
48 virtual ~DirectoryUpdateHandler(); | 48 virtual ~DirectoryUpdateHandler(); |
49 | 49 |
50 // Fills the given parameter with the stored progress marker for this type. | 50 // UpdateHandler implementation. |
51 virtual void GetDownloadProgress( | 51 virtual void GetDownloadProgress( |
52 sync_pb::DataTypeProgressMarker* progress_marker) const OVERRIDE; | 52 sync_pb::DataTypeProgressMarker* progress_marker) const OVERRIDE; |
53 | 53 virtual void GetDataTypeContext( |
54 // Processes the contents of a GetUpdates response message. | 54 sync_pb::DataTypeContext* context) const OVERRIDE; |
55 // | |
56 // Should be invoked with the progress marker and set of SyncEntities from a | |
57 // single GetUpdates response message. The progress marker's type must match | |
58 // this update handler's type, and the set of SyncEntities must include all | |
59 // entities of this type found in the response message. | |
60 virtual void ProcessGetUpdatesResponse( | 55 virtual void ProcessGetUpdatesResponse( |
61 const sync_pb::DataTypeProgressMarker& progress_marker, | 56 const sync_pb::DataTypeProgressMarker& progress_marker, |
62 const SyncEntityList& applicable_updates, | 57 const SyncEntityList& applicable_updates, |
63 sessions::StatusController* status) OVERRIDE; | 58 sessions::StatusController* status) OVERRIDE; |
64 | 59 virtual void ProcessDataTypeContextMutation( |
65 // If there are updates to apply, apply them on the proper thread. | 60 const sync_pb::DataTypeContext& mutated_context) OVERRIDE; |
66 // Delegates to ApplyUpdatesImpl(). | |
67 virtual void ApplyUpdates(sessions::StatusController* status) OVERRIDE; | 61 virtual void ApplyUpdates(sessions::StatusController* status) OVERRIDE; |
68 | |
69 // Apply updates on the sync thread. This is for use during initial sync | |
70 // prior to model association. | |
71 virtual void PassiveApplyUpdates(sessions::StatusController* status) OVERRIDE; | 62 virtual void PassiveApplyUpdates(sessions::StatusController* status) OVERRIDE; |
72 | 63 |
73 private: | 64 private: |
74 friend class DirectoryUpdateHandlerApplyUpdateTest; | 65 friend class DirectoryUpdateHandlerApplyUpdateTest; |
75 friend class DirectoryUpdateHandlerProcessUpdateTest; | 66 friend class DirectoryUpdateHandlerProcessUpdateTest; |
76 | 67 |
77 // Sometimes there is nothing to do, so we can return without doing anything. | 68 // Sometimes there is nothing to do, so we can return without doing anything. |
78 bool IsApplyUpdatesRequired(); | 69 bool IsApplyUpdatesRequired(); |
79 | 70 |
80 // Processes the given SyncEntities and stores their data in the directory. | 71 // Processes the given SyncEntities and stores their data in the directory. |
(...skipping 24 matching lines...) Expand all Loading... |
105 scoped_refptr<ModelSafeWorker> worker_; | 96 scoped_refptr<ModelSafeWorker> worker_; |
106 | 97 |
107 scoped_ptr<sync_pb::GarbageCollectionDirective> cached_gc_directive_; | 98 scoped_ptr<sync_pb::GarbageCollectionDirective> cached_gc_directive_; |
108 | 99 |
109 DISALLOW_COPY_AND_ASSIGN(DirectoryUpdateHandler); | 100 DISALLOW_COPY_AND_ASSIGN(DirectoryUpdateHandler); |
110 }; | 101 }; |
111 | 102 |
112 } // namespace syncer | 103 } // namespace syncer |
113 | 104 |
114 #endif // SYNC_ENGINE_DIRECTORY_UPDATE_HANDLER_H_ | 105 #endif // SYNC_ENGINE_DIRECTORY_UPDATE_HANDLER_H_ |
OLD | NEW |