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

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

Issue 25638003: sync: Implement per-type commit interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Attempt to fix win compile Created 7 years, 2 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
« no previous file with comments | « sync/sessions/sync_session.h ('k') | sync/sessions/sync_session_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "sync/base/sync_export.h" 26 #include "sync/base/sync_export.h"
27 #include "sync/engine/sync_directory_commit_contributor.h"
26 #include "sync/engine/sync_engine_event.h" 28 #include "sync/engine/sync_engine_event.h"
27 #include "sync/engine/syncer_types.h" 29 #include "sync/engine/syncer_types.h"
28 #include "sync/engine/traffic_recorder.h" 30 #include "sync/engine/traffic_recorder.h"
29 #include "sync/internal_api/public/engine/model_safe_worker.h" 31 #include "sync/internal_api/public/engine/model_safe_worker.h"
30 #include "sync/protocol/sync.pb.h" 32 #include "sync/protocol/sync.pb.h"
31 #include "sync/sessions/debug_info_getter.h" 33 #include "sync/sessions/debug_info_getter.h"
32 34
33 namespace syncer { 35 namespace syncer {
34 36
35 class ExtensionsActivity; 37 class ExtensionsActivity;
(...skipping 28 matching lines...) Expand all
64 return connection_manager_; 66 return connection_manager_;
65 } 67 }
66 syncable::Directory* directory() { 68 syncable::Directory* directory() {
67 return directory_; 69 return directory_;
68 } 70 }
69 71
70 const ModelSafeRoutingInfo& routing_info() const { 72 const ModelSafeRoutingInfo& routing_info() const {
71 return routing_info_; 73 return routing_info_;
72 } 74 }
73 75
74 void set_routing_info(const ModelSafeRoutingInfo& routing_info) { 76 void set_routing_info(const ModelSafeRoutingInfo& routing_info);
75 routing_info_ = routing_info; 77
78 CommitContributorMap* commit_contributor_map() {
79 return &commit_contributor_map_;
76 } 80 }
77 81
78 const std::vector<scoped_refptr<ModelSafeWorker> >& workers() const { 82 const std::vector<scoped_refptr<ModelSafeWorker> >& workers() const {
79 return workers_; 83 return workers_;
80 } 84 }
81 85
82 ExtensionsActivity* extensions_activity() { 86 ExtensionsActivity* extensions_activity() {
83 return extensions_activity_.get(); 87 return extensions_activity_.get();
84 } 88 }
85 89
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 151
148 ObserverList<SyncEngineEventListener> listeners_; 152 ObserverList<SyncEngineEventListener> listeners_;
149 153
150 ServerConnectionManager* const connection_manager_; 154 ServerConnectionManager* const connection_manager_;
151 syncable::Directory* const directory_; 155 syncable::Directory* const directory_;
152 156
153 // A cached copy of SyncBackendRegistrar's routing info. 157 // A cached copy of SyncBackendRegistrar's routing info.
154 // Must be updated manually when SBR's state is modified. 158 // Must be updated manually when SBR's state is modified.
155 ModelSafeRoutingInfo routing_info_; 159 ModelSafeRoutingInfo routing_info_;
156 160
161 // 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
163 // that problem is to initialize this map in set_routing_info().
164 CommitContributorMap commit_contributor_map_;
165
166 // Deleter for the |commit_contributor_map_|.
167 STLValueDeleter<CommitContributorMap> commit_contributor_deleter_;
168
157 // The set of ModelSafeWorkers. Used to execute tasks of various threads. 169 // The set of ModelSafeWorkers. Used to execute tasks of various threads.
158 std::vector<scoped_refptr<ModelSafeWorker> > workers_; 170 std::vector<scoped_refptr<ModelSafeWorker> > workers_;
159 171
160 // We use this to stuff extensions activity into CommitMessages so the server 172 // We use this to stuff extensions activity into CommitMessages so the server
161 // can correlate commit traffic with extension-related bookmark mutations. 173 // can correlate commit traffic with extension-related bookmark mutations.
162 scoped_refptr<ExtensionsActivity> extensions_activity_; 174 scoped_refptr<ExtensionsActivity> extensions_activity_;
163 175
164 // Kept up to date with talk events to determine whether notifications are 176 // Kept up to date with talk events to determine whether notifications are
165 // enabled. True only if the notification channel is authorized and open. 177 // enabled. True only if the notification channel is authorized and open.
166 bool notifications_enabled_; 178 bool notifications_enabled_;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // enable the pre-commit update avoidance experiment described above. 212 // enable the pre-commit update avoidance experiment described above.
201 const bool client_enabled_pre_commit_update_avoidance_; 213 const bool client_enabled_pre_commit_update_avoidance_;
202 214
203 DISALLOW_COPY_AND_ASSIGN(SyncSessionContext); 215 DISALLOW_COPY_AND_ASSIGN(SyncSessionContext);
204 }; 216 };
205 217
206 } // namespace sessions 218 } // namespace sessions
207 } // namespace syncer 219 } // namespace syncer
208 220
209 #endif // SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ 221 #endif // SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_
OLDNEW
« no previous file with comments | « sync/sessions/sync_session.h ('k') | sync/sessions/sync_session_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698