Commit c39e9efd authored by dubroy@chromium.org's avatar dubroy@chromium.org

Eliminate BrowserThread usage from PasswordStoreDefault.

As part of componentizing the password manager, we need to remove all
references to content/ from PasswordStoreDefault.

Depends on https://codereview.chromium.org/152683002/.

BUG=335147
R=gcasto@chromium.org

Review URL: https://codereview.chromium.org/153943002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248964 0039d316-1c4b-4281-b951-d872f2087c98
parent 2cc796c4
......@@ -153,14 +153,14 @@ void PasswordStore::RemoveObserver(Observer* observer) {
PasswordStore::~PasswordStore() {}
bool PasswordStore::ScheduleTask(const base::Closure& task) {
scoped_refptr<base::SequencedTaskRunner> task_runner(
scoped_refptr<base::SingleThreadTaskRunner> task_runner(
GetBackgroundTaskRunner());
if (task_runner.get())
return task_runner->PostTask(FROM_HERE, task);
return false;
}
scoped_refptr<base::SequencedTaskRunner>
scoped_refptr<base::SingleThreadTaskRunner>
PasswordStore::GetBackgroundTaskRunner() {
return db_thread_runner_;
}
......
......@@ -182,7 +182,7 @@ class PasswordStore : public RefcountedBrowserContextKeyedService {
// Get the TaskRunner to use for PasswordStore background tasks.
// By default, a SingleThreadTaskRunner on the DB thread is used, but
// subclasses can override.
virtual scoped_refptr<base::SequencedTaskRunner> GetBackgroundTaskRunner();
virtual scoped_refptr<base::SingleThreadTaskRunner> GetBackgroundTaskRunner();
// These will be run in PasswordStore's own thread.
// Synchronous implementation that reports usage metrics.
......
......@@ -14,11 +14,9 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
using autofill::PasswordForm;
using content::BrowserThread;
PasswordStoreDefault::PasswordStoreDefault(
scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner,
......@@ -36,12 +34,12 @@ PasswordStoreDefault::~PasswordStoreDefault() {
}
void PasswordStoreDefault::ShutdownOnUIThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(main_thread_runner_->BelongsToCurrentThread());
profile_ = NULL;
}
void PasswordStoreDefault::ReportMetricsImpl() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread());
login_db_->ReportMetrics();
}
......@@ -122,12 +120,12 @@ void PasswordStoreDefault::GetBlacklistLoginsImpl(
bool PasswordStoreDefault::FillAutofillableLogins(
std::vector<PasswordForm*>* forms) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread());
return login_db_->GetAutofillableLogins(forms);
}
bool PasswordStoreDefault::FillBlacklistLogins(
std::vector<PasswordForm*>* forms) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread());
return login_db_->GetBlacklistLogins(forms);
}
......@@ -863,7 +863,7 @@ void PasswordStoreMac::ShutdownOnUIThread() {
// arbitrarily long time (most notably, it can block on user confirmation
// from a dialog). Run tasks on a dedicated thread to avoid blocking the DB
// thread.
scoped_refptr<base::SequencedTaskRunner>
scoped_refptr<base::SingleThreadTaskRunner>
PasswordStoreMac::GetBackgroundTaskRunner() {
return (thread_.get()) ? thread_->message_loop_proxy() : NULL;
}
......
......@@ -44,7 +44,7 @@ class PasswordStoreMac : public PasswordStore {
protected:
virtual ~PasswordStoreMac();
virtual scoped_refptr<base::SequencedTaskRunner>
virtual scoped_refptr<base::SingleThreadTaskRunner>
GetBackgroundTaskRunner() OVERRIDE;
private:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment