OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 // SyncSessionContext encapsulates the contextual information and engine | 5 // SyncSessionContext encapsulates the contextual information and engine |
6 // components specific to a SyncSession. A context is accessible via | 6 // components specific to a SyncSession. A context is accessible via |
7 // a SyncSession so that session SyncerCommands and parts of the engine have | 7 // a SyncSession so that session SyncerCommands and parts of the engine have |
8 // a convenient way to access other parts. In this way it can be thought of as | 8 // a convenient way to access other parts. In this way it can be thought of as |
9 // the surrounding environment for the SyncSession. The components of this | 9 // the surrounding environment for the SyncSession. The components of this |
10 // environment are either valid or not valid for the entire context lifetime, | 10 // environment are either valid or not valid for the entire context lifetime, |
11 // or they are valid for explicitly scoped periods of time by using Scoped | 11 // or they are valid for explicitly scoped periods of time by using Scoped |
12 // installation utilities found below. This means that the context assumes no | 12 // installation utilities found below. This means that the context assumes no |
13 // ownership whatsoever of any object that was not created by the context | 13 // ownership whatsoever of any object that was not created by the context |
14 // itself. | 14 // itself. |
15 // | 15 // |
16 // It can only be used from the SyncerThread. | 16 // It can only be used from the SyncerThread. |
17 | 17 |
18 #ifndef SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ | 18 #ifndef SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ |
19 #define SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ | 19 #define SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ |
20 | 20 |
21 #include <map> | 21 #include <map> |
22 #include <string> | 22 #include <string> |
23 #include <vector> | 23 #include <vector> |
24 | 24 |
25 #include "base/stl_util.h" | 25 #include "base/stl_util.h" |
26 #include "sync/base/sync_export.h" | 26 #include "sync/base/sync_export.h" |
27 #include "sync/engine/sync_directory_commit_contributor.h" | 27 #include "sync/engine/sync_directory_commit_contributor.h" |
28 #include "sync/engine/sync_directory_update_handler.h" | |
28 #include "sync/engine/sync_engine_event.h" | 29 #include "sync/engine/sync_engine_event.h" |
29 #include "sync/engine/syncer_types.h" | 30 #include "sync/engine/syncer_types.h" |
30 #include "sync/engine/traffic_recorder.h" | 31 #include "sync/engine/traffic_recorder.h" |
31 #include "sync/internal_api/public/engine/model_safe_worker.h" | 32 #include "sync/internal_api/public/engine/model_safe_worker.h" |
32 #include "sync/protocol/sync.pb.h" | 33 #include "sync/protocol/sync.pb.h" |
33 #include "sync/sessions/debug_info_getter.h" | 34 #include "sync/sessions/debug_info_getter.h" |
34 | 35 |
35 namespace syncer { | 36 namespace syncer { |
36 | 37 |
37 class ExtensionsActivity; | 38 class ExtensionsActivity; |
(...skipping 30 matching lines...) Expand all Loading... | |
68 syncable::Directory* directory() { | 69 syncable::Directory* directory() { |
69 return directory_; | 70 return directory_; |
70 } | 71 } |
71 | 72 |
72 const ModelSafeRoutingInfo& routing_info() const { | 73 const ModelSafeRoutingInfo& routing_info() const { |
73 return routing_info_; | 74 return routing_info_; |
74 } | 75 } |
75 | 76 |
76 void set_routing_info(const ModelSafeRoutingInfo& routing_info); | 77 void set_routing_info(const ModelSafeRoutingInfo& routing_info); |
77 | 78 |
79 UpdateHandlerMap* update_handler_map() { | |
80 return &update_handler_map_; | |
81 } | |
82 | |
78 CommitContributorMap* commit_contributor_map() { | 83 CommitContributorMap* commit_contributor_map() { |
79 return &commit_contributor_map_; | 84 return &commit_contributor_map_; |
80 } | 85 } |
81 | 86 |
82 const std::vector<scoped_refptr<ModelSafeWorker> >& workers() const { | 87 const std::vector<scoped_refptr<ModelSafeWorker> >& workers() const { |
83 return workers_; | 88 return workers_; |
84 } | 89 } |
85 | 90 |
86 ExtensionsActivity* extensions_activity() { | 91 ExtensionsActivity* extensions_activity() { |
87 return extensions_activity_.get(); | 92 return extensions_activity_.get(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 ServerConnectionManager* const connection_manager_; | 159 ServerConnectionManager* const connection_manager_; |
155 syncable::Directory* const directory_; | 160 syncable::Directory* const directory_; |
156 | 161 |
157 // A cached copy of SyncBackendRegistrar's routing info. | 162 // A cached copy of SyncBackendRegistrar's routing info. |
158 // Must be updated manually when SBR's state is modified. | 163 // Must be updated manually when SBR's state is modified. |
159 ModelSafeRoutingInfo routing_info_; | 164 ModelSafeRoutingInfo routing_info_; |
160 | 165 |
161 // A map of 'commit contributors', one for each enabled type. | 166 // A map of 'commit contributors', one for each enabled type. |
162 // This must be kept in sync with the routing info. Our temporary solution to | 167 // This must be kept in sync with the routing info. Our temporary solution to |
163 // that problem is to initialize this map in set_routing_info(). | 168 // that problem is to initialize this map in set_routing_info(). |
169 UpdateHandlerMap update_handler_map_; | |
170 | |
171 // Deleter for the |commit_contributor_map_|. | |
Nicolas Zea
2013/10/29 22:50:18
update comment
rlarocque
2013/10/30 00:32:22
Done.
| |
172 STLValueDeleter<UpdateHandlerMap> update_handler_deleter_; | |
173 | |
174 // A map of 'commit contributors', one for each enabled type. | |
175 // This must be kept in sync with the routing info. Our temporary solution to | |
176 // that problem is to initialize this map in set_routing_info(). | |
164 CommitContributorMap commit_contributor_map_; | 177 CommitContributorMap commit_contributor_map_; |
165 | 178 |
166 // Deleter for the |commit_contributor_map_|. | 179 // Deleter for the |commit_contributor_map_|. |
167 STLValueDeleter<CommitContributorMap> commit_contributor_deleter_; | 180 STLValueDeleter<CommitContributorMap> commit_contributor_deleter_; |
168 | 181 |
169 // The set of ModelSafeWorkers. Used to execute tasks of various threads. | 182 // The set of ModelSafeWorkers. Used to execute tasks of various threads. |
170 std::vector<scoped_refptr<ModelSafeWorker> > workers_; | 183 std::vector<scoped_refptr<ModelSafeWorker> > workers_; |
171 | 184 |
172 // We use this to stuff extensions activity into CommitMessages so the server | 185 // We use this to stuff extensions activity into CommitMessages so the server |
173 // can correlate commit traffic with extension-related bookmark mutations. | 186 // can correlate commit traffic with extension-related bookmark mutations. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 // enable the pre-commit update avoidance experiment described above. | 225 // enable the pre-commit update avoidance experiment described above. |
213 const bool client_enabled_pre_commit_update_avoidance_; | 226 const bool client_enabled_pre_commit_update_avoidance_; |
214 | 227 |
215 DISALLOW_COPY_AND_ASSIGN(SyncSessionContext); | 228 DISALLOW_COPY_AND_ASSIGN(SyncSessionContext); |
216 }; | 229 }; |
217 | 230 |
218 } // namespace sessions | 231 } // namespace sessions |
219 } // namespace syncer | 232 } // namespace syncer |
220 | 233 |
221 #endif // SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ | 234 #endif // SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ |
OLD | NEW |