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

Side by Side Diff: chrome/browser/sync/glue/sync_backend_registrar.cc

Issue 7655055: [Sync] Make BackendMigrator not wait for full sync cycles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address more comments Created 9 years, 3 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/sync/glue/sync_backend_registrar.h" 5 #include "chrome/browser/sync/glue/sync_backend_registrar.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 28 matching lines...) Expand all
39 return true; 39 return true;
40 case MODEL_SAFE_GROUP_COUNT: 40 case MODEL_SAFE_GROUP_COUNT:
41 default: 41 default:
42 return false; 42 return false;
43 } 43 }
44 } 44 }
45 45
46 } // namespace 46 } // namespace
47 47
48 SyncBackendRegistrar::SyncBackendRegistrar( 48 SyncBackendRegistrar::SyncBackendRegistrar(
49 const syncable::ModelTypeSet& initial_types, Profile* profile, 49 const syncable::ModelTypeSet& initial_types,
50 const std::string& name, Profile* profile,
50 MessageLoop* sync_loop) : 51 MessageLoop* sync_loop) :
52 name_(name),
51 profile_(profile), 53 profile_(profile),
52 sync_loop_(sync_loop), 54 sync_loop_(sync_loop),
53 ui_worker_(new UIModelWorker()), 55 ui_worker_(new UIModelWorker()),
54 stopped_on_ui_thread_(false) { 56 stopped_on_ui_thread_(false) {
55 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 57 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
56 CHECK(profile_); 58 CHECK(profile_);
57 DCHECK(sync_loop_); 59 DCHECK(sync_loop_);
58 workers_[GROUP_DB] = new DatabaseModelWorker(); 60 workers_[GROUP_DB] = new DatabaseModelWorker();
59 workers_[GROUP_UI] = ui_worker_; 61 workers_[GROUP_UI] = ui_worker_;
60 workers_[GROUP_PASSIVE] = new ModelSafeWorker(); 62 workers_[GROUP_PASSIVE] = new ModelSafeWorker();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // routing_info, if it does not already exist. 132 // routing_info, if it does not already exist.
131 if (routing_info_.count(*it) == 0) { 133 if (routing_info_.count(*it) == 0) {
132 routing_info_[*it] = GROUP_PASSIVE; 134 routing_info_[*it] = GROUP_PASSIVE;
133 newly_added_types.insert(*it); 135 newly_added_types.insert(*it);
134 } 136 }
135 } 137 }
136 for (syncable::ModelTypeSet::const_iterator it = types_to_remove.begin(); 138 for (syncable::ModelTypeSet::const_iterator it = types_to_remove.begin();
137 it != types_to_remove.end(); ++it) { 139 it != types_to_remove.end(); ++it) {
138 routing_info_.erase(*it); 140 routing_info_.erase(*it);
139 } 141 }
142
143 // TODO(akalin): Use SVLOG/SLOG if we add any more logging.
144 VLOG(1) << name_ << ": Adding types "
145 << syncable::ModelTypeSetToString(types_to_add)
146 << " (with newly-added types "
147 << syncable::ModelTypeSetToString(newly_added_types)
148 << ") and removing types "
149 << syncable::ModelTypeSetToString(types_to_remove)
150 << " to get new routing info "
151 << ModelSafeRoutingInfoToString(routing_info_);
152
140 return newly_added_types; 153 return newly_added_types;
141 } 154 }
142 155
143 void SyncBackendRegistrar::StopOnUIThread() { 156 void SyncBackendRegistrar::StopOnUIThread() {
144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 157 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
145 DCHECK(!stopped_on_ui_thread_); 158 DCHECK(!stopped_on_ui_thread_);
146 ui_worker_->Stop(); 159 ui_worker_->Stop();
147 stopped_on_ui_thread_ = true; 160 stopped_on_ui_thread_ = true;
148 } 161 }
149 162
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 } 251 }
239 252
240 bool SyncBackendRegistrar::IsCurrentThreadSafeForModel( 253 bool SyncBackendRegistrar::IsCurrentThreadSafeForModel(
241 syncable::ModelType model_type) const { 254 syncable::ModelType model_type) const {
242 lock_.AssertAcquired(); 255 lock_.AssertAcquired();
243 return IsOnThreadForGroup(GetGroupForModelType(model_type, routing_info_)); 256 return IsOnThreadForGroup(GetGroupForModelType(model_type, routing_info_));
244 } 257 }
245 258
246 } // namespace browser_sync 259 } // namespace browser_sync
247 260
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_registrar.h ('k') | chrome/browser/sync/glue/sync_backend_registrar_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698