summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/password_manager/native_backend_gnome_x.cc47
-rw-r--r--chrome/browser/password_manager/password_store_x.cc4
-rw-r--r--chrome/browser/password_manager/password_store_x_unittest.cc28
3 files changed, 34 insertions, 45 deletions
diff --git a/chrome/browser/password_manager/native_backend_gnome_x.cc b/chrome/browser/password_manager/native_backend_gnome_x.cc
index eeb06196..1911c18 100644
--- a/chrome/browser/password_manager/native_backend_gnome_x.cc
+++ b/chrome/browser/password_manager/native_backend_gnome_x.cc
@@ -413,10 +413,6 @@ void GKRMethod::OnOperationGetList(GnomeKeyringResult result, GList* list,
} // namespace
-// GKRMethod isn't reference counted, but it always outlasts runnable
-// methods against it because the caller waits for those methods to run.
-DISABLE_RUNNABLE_METHOD_REFCOUNT(GKRMethod);
-
NativeBackendGnome::NativeBackendGnome(LocalProfileId id, PrefService* prefs)
: profile_id_(id), prefs_(prefs) {
if (PasswordStoreX::PasswordsUseLocalProfileId(prefs)) {
@@ -440,9 +436,9 @@ bool NativeBackendGnome::RawAddLogin(const PasswordForm& form) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
GKRMethod method;
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- NewRunnableMethod(&method,
- &GKRMethod::AddLogin,
- form, app_string_.c_str()));
+ base::Bind(&GKRMethod::AddLogin,
+ base::Unretained(&method),
+ form, app_string_.c_str()));
GnomeKeyringResult result = method.WaitResult();
if (result != GNOME_KEYRING_RESULT_OK) {
LOG(ERROR) << "Keyring save failed: "
@@ -464,9 +460,9 @@ bool NativeBackendGnome::AddLogin(const PasswordForm& form) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
GKRMethod method;
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- NewRunnableMethod(&method,
- &GKRMethod::AddLoginSearch,
- form, app_string_.c_str()));
+ base::Bind(&GKRMethod::AddLoginSearch,
+ base::Unretained(&method),
+ form, app_string_.c_str()));
PasswordFormList forms;
GnomeKeyringResult result = method.WaitResult(&forms);
if (result != GNOME_KEYRING_RESULT_OK &&
@@ -504,9 +500,9 @@ bool NativeBackendGnome::UpdateLogin(const PasswordForm& form) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
GKRMethod method;
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- NewRunnableMethod(&method,
- &GKRMethod::UpdateLoginSearch,
- form, app_string_.c_str()));
+ base::Bind(&GKRMethod::UpdateLoginSearch,
+ base::Unretained(&method),
+ form, app_string_.c_str()));
PasswordFormList forms;
GnomeKeyringResult result = method.WaitResult(&forms);
if (result != GNOME_KEYRING_RESULT_OK) {
@@ -550,9 +546,9 @@ bool NativeBackendGnome::RemoveLogin(const PasswordForm& form) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
GKRMethod method;
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- NewRunnableMethod(&method,
- &GKRMethod::RemoveLogin,
- form, app_string_.c_str()));
+ base::Bind(&GKRMethod::RemoveLogin,
+ base::Unretained(&method),
+ form, app_string_.c_str()));
GnomeKeyringResult result = method.WaitResult();
if (result != GNOME_KEYRING_RESULT_OK) {
LOG(ERROR) << "Keyring delete failed: "
@@ -595,9 +591,9 @@ bool NativeBackendGnome::GetLogins(const PasswordForm& form,
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
GKRMethod method;
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- NewRunnableMethod(&method,
- &GKRMethod::GetLogins,
- form, app_string_.c_str()));
+ base::Bind(&GKRMethod::GetLogins,
+ base::Unretained(&method),
+ form, app_string_.c_str()));
GnomeKeyringResult result = method.WaitResult(forms);
if (result == GNOME_KEYRING_RESULT_NO_MATCH)
return true;
@@ -652,10 +648,9 @@ bool NativeBackendGnome::GetLoginsList(PasswordFormList* forms,
GKRMethod method;
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- NewRunnableMethod(&method,
- &GKRMethod::GetLoginsList,
- blacklisted_by_user,
- app_string_.c_str()));
+ base::Bind(&GKRMethod::GetLoginsList,
+ base::Unretained(&method),
+ blacklisted_by_user, app_string_.c_str()));
GnomeKeyringResult result = method.WaitResult(forms);
if (result == GNOME_KEYRING_RESULT_NO_MATCH)
return true;
@@ -673,9 +668,9 @@ bool NativeBackendGnome::GetLoginsList(PasswordFormList* forms,
bool NativeBackendGnome::GetAllLogins(PasswordFormList* forms) {
GKRMethod method;
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- NewRunnableMethod(&method,
- &GKRMethod::GetAllLogins,
- app_string_.c_str()));
+ base::Bind(&GKRMethod::GetAllLogins,
+ base::Unretained(&method),
+ app_string_.c_str()));
GnomeKeyringResult result = method.WaitResult(forms);
if (result == GNOME_KEYRING_RESULT_NO_MATCH)
return true;
diff --git a/chrome/browser/password_manager/password_store_x.cc b/chrome/browser/password_manager/password_store_x.cc
index 397d509..b873e7c 100644
--- a/chrome/browser/password_manager/password_store_x.cc
+++ b/chrome/browser/password_manager/password_store_x.cc
@@ -8,6 +8,7 @@
#include <map>
#include <vector>
+#include "base/bind.h"
#include "base/logging.h"
#include "base/stl_util.h"
#include "chrome/browser/password_manager/password_store_change.h"
@@ -297,7 +298,6 @@ void PasswordStoreX::SetPasswordsUseLocalProfileId(PrefService* prefs) {
// This method should work on any thread, but we expect the DB thread.
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- NewRunnableFunction(UISetPasswordsUseLocalProfileId,
- prefs));
+ base::Bind(UISetPasswordsUseLocalProfileId, prefs));
}
#endif // !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX)
diff --git a/chrome/browser/password_manager/password_store_x_unittest.cc b/chrome/browser/password_manager/password_store_x_unittest.cc
index 1f6f069..495f8d5 100644
--- a/chrome/browser/password_manager/password_store_x_unittest.cc
+++ b/chrome/browser/password_manager/password_store_x_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/basictypes.h"
+#include "base/bind.h"
#include "base/file_util.h"
#include "base/platform_file.h"
#include "base/scoped_temp_dir.h"
@@ -69,9 +70,8 @@ class DBThreadObserverHelper
BrowserThread::PostTask(
BrowserThread::DB,
FROM_HERE,
- NewRunnableMethod(this,
- &DBThreadObserverHelper::AddObserverTask,
- make_scoped_refptr(password_store)));
+ base::Bind(&DBThreadObserverHelper::AddObserverTask,
+ this, make_scoped_refptr(password_store)));
done_event_.Wait();
}
@@ -268,10 +268,6 @@ void InitExpectedForms(bool autofillable, size_t count, VectorOfForms* forms) {
} // anonymous namespace
-// LoginDatabase isn't reference counted, but in these unit tests that won't be
-// a problem as it always outlives the threads we post tasks to.
-DISABLE_RUNNABLE_METHOD_REFCOUNT(LoginDatabase);
-
enum BackendType {
NO_BACKEND,
FAILING_BACKEND,
@@ -632,19 +628,17 @@ TEST_P(PasswordStoreXTest, NativeMigration) {
// Populate the login DB with logins that should be migrated.
for (VectorOfForms::iterator it = expected_autofillable.begin();
it != expected_autofillable.end(); ++it) {
- BrowserThread::PostTask(BrowserThread::DB,
- FROM_HERE,
- NewRunnableMethod(login_db,
- &LoginDatabase::AddLogin,
- **it));
+ BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
+ base::IgnoreReturn(base::Callback<bool(void)>(
+ base::Bind(&LoginDatabase::AddLogin,
+ base::Unretained(login_db), **it))));
}
for (VectorOfForms::iterator it = expected_blacklisted.begin();
it != expected_blacklisted.end(); ++it) {
- BrowserThread::PostTask(BrowserThread::DB,
- FROM_HERE,
- NewRunnableMethod(login_db,
- &LoginDatabase::AddLogin,
- **it));
+ BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
+ base::IgnoreReturn(base::Callback<bool(void)>(
+ base::Bind(&LoginDatabase::AddLogin,
+ base::Unretained(login_db), **it))));
}
// Schedule another task on the DB thread to notify us that it's safe to