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

Side by Side Diff: components/sync/driver/backend_migrator.h

Issue 2203673002: [Sync] Move //components/sync_driver to //components/sync/driver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sd-a
Patch Set: Full change rebased on static lib. Created 4 years, 4 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
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 #ifndef COMPONENTS_SYNC_DRIVER_BACKEND_MIGRATOR_H_ 5 #ifndef COMPONENTS_SYNC_DRIVER_BACKEND_MIGRATOR_H_
6 #define COMPONENTS_SYNC_DRIVER_BACKEND_MIGRATOR_H_ 6 #define COMPONENTS_SYNC_DRIVER_BACKEND_MIGRATOR_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "components/sync/base/model_type.h" 14 #include "components/sync/base/model_type.h"
15 #include "components/sync_driver/data_type_manager.h" 15 #include "components/sync/driver/data_type_manager.h"
16 16
17 namespace syncer { 17 namespace syncer {
18 struct UserShare; 18 struct UserShare;
19 } // namespace syncer 19 } // namespace syncer
20 20
21 namespace sync_driver { 21 namespace sync_driver {
22 class SyncService; 22 class SyncService;
23 } 23 }
24 24
25 namespace browser_sync { 25 namespace browser_sync {
26 26
27 // Interface for anything that wants to know when the migrator's state 27 // Interface for anything that wants to know when the migrator's state
28 // changes. 28 // changes.
29 class MigrationObserver { 29 class MigrationObserver {
30 public: 30 public:
31 virtual void OnMigrationStateChange() = 0; 31 virtual void OnMigrationStateChange() = 0;
32 32
33 protected: 33 protected:
34 virtual ~MigrationObserver(); 34 virtual ~MigrationObserver();
35 }; 35 };
36 36
37 // A class to perform migration of a datatype pursuant to the 'MIGRATION_DONE' 37 // A class to perform migration of a datatype pursuant to the 'MIGRATION_DONE'
38 // code in the sync protocol definition (protocol/sync.proto). 38 // code in the sync protocol definition (protocol/sync.proto).
39 class BackendMigrator { 39 class BackendMigrator {
40 public: 40 public:
41 enum State { 41 enum State {
42 IDLE, 42 IDLE,
43 WAITING_TO_START, // Waiting for previous configuration to finish. 43 WAITING_TO_START, // Waiting for previous configuration to finish.
44 DISABLING_TYPES, // Exit criteria: SYNC_CONFIGURE_DONE for 44 DISABLING_TYPES, // Exit criteria: SYNC_CONFIGURE_DONE for
45 // enabled types _excluding_ |to_migrate_| and 45 // enabled types _excluding_ |to_migrate_| and
46 // empty download progress markers for types 46 // empty download progress markers for types
47 // in |to_migrate_|. 47 // in |to_migrate_|.
48 REENABLING_TYPES, // Exit criteria: SYNC_CONFIGURE_DONE for enabled 48 REENABLING_TYPES, // Exit criteria: SYNC_CONFIGURE_DONE for enabled
49 // types. 49 // types.
50 }; 50 };
51 51
52 // TODO(akalin): Remove the dependency on |user_share|. 52 // TODO(akalin): Remove the dependency on |user_share|.
53 BackendMigrator(const std::string& name, 53 BackendMigrator(const std::string& name,
54 syncer::UserShare* user_share, 54 syncer::UserShare* user_share,
55 sync_driver::SyncService* service, 55 sync_driver::SyncService* service,
56 sync_driver::DataTypeManager* manager, 56 sync_driver::DataTypeManager* manager,
57 const base::Closure &migration_done_callback); 57 const base::Closure& migration_done_callback);
58 virtual ~BackendMigrator(); 58 virtual ~BackendMigrator();
59 59
60 // Starts a sequence of events that will disable and reenable |types|. 60 // Starts a sequence of events that will disable and reenable |types|.
61 void MigrateTypes(syncer::ModelTypeSet types); 61 void MigrateTypes(syncer::ModelTypeSet types);
62 62
63 void AddMigrationObserver(MigrationObserver* observer); 63 void AddMigrationObserver(MigrationObserver* observer);
64 bool HasMigrationObserver(const MigrationObserver* observer) const; 64 bool HasMigrationObserver(const MigrationObserver* observer) const;
65 void RemoveMigrationObserver(MigrationObserver* observer); 65 void RemoveMigrationObserver(MigrationObserver* observer);
66 66
67 State state() const; 67 State state() const;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 base::Closure migration_done_callback_; 104 base::Closure migration_done_callback_;
105 105
106 base::WeakPtrFactory<BackendMigrator> weak_ptr_factory_; 106 base::WeakPtrFactory<BackendMigrator> weak_ptr_factory_;
107 107
108 DISALLOW_COPY_AND_ASSIGN(BackendMigrator); 108 DISALLOW_COPY_AND_ASSIGN(BackendMigrator);
109 }; 109 };
110 110
111 } // namespace browser_sync 111 } // namespace browser_sync
112 112
113 #endif // COMPONENTS_SYNC_DRIVER_BACKEND_MIGRATOR_H_ 113 #endif // COMPONENTS_SYNC_DRIVER_BACKEND_MIGRATOR_H_
OLDNEW
« no previous file with comments | « components/sync/driver/backend_data_type_configurer.cc ('k') | components/sync/driver/backend_migrator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698