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

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

Issue 6811003: [Sync] Make generic non-frontend thread datatype controller. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix autofill Created 9 years, 8 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/frontend_data_type_controller.cc
diff --git a/chrome/browser/sync/glue/frontend_data_type_controller.cc b/chrome/browser/sync/glue/frontend_data_type_controller.cc
index 5e324f9f1de8147d2e14e153c454596979fd4b91..c356daf9f4619a5d38e14534a2531dc056c15002 100644
--- a/chrome/browser/sync/glue/frontend_data_type_controller.cc
+++ b/chrome/browser/sync/glue/frontend_data_type_controller.cc
@@ -103,15 +103,38 @@ bool FrontendDataTypeController::Associate() {
return true;
}
+void FrontendDataTypeController::StartFailed(StartResult result,
+ const tracked_objects::Location& location) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ CleanUpState();
+ model_associator_.reset();
+ change_processor_.reset();
+ state_ = NOT_RUNNING;
+ start_callback_->Run(result, location);
+ start_callback_.reset();
+ RecordStartFailure(result);
+}
+
+void FrontendDataTypeController::FinishStart(StartResult result,
+ const tracked_objects::Location& location) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ start_callback_->Run(result, location);
+ start_callback_.reset();
+}
+
void FrontendDataTypeController::Stop() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// If Stop() is called while Start() is waiting for the datatype model to
// load, abort the start.
- if (state_ == MODEL_STARTING)
- FinishStart(ABORTED, FROM_HERE);
+ if (state_ == MODEL_STARTING) {
+ StartFailed(ABORTED, FROM_HERE);
+ // We can just return here since we haven't performed association if we're
+ // still in MODEL_STARTING.
+ return;
+ }
DCHECK(!start_callback_.get());
- CleanupState();
+ CleanUpState();
if (change_processor_ != NULL)
sync_service_->DeactivateDataType(this, change_processor_.get());
@@ -125,7 +148,7 @@ void FrontendDataTypeController::Stop() {
state_ = NOT_RUNNING;
}
-void FrontendDataTypeController::CleanupState() {
+void FrontendDataTypeController::CleanUpState() {
// Do nothing by default.
}
@@ -150,23 +173,4 @@ void FrontendDataTypeController::OnUnrecoverableError(
sync_service_->OnUnrecoverableError(from_here, message);
}
-void FrontendDataTypeController::FinishStart(StartResult result,
- const tracked_objects::Location& location) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- start_callback_->Run(result, location);
- start_callback_.reset();
-}
-
-void FrontendDataTypeController::StartFailed(StartResult result,
- const tracked_objects::Location& location) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- CleanupState();
- model_associator_.reset();
- change_processor_.reset();
- state_ = NOT_RUNNING;
- start_callback_->Run(result, location);
- start_callback_.reset();
- RecordStartFailure(result);
-}
-
} // namespace browser_sync

Powered by Google App Engine
This is Rietveld 408576698