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

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

Issue 8919021: [Sync] Rename ModelEnumSet to ModelTypeSet (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_REGISTRAR_H_ 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_REGISTRAR_H_
6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_REGISTRAR_H_ 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_REGISTRAR_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 21 matching lines...) Expand all
32 // A class that keep track of the workers, change processors, and 32 // A class that keep track of the workers, change processors, and
33 // routing info for the enabled sync types, and also routes change 33 // routing info for the enabled sync types, and also routes change
34 // events to the right processors. 34 // events to the right processors.
35 class SyncBackendRegistrar : public ModelSafeWorkerRegistrar, 35 class SyncBackendRegistrar : public ModelSafeWorkerRegistrar,
36 public sync_api::SyncManager::ChangeDelegate { 36 public sync_api::SyncManager::ChangeDelegate {
37 public: 37 public:
38 // |initial_types| contains the initial set of types to sync 38 // |initial_types| contains the initial set of types to sync
39 // (initially put in the passive group). |name| is used for 39 // (initially put in the passive group). |name| is used for
40 // debugging. Does not take ownership of |profile| or |sync_loop|. 40 // debugging. Does not take ownership of |profile| or |sync_loop|.
41 // Must be created on the UI thread. 41 // Must be created on the UI thread.
42 SyncBackendRegistrar(syncable::ModelEnumSet initial_types, 42 SyncBackendRegistrar(syncable::ModelTypeSet initial_types,
43 const std::string& name, 43 const std::string& name,
44 Profile* profile, 44 Profile* profile,
45 MessageLoop* sync_loop); 45 MessageLoop* sync_loop);
46 46
47 // SyncBackendRegistrar must be destroyed as follows: 47 // SyncBackendRegistrar must be destroyed as follows:
48 // 48 //
49 // 1) On the sync thread, call OnSyncerShutdownComplete() after 49 // 1) On the sync thread, call OnSyncerShutdownComplete() after
50 // the syncer is shutdown. 50 // the syncer is shutdown.
51 // 2) Meanwhile, on the UI thread, call StopOnUIThread(), which 51 // 2) Meanwhile, on the UI thread, call StopOnUIThread(), which
52 // blocks until OnSyncerShutdownComplete() is called. 52 // blocks until OnSyncerShutdownComplete() is called.
53 // 3) Destroy the SyncBackendRegistrar. 53 // 3) Destroy the SyncBackendRegistrar.
54 // 54 //
55 // This is to handle the complicated shutdown requirements of the 55 // This is to handle the complicated shutdown requirements of the
56 // UIModelWorker (since the UI thread is both the main thread and a 56 // UIModelWorker (since the UI thread is both the main thread and a
57 // thread which the syncer pushes changes to). 57 // thread which the syncer pushes changes to).
58 virtual ~SyncBackendRegistrar(); 58 virtual ~SyncBackendRegistrar();
59 59
60 // Returns whether or not we are currently syncing encryption keys. 60 // Returns whether or not we are currently syncing encryption keys.
61 // Must be called on the UI thread. 61 // Must be called on the UI thread.
62 bool IsNigoriEnabled() const; 62 bool IsNigoriEnabled() const;
63 63
64 // Removes all types in |types_to_remove| from the routing info and 64 // Removes all types in |types_to_remove| from the routing info and
65 // adds all the types in |types_to_add| to the routing info that are 65 // adds all the types in |types_to_add| to the routing info that are
66 // not already there (initially put in the passive group). 66 // not already there (initially put in the passive group).
67 // |types_to_remove| and |types_to_add| must be disjoint. Returns 67 // |types_to_remove| and |types_to_add| must be disjoint. Returns
68 // the set of newly-added types. Must be called on the UI thread. 68 // the set of newly-added types. Must be called on the UI thread.
69 syncable::ModelEnumSet ConfigureDataTypes( 69 syncable::ModelTypeSet ConfigureDataTypes(
70 syncable::ModelEnumSet types_to_add, 70 syncable::ModelTypeSet types_to_add,
71 syncable::ModelEnumSet types_to_remove); 71 syncable::ModelTypeSet types_to_remove);
72 72
73 // Must be called from the UI thread. (See destructor comment.) 73 // Must be called from the UI thread. (See destructor comment.)
74 void StopOnUIThread(); 74 void StopOnUIThread();
75 75
76 // Must be called from the sync thread. (See destructor comment.) 76 // Must be called from the sync thread. (See destructor comment.)
77 void OnSyncerShutdownComplete(); 77 void OnSyncerShutdownComplete();
78 78
79 // Activates the given data type (which should belong to the given 79 // Activates the given data type (which should belong to the given
80 // group) and starts the given change processor. Must be called 80 // group) and starts the given change processor. Must be called
81 // from |group|'s native thread. 81 // from |group|'s native thread.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 154
155 // The change processors that handle the different data types. 155 // The change processors that handle the different data types.
156 std::map<syncable::ModelType, ChangeProcessor*> processors_; 156 std::map<syncable::ModelType, ChangeProcessor*> processors_;
157 157
158 DISALLOW_COPY_AND_ASSIGN(SyncBackendRegistrar); 158 DISALLOW_COPY_AND_ASSIGN(SyncBackendRegistrar);
159 }; 159 };
160 160
161 } // namespace browser_sync 161 } // namespace browser_sync
162 162
163 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_REGISTRAR_H_ 163 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_REGISTRAR_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host_unittest.cc ('k') | chrome/browser/sync/glue/sync_backend_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698