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

Side by Side Diff: sync/api/model_type_service.h

Issue 1763953002: [USS] Change the place where SharedModelTypeProcessor got created (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_API_MODEL_TYPE_SERVICE_H_ 5 #ifndef SYNC_API_MODEL_TYPE_SERVICE_H_
6 #define SYNC_API_MODEL_TYPE_SERVICE_H_ 6 #define SYNC_API_MODEL_TYPE_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "sync/api/entity_change.h" 13 #include "sync/api/entity_change.h"
14 #include "sync/api/entity_data.h" 14 #include "sync/api/entity_data.h"
15 #include "sync/api/model_type_change_processor.h" 15 #include "sync/api/model_type_change_processor.h"
16 #include "sync/api/sync_error.h" 16 #include "sync/api/sync_error.h"
17 #include "sync/base/sync_export.h" 17 #include "sync/base/sync_export.h"
18 18
19 namespace syncer_v2 { 19 namespace syncer_v2 {
20 20
21 class DataBatch; 21 class DataBatch;
22 class MetadataChangeList; 22 class MetadataChangeList;
23 class SharedModelTypeProcessor;
23 24
24 // Interface implemented by model types to receive updates from sync via the 25 // Interface implemented by model types to receive updates from sync via the
25 // SharedModelTypeProcessor. Provides a way for sync to update the data and 26 // SharedModelTypeProcessor. Provides a way for sync to update the data and
26 // metadata for entities, as well as the model type state. 27 // metadata for entities, as well as the model type state.
27 class SYNC_EXPORT ModelTypeService { 28 class SYNC_EXPORT ModelTypeService {
28 public: 29 public:
29 typedef base::Callback<void(syncer::SyncError, scoped_ptr<DataBatch>)> 30 typedef base::Callback<void(syncer::SyncError, scoped_ptr<DataBatch>)>
30 DataCallback; 31 DataCallback;
31 typedef std::vector<std::string> ClientTagList; 32 typedef std::vector<std::string> ClientTagList;
32 33
(...skipping 30 matching lines...) Expand all
63 virtual std::string GetClientTag(const EntityData& entity_data) = 0; 64 virtual std::string GetClientTag(const EntityData& entity_data) = 0;
64 65
65 // Overridable notification for when the processor is set. This is typically 66 // Overridable notification for when the processor is set. This is typically
66 // when the service should start loading metadata and then subsequently giving 67 // when the service should start loading metadata and then subsequently giving
67 // it to the processor. 68 // it to the processor.
68 virtual void OnChangeProcessorSet() = 0; 69 virtual void OnChangeProcessorSet() = 0;
69 70
70 // TODO(skym): See crbug/547087, do we need all these accessors? 71 // TODO(skym): See crbug/547087, do we need all these accessors?
71 ModelTypeChangeProcessor* change_processor() const; 72 ModelTypeChangeProcessor* change_processor() const;
72 73
73 void set_change_processor( 74 // The function will create SharedModelTypeProcessor and send
74 scoped_ptr<ModelTypeChangeProcessor> change_processor); 75 // notification(OnChangeProcessorSet).
76 void InitializeProcessor(syncer::ModelType type);
75 77
76 void clear_change_processor(); 78 void clear_change_processor();
77 79
80 protected:
81 // The function will create SharedModelTypeProcessor.
82 virtual scoped_ptr<SharedModelTypeProcessor> CreateSharedModelTypeProcessor(
skym 2016/03/04 22:12:28 Overriding virtual methods for so tests can inject
Gang Wu 2016/03/08 20:35:25 Done.
83 syncer::ModelType type);
84
78 private: 85 private:
79 // Recieves ownership in set_change_processor(...). 86 // Recieves ownership in set_change_processor(...).
80 scoped_ptr<ModelTypeChangeProcessor> change_processor_; 87 scoped_ptr<ModelTypeChangeProcessor> change_processor_;
81 }; 88 };
82 89
83 } // namespace syncer_v2 90 } // namespace syncer_v2
84 91
85 #endif // SYNC_API_MODEL_TYPE_SERVICE_H_ 92 #endif // SYNC_API_MODEL_TYPE_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698