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

Unified Diff: components/sync/driver/data_type_manager_impl.cc

Issue 2369063003: [Sync] Add an error integration test for USS. (Closed)
Patch Set: Improve comments. Created 4 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: components/sync/driver/data_type_manager_impl.cc
diff --git a/components/sync/driver/data_type_manager_impl.cc b/components/sync/driver/data_type_manager_impl.cc
index 0f6b78bd3c80806171ee4bf3cea709cc98d0f4e1..4d9f1f00bfd913ffe19ce69739abedd593dd2904 100644
--- a/components/sync/driver/data_type_manager_impl.cc
+++ b/components/sync/driver/data_type_manager_impl.cc
@@ -15,6 +15,7 @@
#include "base/metrics/histogram_macros.h"
#include "base/profiler/scoped_tracker.h"
#include "base/strings/stringprintf.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h"
#include "components/sync/core/data_type_debug_info_listener.h"
#include "components/sync/driver/data_type_encryption_handler.h"
@@ -332,7 +333,10 @@ TypeSetPriorityList DataTypeManagerImpl::PrioritizeTypes(
}
void DataTypeManagerImpl::ProcessReconfigure() {
- DCHECK(needs_reconfigure_);
+ // This may have been called asynchronously; no-op if it is no longer needed.
+ if (!needs_reconfigure_) {
+ return;
+ }
// Wait for current download and association to finish.
if (!download_types_queue_.empty() ||
@@ -499,7 +503,12 @@ void DataTypeManagerImpl::OnSingleDataTypeWillStop(
if (error.error_type() != syncer::SyncError::UNRECOVERABLE_ERROR) {
needs_reconfigure_ = true;
last_configure_reason_ = syncer::CONFIGURE_REASON_PROGRAMMATIC;
- ProcessReconfigure();
+ // Do this asynchronously so the ModelAssociationManager has a chance to
+ // finish stopping this type, otherwise DeactivateDataType() and Stop()
+ // end up getting called twice on the controller.
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&DataTypeManagerImpl::ProcessReconfigure,
+ weak_ptr_factory_.GetWeakPtr()));
}
}
}

Powered by Google App Engine
This is Rietveld 408576698