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

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

Issue 10387144: [Sync] - Implement isolated model association. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For review. Created 8 years, 7 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/data_type_manager_impl.cc
diff --git a/chrome/browser/sync/glue/data_type_manager_impl.cc b/chrome/browser/sync/glue/data_type_manager_impl.cc
index da0505c765eca4b8217ff45f605346514d19f923..60c7921abd8f3eb4cc6c9d65d7b607769864a7ec 100644
--- a/chrome/browser/sync/glue/data_type_manager_impl.cc
+++ b/chrome/browser/sync/glue/data_type_manager_impl.cc
@@ -90,7 +90,6 @@ void DataTypeManagerImpl::ConfigureImpl(
return;
}
- model_association_manager_.Initialize(desired_types);
Restart(reason, nigori_state);
}
@@ -98,6 +97,7 @@ void DataTypeManagerImpl::Restart(
sync_api::ConfigureReason reason,
BackendDataTypeConfigurer::NigoriState nigori_state) {
DVLOG(1) << "Restarting...";
+ model_association_manager_.Initialize(last_requested_types_);
last_restart_time_ = base::Time::Now();
DCHECK(state_ == STOPPED || state_ == CONFIGURED || state_ == BLOCKED);
@@ -210,10 +210,9 @@ void DataTypeManagerImpl::DownloadReady(
void DataTypeManagerImpl::OnModelAssociationDone(
const DataTypeManager::ConfigureResult& result) {
if (result.status == ABORTED || result.status == UNRECOVERABLE_ERROR) {
- Abort(result.status, result.errors.size() >= 1 ?
- result.errors.front() :
+ Abort(result.status, result.failed_data_types.size() >= 1 ?
+ result.failed_data_types.front() :
SyncError());
-
return;
}
@@ -223,8 +222,8 @@ void DataTypeManagerImpl::OnModelAssociationDone(
if (result.status == CONFIGURE_BLOCKED) {
failed_datatypes_info_.insert(failed_datatypes_info_.end(),
- result.errors.begin(),
- result.errors.end());
+ result.failed_data_types.begin(),
+ result.failed_data_types.end());
SetBlockedAndNotify();
return;
}
@@ -232,15 +231,27 @@ void DataTypeManagerImpl::OnModelAssociationDone(
DCHECK(result.status == PARTIAL_SUCCESS || result.status == OK);
state_ = CONFIGURED;
failed_datatypes_info_.insert(failed_datatypes_info_.end(),
- result.errors.begin(),
- result.errors.end());
+ result.failed_data_types.begin(),
+ result.failed_data_types.end());
ConfigureResult configure_result(result.status,
result.requested_types,
- failed_datatypes_info_);
+ failed_datatypes_info_,
+ result.waiting_to_start);
NotifyDone(configure_result);
failed_datatypes_info_.clear();
}
+void DataTypeManagerImpl::OnTypesLoaded() {
+ if (state_ != CONFIGURED) {
+ // Ignore this. either we just started another configuration or
+ // we are in some sort of error.
+ return;
+ }
+
+ Restart(sync_api::CONFIGURE_REASON_RECONFIGURATION,
+ BackendDataTypeConfigurer::WITH_NIGORI);
+}
+
void DataTypeManagerImpl::Stop() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -288,7 +299,8 @@ void DataTypeManagerImpl::Abort(ConfigureStatus status,
error_list.push_back(error);
ConfigureResult result(status,
last_requested_types_,
- error_list);
+ error_list,
+ syncable::ModelTypeSet());
NotifyDone(result);
}

Powered by Google App Engine
This is Rietveld 408576698