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

Unified Diff: chrome/browser/sync/glue/sync_backend_host.h

Issue 6764024: [Sync] Fix ConfigureDataTypes bug that leads to extra nudge (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 9 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/glue/sync_backend_host.h
diff --git a/chrome/browser/sync/glue/sync_backend_host.h b/chrome/browser/sync/glue/sync_backend_host.h
index b53ed05cbdba634b5944db7b433c2929986be240..f78c137a2255e9bbce98af2b72bc5bb809bce365 100644
--- a/chrome/browser/sync/glue/sync_backend_host.h
+++ b/chrome/browser/sync/glue/sync_backend_host.h
@@ -11,6 +11,7 @@
#include <vector>
#include "base/file_path.h"
+#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop.h"
#include "base/synchronization/lock.h"
@@ -554,10 +555,37 @@ class SyncBackendHost : public browser_sync::ModelSafeWorkerRegistrar {
scoped_refptr<Core> core_;
private:
+ FRIEND_TEST_ALL_PREFIXES(SyncBackendHostTest, MakePendingConfigModeState);
+
+ struct PendingConfigureDataTypesState {
+ PendingConfigureDataTypesState();
+ ~PendingConfigureDataTypesState();
+
+ // A task that should be called once data type configuration is
+ // complete.
+ scoped_ptr<CancelableTask> ready_task;
+
+ // The set of types that we are waiting to be initially synced in a
+ // configuration cycle.
+ syncable::ModelTypeSet initial_types;
+
+ // Additional details about which types were added / removed.
+ bool deleted_type;
+ syncable::ModelTypeBitSet added_types;
+ };
+
UIModelWorker* ui_worker();
void ConfigureAutofillMigration();
+ // Helper function for ConfigureDataTypes(). Caller owns return
+ // value. Takes ownership of |ready_task| (but not |routing_info|).
+ static PendingConfigureDataTypesState* MakePendingConfigModeState(
+ const DataTypeController::TypeMap& data_type_controllers,
+ const syncable::ModelTypeSet& types,
+ CancelableTask* ready_task,
+ ModelSafeRoutingInfo* routing_info);
+
// A thread we dedicate for use by our Core to perform initialization,
// authentication, handle messages from the syncapi, and periodically tell
// the syncapi to persist itself.
@@ -604,23 +632,6 @@ class SyncBackendHost : public browser_sync::ModelSafeWorkerRegistrar {
// Path of the folder that stores the sync data files.
FilePath sync_data_folder_path_;
- struct PendingConfigureDataTypesState {
- PendingConfigureDataTypesState();
- ~PendingConfigureDataTypesState();
-
- // A task that should be called once data type configuration is
- // complete.
- scoped_ptr<CancelableTask> ready_task;
-
- // The set of types that we are waiting to be initially synced in a
- // configuration cycle.
- syncable::ModelTypeSet initial_types;
-
- // Additional details about which types were added / removed.
- bool deleted_type;
- syncable::ModelTypeBitSet added_types;
- };
-
scoped_ptr<PendingConfigureDataTypesState> pending_download_state_;
scoped_ptr<PendingConfigureDataTypesState> pending_config_mode_state_;

Powered by Google App Engine
This is Rietveld 408576698