OLD | NEW |
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 28 matching lines...) Expand all Loading... |
39 } | 39 } |
40 | 40 |
41 // Helper macros to log with the syncer thread name; useful when there | 41 // Helper macros to log with the syncer thread name; useful when there |
42 // are multiple syncer threads involved. | 42 // are multiple syncer threads involved. |
43 | 43 |
44 #define SLOG(severity) LOG(severity) << name_ << ": " | 44 #define SLOG(severity) LOG(severity) << name_ << ": " |
45 | 45 |
46 #define SDVLOG(verbose_level) DVLOG(verbose_level) << name_ << ": " | 46 #define SDVLOG(verbose_level) DVLOG(verbose_level) << name_ << ": " |
47 | 47 |
48 void BackendMigrator::MigrateTypes(syncer::ModelTypeSet types) { | 48 void BackendMigrator::MigrateTypes(syncer::ModelTypeSet types) { |
| 49 if (!syncer::Intersection(types, syncer::VirtualTypes()).Empty()) { |
| 50 LOG(WARNING) << "Virtual type migration attempted, dropping local types."; |
| 51 types.RemoveAll(syncer::VirtualTypes()); |
| 52 } |
49 const ModelTypeSet old_to_migrate = to_migrate_; | 53 const ModelTypeSet old_to_migrate = to_migrate_; |
50 to_migrate_.PutAll(types); | 54 to_migrate_.PutAll(types); |
51 SDVLOG(1) << "MigrateTypes called with " << ModelTypeSetToString(types) | 55 SDVLOG(1) << "MigrateTypes called with " << ModelTypeSetToString(types) |
52 << ", old_to_migrate = " << ModelTypeSetToString(old_to_migrate) | 56 << ", old_to_migrate = " << ModelTypeSetToString(old_to_migrate) |
53 << ", to_migrate_ = " << ModelTypeSetToString(to_migrate_); | 57 << ", to_migrate_ = " << ModelTypeSetToString(to_migrate_); |
54 if (old_to_migrate.Equals(to_migrate_)) { | 58 if (old_to_migrate.Equals(to_migrate_)) { |
55 SDVLOG(1) << "MigrateTypes called with no new types; ignoring"; | 59 SDVLOG(1) << "MigrateTypes called with no new types; ignoring"; |
56 return; | 60 return; |
57 } | 61 } |
58 | 62 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 220 |
217 syncer::ModelTypeSet BackendMigrator::GetPendingMigrationTypesForTest() const { | 221 syncer::ModelTypeSet BackendMigrator::GetPendingMigrationTypesForTest() const { |
218 return to_migrate_; | 222 return to_migrate_; |
219 } | 223 } |
220 | 224 |
221 #undef SDVLOG | 225 #undef SDVLOG |
222 | 226 |
223 #undef SLOG | 227 #undef SLOG |
224 | 228 |
225 }; // namespace browser_sync | 229 }; // namespace browser_sync |
OLD | NEW |