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

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

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_context.h ('k') | sync/sync_core.gypi » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "sync/sessions/sync_session_context.h" 5 #include "sync/sessions/sync_session_context.h"
6 6
7 #include "sync/sessions/debug_info_getter.h" 7 #include "sync/sessions/debug_info_getter.h"
8 #include "sync/util/extensions_activity.h" 8 #include "sync/util/extensions_activity.h"
9 9
10 namespace syncer { 10 namespace syncer {
11 namespace sessions { 11 namespace sessions {
12 12
13 SyncSessionContext::SyncSessionContext( 13 SyncSessionContext::SyncSessionContext(
14 ServerConnectionManager* connection_manager, 14 ServerConnectionManager* connection_manager,
15 syncable::Directory* directory, 15 syncable::Directory* directory,
16 const std::vector<ModelSafeWorker*>& workers, 16 const std::vector<ModelSafeWorker*>& workers,
17 ExtensionsActivity* extensions_activity, 17 ExtensionsActivity* extensions_activity,
18 const std::vector<SyncEngineEventListener*>& listeners, 18 const std::vector<SyncEngineEventListener*>& listeners,
19 DebugInfoGetter* debug_info_getter, 19 DebugInfoGetter* debug_info_getter,
20 TrafficRecorder* traffic_recorder, 20 TrafficRecorder* traffic_recorder,
21 bool keystore_encryption_enabled, 21 bool keystore_encryption_enabled,
22 bool client_enabled_pre_commit_update_avoidance, 22 bool client_enabled_pre_commit_update_avoidance,
23 const std::string& invalidator_client_id) 23 const std::string& invalidator_client_id)
24 : connection_manager_(connection_manager), 24 : connection_manager_(connection_manager),
25 directory_(directory), 25 directory_(directory),
26 commit_contributor_deleter_(&commit_contributor_map_),
26 extensions_activity_(extensions_activity), 27 extensions_activity_(extensions_activity),
27 notifications_enabled_(false), 28 notifications_enabled_(false),
28 max_commit_batch_size_(kDefaultMaxCommitBatchSize), 29 max_commit_batch_size_(kDefaultMaxCommitBatchSize),
29 debug_info_getter_(debug_info_getter), 30 debug_info_getter_(debug_info_getter),
30 traffic_recorder_(traffic_recorder), 31 traffic_recorder_(traffic_recorder),
31 keystore_encryption_enabled_(keystore_encryption_enabled), 32 keystore_encryption_enabled_(keystore_encryption_enabled),
32 invalidator_client_id_(invalidator_client_id), 33 invalidator_client_id_(invalidator_client_id),
33 server_enabled_pre_commit_update_avoidance_(false), 34 server_enabled_pre_commit_update_avoidance_(false),
34 client_enabled_pre_commit_update_avoidance_( 35 client_enabled_pre_commit_update_avoidance_(
35 client_enabled_pre_commit_update_avoidance) { 36 client_enabled_pre_commit_update_avoidance) {
36 for (size_t i = 0u; i < workers.size(); ++i) 37 for (size_t i = 0u; i < workers.size(); ++i)
37 workers_.push_back(workers[i]); 38 workers_.push_back(workers[i]);
38 39
39 std::vector<SyncEngineEventListener*>::const_iterator it; 40 std::vector<SyncEngineEventListener*>::const_iterator it;
40 for (it = listeners.begin(); it != listeners.end(); ++it) 41 for (it = listeners.begin(); it != listeners.end(); ++it)
41 listeners_.AddObserver(*it); 42 listeners_.AddObserver(*it);
42 } 43 }
43 44
44 SyncSessionContext::~SyncSessionContext() { 45 SyncSessionContext::~SyncSessionContext() {
45 } 46 }
46 47
48 void SyncSessionContext::set_routing_info(
49 const ModelSafeRoutingInfo& routing_info) {
50 routing_info_ = routing_info;
51
52 // TODO(rlarocque): This is not a good long-term solution. We must find a
53 // better way to initialize the set of CommitContributors.
54 STLDeleteValues<CommitContributorMap>(&commit_contributor_map_);
55 ModelTypeSet enabled_types = GetRoutingInfoTypes(routing_info);
56 for (ModelTypeSet::Iterator it = enabled_types.First(); it.Good(); it.Inc()) {
57 SyncDirectoryCommitContributor* contributor =
58 new SyncDirectoryCommitContributor(directory(), it.Get());
59 commit_contributor_map_.insert(std::make_pair(it.Get(), contributor));
60 }
61 }
62
47 } // namespace sessions 63 } // namespace sessions
48 } // namespace syncer 64 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/sessions/sync_session_context.h ('k') | sync/sync_core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698