summaryrefslogtreecommitdiffstats
path: root/chrome/browser/password_manager
diff options
context:
space:
mode:
authoralbertb@chromium.org <albertb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-13 20:21:22 +0000
committeralbertb@chromium.org <albertb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-13 20:21:22 +0000
commitc4f17130b5d1f1a5f12a61abaf91fd3d26a61d73 (patch)
tree28b60ee6880c2d1a615585cb39564ffe07b12477 /chrome/browser/password_manager
parent59f199deadb588edf37afe02d964abe0ded0c2df (diff)
downloadchromium_src-c4f17130b5d1f1a5f12a61abaf91fd3d26a61d73.zip
chromium_src-c4f17130b5d1f1a5f12a61abaf91fd3d26a61d73.tar.gz
chromium_src-c4f17130b5d1f1a5f12a61abaf91fd3d26a61d73.tar.bz2
Revert "Schedule PasswordStore tasks on the DB thread on Windows and Linux."
This reverts commit 20226b236864eebd7af84703cc5a70056babd34a. Revert "Fix conditional in PasswordStoreMac initialization" This reverts commit 0d07a3783fc100c2cfe2a4d2f1c8f52ee94e3da7. TBR=stuartmorgan BUG=none TEST=none Review URL: http://codereview.chromium.org/1604033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44387 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/password_manager')
-rw-r--r--chrome/browser/password_manager/password_store.cc16
-rw-r--r--chrome/browser/password_manager/password_store.h3
-rw-r--r--chrome/browser/password_manager/password_store_mac.cc31
-rw-r--r--chrome/browser/password_manager/password_store_mac.h21
4 files changed, 16 insertions, 55 deletions
diff --git a/chrome/browser/password_manager/password_store.cc b/chrome/browser/password_manager/password_store.cc
index c58f394..72ce9a7 100644
--- a/chrome/browser/password_manager/password_store.cc
+++ b/chrome/browser/password_manager/password_store.cc
@@ -6,7 +6,6 @@
#include "base/scoped_ptr.h"
#include "base/task.h"
-#include "chrome/browser/chrome_thread.h"
using std::vector;
using webkit_glue::PasswordForm;
@@ -15,11 +14,20 @@ PasswordStore::PasswordStore() : handle_(0) {
}
bool PasswordStore::Init() {
+ thread_.reset(new base::Thread("Chrome_PasswordStore_Thread"));
+
+ if (!thread_->Start()) {
+ thread_.reset(NULL);
+ return false;
+ }
+
return true;
}
void PasswordStore::ScheduleTask(Task* task) {
- ChromeThread::PostTask(ChromeThread::DB, FROM_HERE, task);
+ if (thread_.get()) {
+ thread_->message_loop()->PostTask(FROM_HERE, task);
+ }
}
void PasswordStore::AddLogin(const PasswordForm& form) {
@@ -72,9 +80,7 @@ void PasswordStore::NotifyConsumer(GetLoginsRequest* request,
const vector<PasswordForm*> forms) {
scoped_ptr<GetLoginsRequest> request_ptr(request);
-#if !defined(OS_MACOSX)
- DCHECK(ChromeThread::CurrentlyOn(ChromeThread::DB));
-#endif
+ DCHECK(MessageLoop::current() == thread_->message_loop());
request->message_loop->PostTask(FROM_HERE,
NewRunnableMethod(this,
&PasswordStore::NotifyConsumerImpl,
diff --git a/chrome/browser/password_manager/password_store.h b/chrome/browser/password_manager/password_store.h
index f963611..193a8a6 100644
--- a/chrome/browser/password_manager/password_store.h
+++ b/chrome/browser/password_manager/password_store.h
@@ -120,6 +120,9 @@ class PasswordStore : public base::RefCountedThreadSafe<PasswordStore> {
void NotifyConsumer(GetLoginsRequest* request,
const std::vector<webkit_glue::PasswordForm*> forms);
+ // Thread that the synchronous methods are run in.
+ scoped_ptr<base::Thread> thread_;
+
private:
// Called by NotifyConsumer, but runs in the consumer's thread. Will not
// call the consumer if the request was canceled. This extra layer is here so
diff --git a/chrome/browser/password_manager/password_store_mac.cc b/chrome/browser/password_manager/password_store_mac.cc
index b81525b..95b8d5e 100644
--- a/chrome/browser/password_manager/password_store_mac.cc
+++ b/chrome/browser/password_manager/password_store_mac.cc
@@ -715,32 +715,7 @@ PasswordStoreMac::PasswordStoreMac(MacKeychain* keychain,
DCHECK(login_metadata_db_.get());
}
-PasswordStoreMac::~PasswordStoreMac() {
- if (thread_.get() && notification_service_.get()) {
- thread_->message_loop()->DeleteSoon(FROM_HERE,
- notification_service_.release());
- thread_->message_loop()->RunAllPending();
- }
-}
-
-bool PasswordStoreMac::Init() {
- thread_.reset(new base::Thread("Chrome_PasswordStore_Thread"));
-
- if (!thread_->Start()) {
- thread_.reset(NULL);
- return false;
- }
- ScheduleTask(NewRunnableMethod(this,
- &PasswordStoreMac::CreateNotificationService));
-
- return PasswordStore::Init();
-}
-
-void PasswordStoreMac::ScheduleTask(Task* task) {
- if (thread_.get()) {
- thread_->message_loop()->PostTask(FROM_HERE, task);
- }
-}
+PasswordStoreMac::~PasswordStoreMac() {}
void PasswordStoreMac::AddLoginImpl(const PasswordForm& form) {
if (AddToKeychainIfNecessary(form)) {
@@ -914,7 +889,3 @@ void PasswordStoreMac::RemoveKeychainForms(
owned_keychain_adapter.RemovePassword(**i);
}
}
-
-void PasswordStoreMac::CreateNotificationService() {
- notification_service_.reset(new NotificationService);
-}
diff --git a/chrome/browser/password_manager/password_store_mac.h b/chrome/browser/password_manager/password_store_mac.h
index b18be03..5956589 100644
--- a/chrome/browser/password_manager/password_store_mac.h
+++ b/chrome/browser/password_manager/password_store_mac.h
@@ -8,10 +8,8 @@
#include <vector>
#include "base/scoped_ptr.h"
-#include "base/thread.h"
#include "chrome/browser/password_manager/login_database.h"
#include "chrome/browser/password_manager/password_store.h"
-#include "chrome/common/notification_service.h"
class MacKeychain;
@@ -26,16 +24,9 @@ class PasswordStoreMac : public PasswordStore {
// non-NULL.
PasswordStoreMac(MacKeychain* keychain, LoginDatabase* login_db);
- // Initializes |thread_| and |notification_service_|.
- virtual bool Init();
-
- protected:
+ private:
virtual ~PasswordStoreMac();
- // Schedules tasks on |thread_|.
- virtual void ScheduleTask(Task* task);
-
- private:
void AddLoginImpl(const webkit_glue::PasswordForm& form);
void UpdateLoginImpl(const webkit_glue::PasswordForm& form);
void RemoveLoginImpl(const webkit_glue::PasswordForm& form);
@@ -69,19 +60,9 @@ class PasswordStoreMac : public PasswordStore {
void RemoveKeychainForms(
const std::vector<webkit_glue::PasswordForm*>& forms);
- // Allows the creation of |notification_service_| to be scheduled on the right
- // thread.
- void CreateNotificationService();
-
scoped_ptr<MacKeychain> keychain_;
scoped_ptr<LoginDatabase> login_metadata_db_;
- // Thread that the synchronous methods are run in on OSX. Since those methods
- // aren't run on a well-known thread, but stil need to send out notifications,
- // we need to run our own notification service.
- scoped_ptr<base::Thread> thread_;
- scoped_ptr<NotificationService> notification_service_;
-
DISALLOW_COPY_AND_ASSIGN(PasswordStoreMac);
};