summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-04 03:32:25 +0000
committerzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-04 03:32:25 +0000
commit62b86501836d26b00cf833779f5af854e0734e93 (patch)
treeebe58375cbf879404322143d4f9baee2cc1ae5bd /chrome/browser
parent26b22116fba9c4c4d860a4aeb7e55b95ade2b847 (diff)
downloadchromium_src-62b86501836d26b00cf833779f5af854e0734e93.zip
chromium_src-62b86501836d26b00cf833779f5af854e0734e93.tar.gz
chromium_src-62b86501836d26b00cf833779f5af854e0734e93.tar.bz2
[SYNC] Fix handling of password store corruption.
BUG=70849 TEST=sync successfully once, shut down, corrupt the password store db, start up, make sure we don't crash Review URL: http://codereview.chromium.org/6250135 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73754 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/sync/glue/password_data_type_controller.cc13
-rw-r--r--chrome/browser/sync/glue/sync_backend_host.cc17
-rw-r--r--chrome/browser/sync/profile_sync_service_password_unittest.cc2
3 files changed, 20 insertions, 12 deletions
diff --git a/chrome/browser/sync/glue/password_data_type_controller.cc b/chrome/browser/sync/glue/password_data_type_controller.cc
index c483860..b43b5ba 100644
--- a/chrome/browser/sync/glue/password_data_type_controller.cc
+++ b/chrome/browser/sync/glue/password_data_type_controller.cc
@@ -43,6 +43,16 @@ void PasswordDataTypeController::Start(StartCallback* start_callback) {
return;
}
+ password_store_ = profile_->GetPasswordStore(Profile::EXPLICIT_ACCESS);
+ if (!password_store_.get()) {
+ LOG(ERROR) << "PasswordStore not initialized, password datatype controller"
+ << " aborting.";
+ state_ = NOT_RUNNING;
+ start_callback->Run(ABORTED);
+ delete start_callback;
+ return;
+ }
+
if (!sync_service_->IsCryptographerReady()) {
start_callback->Run(NEEDS_CRYPTO);
delete start_callback;
@@ -50,10 +60,7 @@ void PasswordDataTypeController::Start(StartCallback* start_callback) {
}
start_callback_.reset(start_callback);
-
set_state(ASSOCIATING);
- password_store_ = profile_->GetPasswordStore(Profile::EXPLICIT_ACCESS);
- DCHECK(password_store_.get());
password_store_->ScheduleTask(
NewRunnableMethod(this, &PasswordDataTypeController::StartImpl));
}
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc
index 9230c2c..13e3a42 100644
--- a/chrome/browser/sync/glue/sync_backend_host.cc
+++ b/chrome/browser/sync/glue/sync_backend_host.cc
@@ -111,6 +111,14 @@ void SyncBackendHost::Initialize(
profile_->GetHistoryService(Profile::IMPLICIT_ACCESS));
}
+ // Any datatypes that we want the syncer to pull down must
+ // be in the routing_info map. We set them to group passive, meaning that
+ // updates will be applied, but not dispatched to the UI thread yet.
+ for (syncable::ModelTypeSet::const_iterator it = types.begin();
+ it != types.end(); ++it) {
+ registrar_.routing_info[(*it)] = GROUP_PASSIVE;
+ }
+
PasswordStore* password_store =
profile_->GetPasswordStore(Profile::IMPLICIT_ACCESS);
if (password_store) {
@@ -118,14 +126,7 @@ void SyncBackendHost::Initialize(
new PasswordModelWorker(password_store);
} else {
LOG(WARNING) << "Password store not initialized, cannot sync passwords";
- }
-
- // Any datatypes that we want the syncer to pull down must
- // be in the routing_info map. We set them to group passive, meaning that
- // updates will be applied, but not dispatched to the UI thread yet.
- for (syncable::ModelTypeSet::const_iterator it = types.begin();
- it != types.end(); ++it) {
- registrar_.routing_info[(*it)] = GROUP_PASSIVE;
+ registrar_.routing_info.erase(syncable::PASSWORDS);
}
// TODO(tim): Remove this special case once NIGORI is populated by
diff --git a/chrome/browser/sync/profile_sync_service_password_unittest.cc b/chrome/browser/sync/profile_sync_service_password_unittest.cc
index eca4b95..080e600 100644
--- a/chrome/browser/sync/profile_sync_service_password_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_password_unittest.cc
@@ -190,7 +190,7 @@ class ProfileSyncServicePasswordTest : public AbstractProfileSyncServiceTest {
WillRepeatedly(Return(&token_service_));
EXPECT_CALL(profile_, GetPasswordStore(_)).
- Times(2).
+ Times(3).
WillRepeatedly(Return(password_store_.get()));
EXPECT_CALL(observer_,