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

Side by Side Diff: chrome/browser/sync/backend_migrator.cc

Issue 10832286: sync: Introduce control data types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add ToFullModelTypeSet() function Created 8 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) 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 "chrome/browser/sync/backend_migrator.h" 5 #include "chrome/browser/sync/backend_migrator.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/tracked_objects.h" 9 #include "base/tracked_objects.h"
10 #include "chrome/browser/sync/profile_sync_service.h" 10 #include "chrome/browser/sync/profile_sync_service.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 if (manager_->state() == DataTypeManager::CONFIGURED) { 94 if (manager_->state() == DataTypeManager::CONFIGURED) {
95 RestartMigration(); 95 RestartMigration();
96 return true; 96 return true;
97 } 97 }
98 return false; 98 return false;
99 } 99 }
100 100
101 void BackendMigrator::RestartMigration() { 101 void BackendMigrator::RestartMigration() {
102 // We'll now disable any running types that need to be migrated. 102 // We'll now disable any running types that need to be migrated.
103 ChangeState(DISABLING_TYPES); 103 ChangeState(DISABLING_TYPES);
104 const ModelTypeSet full_set = service_->GetPreferredDataTypes();
105 const ModelTypeSet difference = Difference(full_set, to_migrate_);
106 bool configure_with_nigori = !to_migrate_.Has(syncer::NIGORI);
107 SDVLOG(1) << "BackendMigrator disabling types " 104 SDVLOG(1) << "BackendMigrator disabling types "
108 << ModelTypeSetToString(to_migrate_) << "; configuring " 105 << ModelTypeSetToString(to_migrate_);
109 << ModelTypeSetToString(difference)
110 << (configure_with_nigori ? " with nigori" : " without nigori");
111 106
112 // Add nigori for config or not based upon if the server told us to migrate 107 manager_->PurgeForMigration(to_migrate_, syncer::CONFIGURE_REASON_MIGRATION);
113 // nigori or not.
114 if (configure_with_nigori) {
115 manager_->Configure(difference, syncer::CONFIGURE_REASON_MIGRATION);
116 } else {
117 manager_->ConfigureWithoutNigori(difference,
118 syncer::CONFIGURE_REASON_MIGRATION);
119 }
120 } 108 }
121 109
122 void BackendMigrator::OnConfigureDone( 110 void BackendMigrator::OnConfigureDone(
123 const DataTypeManager::ConfigureResult& result) { 111 const DataTypeManager::ConfigureResult& result) {
124 if (state_ == IDLE) 112 if (state_ == IDLE)
125 return; 113 return;
126 114
127 // |manager_|'s methods aren't re-entrant, and we're notified from 115 // |manager_|'s methods aren't re-entrant, and we're notified from
128 // them, so post a task to avoid problems. 116 // them, so post a task to avoid problems.
129 SDVLOG(1) << "Posting OnConfigureDoneImpl"; 117 SDVLOG(1) << "Posting OnConfigureDoneImpl";
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 216
229 syncer::ModelTypeSet BackendMigrator::GetPendingMigrationTypesForTest() const { 217 syncer::ModelTypeSet BackendMigrator::GetPendingMigrationTypesForTest() const {
230 return to_migrate_; 218 return to_migrate_;
231 } 219 }
232 220
233 #undef SDVLOG 221 #undef SDVLOG
234 222
235 #undef SLOG 223 #undef SLOG
236 224
237 }; // namespace browser_sync 225 }; // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/backend_migrator_unittest.cc » ('j') | sync/internal_api/public/base/model_type.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698