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

Side by Side Diff: sync/sessions/model_type_registry.h

Issue 351523003: sync: Mass rename of non-blocking sync classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix some comments Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
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_MODEL_TYPE_REGISTRY_H_ 5 #ifndef SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_
6 #define SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_ 6 #define SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
13 #include "sync/base/sync_export.h" 13 #include "sync/base/sync_export.h"
14 #include "sync/internal_api/public/base/model_type.h" 14 #include "sync/internal_api/public/base/model_type.h"
15 #include "sync/internal_api/public/engine/model_safe_worker.h" 15 #include "sync/internal_api/public/engine/model_safe_worker.h"
16 #include "sync/internal_api/public/sessions/type_debug_info_observer.h" 16 #include "sync/internal_api/public/sessions/type_debug_info_observer.h"
17 17
18 namespace syncer { 18 namespace syncer {
19 19
20 namespace syncable { 20 namespace syncable {
21 class Directory; 21 class Directory;
22 } // namespace syncable 22 } // namespace syncable
23 23
24 class CommitContributor; 24 class CommitContributor;
25 class DirectoryCommitContributor; 25 class DirectoryCommitContributor;
26 class DirectoryUpdateHandler; 26 class DirectoryUpdateHandler;
27 class DirectoryTypeDebugInfoEmitter; 27 class DirectoryTypeDebugInfoEmitter;
28 class NonBlockingTypeProcessorCore; 28 class ModelTypeSyncWorkerImpl;
29 class NonBlockingTypeProcessor; 29 class ModelTypeSyncProxyImpl;
30 class UpdateHandler; 30 class UpdateHandler;
31 struct DataTypeState; 31 struct DataTypeState;
32 32
33 typedef std::map<ModelType, UpdateHandler*> UpdateHandlerMap; 33 typedef std::map<ModelType, UpdateHandler*> UpdateHandlerMap;
34 typedef std::map<ModelType, CommitContributor*> CommitContributorMap; 34 typedef std::map<ModelType, CommitContributor*> CommitContributorMap;
35 typedef std::map<ModelType, DirectoryTypeDebugInfoEmitter*> 35 typedef std::map<ModelType, DirectoryTypeDebugInfoEmitter*>
36 DirectoryTypeDebugInfoEmitterMap; 36 DirectoryTypeDebugInfoEmitterMap;
37 37
38 // Keeps track of the sets of active update handlers and commit contributors. 38 // Keeps track of the sets of active update handlers and commit contributors.
39 class SYNC_EXPORT_PRIVATE ModelTypeRegistry { 39 class SYNC_EXPORT_PRIVATE ModelTypeRegistry {
40 public: 40 public:
41 // This alternative constructor does not support any directory types. 41 // This alternative constructor does not support any directory types.
42 // It is used only in tests. 42 // It is used only in tests.
43 ModelTypeRegistry(); 43 ModelTypeRegistry();
44 44
45 // Constructs a ModelTypeRegistry that supports directory types. 45 // Constructs a ModelTypeRegistry that supports directory types.
46 ModelTypeRegistry( 46 ModelTypeRegistry(
47 const std::vector<scoped_refptr<ModelSafeWorker> >& workers, 47 const std::vector<scoped_refptr<ModelSafeWorker> >& workers,
48 syncable::Directory* directory); 48 syncable::Directory* directory);
49 ~ModelTypeRegistry(); 49 ~ModelTypeRegistry();
50 50
51 // Sets the set of enabled types. 51 // Sets the set of enabled types.
52 void SetEnabledDirectoryTypes(const ModelSafeRoutingInfo& routing_info); 52 void SetEnabledDirectoryTypes(const ModelSafeRoutingInfo& routing_info);
53 53
54 // Enables an off-thread type for syncing. Connects the given processor 54 // Enables an off-thread type for syncing. Connects the given proxy
55 // and its task_runner to the newly created processor core. 55 // and its task_runner to the newly created worker.
56 // 56 //
57 // Expects that the processor's ModelType is not currently enabled. 57 // Expects that the proxy's ModelType is not currently enabled.
58 void InitializeNonBlockingType( 58 void InitializeNonBlockingType(
59 syncer::ModelType type, 59 syncer::ModelType type,
60 const DataTypeState& data_type_state, 60 const DataTypeState& data_type_state,
61 scoped_refptr<base::SequencedTaskRunner> type_task_runner, 61 scoped_refptr<base::SequencedTaskRunner> type_task_runner,
62 base::WeakPtr<NonBlockingTypeProcessor> processor); 62 base::WeakPtr<ModelTypeSyncProxyImpl> proxy);
Nicolas Zea 2014/06/24 22:42:48 const ref for both
rlarocque 2014/06/24 23:08:33 Done.
63 63
64 // Disables the syncing of an off-thread type. 64 // Disables the syncing of an off-thread type.
65 // 65 //
66 // Expects that the type is currently enabled. 66 // Expects that the type is currently enabled.
67 // Deletes the processor core associated with the type. 67 // Deletes the worker associated with the type.
68 void RemoveNonBlockingType(syncer::ModelType type); 68 void RemoveNonBlockingType(syncer::ModelType type);
69 69
70 // Gets the set of enabled types. 70 // Gets the set of enabled types.
71 ModelTypeSet GetEnabledTypes() const; 71 ModelTypeSet GetEnabledTypes() const;
72 72
73 // Simple getters. 73 // Simple getters.
74 UpdateHandlerMap* update_handler_map(); 74 UpdateHandlerMap* update_handler_map();
75 CommitContributorMap* commit_contributor_map(); 75 CommitContributorMap* commit_contributor_map();
76 DirectoryTypeDebugInfoEmitterMap* directory_type_debug_info_emitter_map(); 76 DirectoryTypeDebugInfoEmitterMap* directory_type_debug_info_emitter_map();
77 77
78 void RegisterDirectoryTypeDebugInfoObserver( 78 void RegisterDirectoryTypeDebugInfoObserver(
79 syncer::TypeDebugInfoObserver* observer); 79 syncer::TypeDebugInfoObserver* observer);
80 void UnregisterDirectoryTypeDebugInfoObserver( 80 void UnregisterDirectoryTypeDebugInfoObserver(
81 syncer::TypeDebugInfoObserver* observer); 81 syncer::TypeDebugInfoObserver* observer);
82 bool HasDirectoryTypeDebugInfoObserver( 82 bool HasDirectoryTypeDebugInfoObserver(
83 syncer::TypeDebugInfoObserver* observer); 83 syncer::TypeDebugInfoObserver* observer);
84 void RequestEmitDebugInfo(); 84 void RequestEmitDebugInfo();
85 85
86 private: 86 private:
87 ModelTypeSet GetEnabledNonBlockingTypes() const; 87 ModelTypeSet GetEnabledNonBlockingTypes() const;
88 ModelTypeSet GetEnabledDirectoryTypes() const; 88 ModelTypeSet GetEnabledDirectoryTypes() const;
89 89
90 // Sets of handlers and contributors. 90 // Sets of handlers and contributors.
91 ScopedVector<DirectoryCommitContributor> directory_commit_contributors_; 91 ScopedVector<DirectoryCommitContributor> directory_commit_contributors_;
92 ScopedVector<DirectoryUpdateHandler> directory_update_handlers_; 92 ScopedVector<DirectoryUpdateHandler> directory_update_handlers_;
93 ScopedVector<DirectoryTypeDebugInfoEmitter> 93 ScopedVector<DirectoryTypeDebugInfoEmitter>
94 directory_type_debug_info_emitters_; 94 directory_type_debug_info_emitters_;
95 95
96 ScopedVector<NonBlockingTypeProcessorCore> non_blocking_type_processor_cores_; 96 ScopedVector<ModelTypeSyncWorkerImpl> model_type_sync_workers_;
97 97
98 // Maps of UpdateHandlers and CommitContributors. 98 // Maps of UpdateHandlers and CommitContributors.
99 // They do not own any of the objects they point to. 99 // They do not own any of the objects they point to.
100 UpdateHandlerMap update_handler_map_; 100 UpdateHandlerMap update_handler_map_;
101 CommitContributorMap commit_contributor_map_; 101 CommitContributorMap commit_contributor_map_;
102 102
103 // Map of DebugInfoEmitters for directory types. 103 // Map of DebugInfoEmitters for directory types.
104 // Non-blocking types handle debug info differently. 104 // Non-blocking types handle debug info differently.
105 // Does not own its contents. 105 // Does not own its contents.
106 DirectoryTypeDebugInfoEmitterMap directory_type_debug_info_emitter_map_; 106 DirectoryTypeDebugInfoEmitterMap directory_type_debug_info_emitter_map_;
(...skipping 15 matching lines...) Expand all
122 // guaranteed to live as long as this sync backend. 122 // guaranteed to live as long as this sync backend.
123 ObserverList<TypeDebugInfoObserver> type_debug_info_observers_; 123 ObserverList<TypeDebugInfoObserver> type_debug_info_observers_;
124 124
125 DISALLOW_COPY_AND_ASSIGN(ModelTypeRegistry); 125 DISALLOW_COPY_AND_ASSIGN(ModelTypeRegistry);
126 }; 126 };
127 127
128 } // namespace syncer 128 } // namespace syncer
129 129
130 #endif // SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_ 130 #endif // SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_
131 131
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698