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

Unified Diff: chrome/browser/sync/profile_sync_service.cc

Issue 535683002: Fix use-after-free in HDDDTC shutdown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests Created 6 years, 3 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/profile_sync_service.cc
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index 1adc3685d695d704642f51b2b03176edfa506c7f..6375c3448ddd62828392a5a0aca4d5e7f39352de 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -962,7 +962,9 @@ void ProfileSyncService::ClearStaleErrors() {
ClearUnrecoverableError();
last_actionable_error_ = SyncProtocolError();
// Clear the data type errors as well.
- data_type_status_table_.Reset();
+ if (directory_data_type_manager_.get())
+ directory_data_type_manager_->ResetDataTypeErrors();
+
}
void ProfileSyncService::ClearUnrecoverableError() {
@@ -1410,20 +1412,7 @@ void ProfileSyncService::OnEncryptedTypesChanged(
<< (encrypt_everything_ ? "true" : "false") << ")";
DCHECK(encrypted_types_.Has(syncer::PASSWORDS));
- // If sessions are encrypted, full history sync is not possible, and
- // delete directives are unnecessary.
- if (GetActiveDataTypes().Has(syncer::HISTORY_DELETE_DIRECTIVES) &&
- encrypted_types_.Has(syncer::SESSIONS)) {
- syncer::SyncError error(
- FROM_HERE,
- syncer::SyncError::DATATYPE_POLICY_ERROR,
- "Delete directives not supported with encryption.",
- syncer::HISTORY_DELETE_DIRECTIVES);
- DataTypeStatusTable::TypeErrorMap error_map;
- error_map[error.model_type()] = error;
- data_type_status_table_.UpdateFailedDataTypes(error_map);
- ReconfigureDatatypeManager();
- }
+ NotifyObservers();
}
void ProfileSyncService::OnEncryptionComplete() {
@@ -1511,6 +1500,7 @@ void ProfileSyncService::OnActionableError(const SyncProtocolError& error) {
void ProfileSyncService::OnConfigureDone(
const DataTypeManager::ConfigureResult& result) {
configure_status_ = result.status;
+ data_type_status_table_ = result.data_type_status_table;
if (backend_mode_ != SYNC) {
if (configure_status_ == DataTypeManager::OK) {
@@ -1840,18 +1830,8 @@ void ProfileSyncService::OnUserChoseDatatypes(
UpdateSelectedTypesHistogram(sync_everything, chosen_types);
sync_prefs_.SetKeepEverythingSynced(sync_everything);
- data_type_status_table_.Reset();
- if (GetActiveDataTypes().Has(syncer::HISTORY_DELETE_DIRECTIVES) &&
- encrypted_types_.Has(syncer::SESSIONS)) {
- syncer::SyncError error(
- FROM_HERE,
- syncer::SyncError::DATATYPE_POLICY_ERROR,
- "Delete directives not supported with encryption.",
- syncer::HISTORY_DELETE_DIRECTIVES);
- DataTypeStatusTable::TypeErrorMap error_map;
- error_map[error.model_type()] = error;
- data_type_status_table_.UpdateFailedDataTypes(error_map);
- }
+ if (directory_data_type_manager_.get())
+ directory_data_type_manager_->ResetDataTypeErrors();
ChangePreferredDataTypes(chosen_types);
AcknowledgeSyncedTypes();
NotifyObservers();
@@ -1986,8 +1966,7 @@ void ProfileSyncService::ConfigureDataTypeManager() {
&directory_data_type_controllers_,
this,
backend_.get(),
- this,
- &data_type_status_table_));
+ this));
// We create the migrator at the same time.
migrator_.reset(

Powered by Google App Engine
This is Rietveld 408576698