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

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

Issue 10825137: FYI: Control Data + Per-Device Metadata (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add PER_USER_METADATA, refactor some encryption code Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/glue/sync_backend_host.cc
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc
index ccf8bf65fa0d5eb0b56e3515e465edea028827a2..89dbeb23164550f417bf5989efedd1b2dbeac033 100644
--- a/chrome/browser/sync/glue/sync_backend_host.cc
+++ b/chrome/browser/sync/glue/sync_backend_host.cc
@@ -153,10 +153,10 @@ class SyncBackendHost::Core
// reencrypt everything.
void DoEnableEncryptEverything();
- // Called to refresh encryption with the most recent passphrase
- // and set of encrypted types. Also adds device information to the nigori
- // node. |done_callback| is called on the sync thread.
- void DoRefreshNigori(const base::Closure& done_callback);
+ // Called to perform tasks which require the metadata to be present, including
+ // refreshing encryption with the most passphrase and requested types an
+ // updating device information.
+ void DoInitialProcessMetadata(const base::Closure& done_callback);
// The shutdown order is a bit complicated:
// 1) From |sync_thread_|, invoke the syncapi Shutdown call to do
@@ -631,7 +631,6 @@ void SyncBackendHost::ConfigureDataTypes(
syncer::ConfigureReason reason,
syncer::ModelTypeSet types_to_add,
syncer::ModelTypeSet types_to_remove,
- NigoriState nigori_state,
const base::Callback<void(syncer::ModelTypeSet)>& ready_task,
const base::Callback<void()>& retry_callback) {
// Only one configure is allowed at a time. This is guaranteed by our
@@ -642,20 +641,9 @@ void SyncBackendHost::ConfigureDataTypes(
DCHECK_GT(initialization_state_, NOT_INITIALIZED);
- syncer::ModelTypeSet types_to_add_with_nigori = types_to_add;
- syncer::ModelTypeSet types_to_remove_with_nigori = types_to_remove;
- if (nigori_state == WITH_NIGORI) {
- types_to_add_with_nigori.Put(syncer::NIGORI);
- types_to_remove_with_nigori.Remove(syncer::NIGORI);
- } else {
- types_to_add_with_nigori.Remove(syncer::NIGORI);
- types_to_remove_with_nigori.Put(syncer::NIGORI);
- }
-
// The SyncBackendRegistrar's routing info will be updated by adding the
- // types_to_add_with_nigori to the list then removing
- // types_to_remove_with_nigori. Any types which are not in either of those
- // sets will remain untouched.
+ // types_to_add to the list then removing types_to_remove. Any types which
+ // are not in either of those sets will remain untouched.
//
// Types which were not in the list previously are not fully downloaded, so we
// must ask the syncer to download them. Any newly supported datatypes will
@@ -669,7 +657,7 @@ void SyncBackendHost::ConfigureDataTypes(
// until they succeed or the browser is closed.
syncer::ModelTypeSet types_to_download = registrar_->ConfigureDataTypes(
- types_to_add_with_nigori, types_to_remove_with_nigori);
+ types_to_add, types_to_remove);
if (!types_to_download.Empty())
types_to_download.Put(syncer::NIGORI);
@@ -1163,12 +1151,12 @@ void SyncBackendHost::Core::DoEnableEncryptEverything() {
sync_manager_->EnableEncryptEverything();
}
-void SyncBackendHost::Core::DoRefreshNigori(
+void SyncBackendHost::Core::DoInitialProcessMetadata(
const base::Closure& done_callback) {
DCHECK_EQ(MessageLoop::current(), sync_loop_);
chrome::VersionInfo version_info;
- sync_manager_->RefreshNigori(version_info.CreateVersionString(),
- done_callback);
+ sync_manager_->InitialProcessMetadata(version_info.CreateVersionString(),
+ done_callback);
}
void SyncBackendHost::Core::DoStopSyncManagerForShutdown(
@@ -1325,12 +1313,11 @@ void SyncBackendHost::HandleInitializationCompletedOnFrontendLoop(
// trigger migration. That would be disastrous, so we must rely on the
// sync manager to ensure that this type never has both progress markers
// and !initial_sync_ended.
- initialization_state_ = DOWNLOADING_NIGORI;
+ initialization_state_ = DOWNLOADING_METADATA;
ConfigureDataTypes(
syncer::CONFIGURE_REASON_NEW_CLIENT,
+ syncer::ModelTypeSet(syncer::ControlTypes()),
rlarocque 2012/08/11 01:31:52 ControlTypes was intended to be a group of types t
syncer::ModelTypeSet(),
- syncer::ModelTypeSet(),
- WITH_NIGORI,
// Calls back into this function.
base::Bind(
&SyncBackendHost::
@@ -1339,17 +1326,17 @@ void SyncBackendHost::HandleInitializationCompletedOnFrontendLoop(
base::Bind(&SyncBackendHost::OnNigoriDownloadRetry,
weak_ptr_factory_.GetWeakPtr()));
break;
- case DOWNLOADING_NIGORI:
- initialization_state_ = REFRESHING_NIGORI;
- // Triggers OnEncryptedTypesChanged() and OnEncryptionComplete()
- // if necessary.
- RefreshNigori(
+ case DOWNLOADING_METADATA:
+ initialization_state_ = PROCESSING_METADATA;
+ // Updates encryption and other metadata. Will call
+ // OnEncryptedTypesChanged() and OnEncryptionComplete() if necessary.
+ InitialProcessMetadata(
base::Bind(
&SyncBackendHost::
HandleInitializationCompletedOnFrontendLoop,
weak_ptr_factory_.GetWeakPtr(), js_backend, true));
break;
- case REFRESHING_NIGORI:
+ case PROCESSING_METADATA:
initialization_state_ = INITIALIZED;
// Now that we've downloaded the nigori node, we can see if there are any
// experimental types to enable. This should be done before we inform
@@ -1533,14 +1520,15 @@ void PostClosure(MessageLoop* message_loop,
} // namespace
-void SyncBackendHost::RefreshNigori(const base::Closure& done_callback) {
+void SyncBackendHost::InitialProcessMetadata(
+ const base::Closure& done_callback) {
DCHECK_EQ(MessageLoop::current(), frontend_loop_);
base::Closure sync_thread_done_callback =
base::Bind(&PostClosure,
MessageLoop::current(), FROM_HERE, done_callback);
sync_thread_.message_loop()->PostTask(
FROM_HERE,
- base::Bind(&SyncBackendHost::Core::DoRefreshNigori,
+ base::Bind(&SyncBackendHost::Core::DoInitialProcessMetadata,
core_.get(), sync_thread_done_callback));
}

Powered by Google App Engine
This is Rietveld 408576698