summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/util
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/sync/util')
-rw-r--r--chrome/browser/sync/util/user_settings.cc12
-rw-r--r--chrome/browser/sync/util/user_settings.h9
2 files changed, 9 insertions, 12 deletions
diff --git a/chrome/browser/sync/util/user_settings.cc b/chrome/browser/sync/util/user_settings.cc
index 6dbde96..a8ab972 100644
--- a/chrome/browser/sync/util/user_settings.cc
+++ b/chrome/browser/sync/util/user_settings.cc
@@ -40,7 +40,7 @@ static const int kSaltSize = 20;
static const int kCurrentDBVersion = 11;
UserSettings::ScopedDBHandle::ScopedDBHandle(UserSettings* settings) :
- mutex_lock_(&settings->dbhandle_mutex_), handle_(&settings->dbhandle_) {
+ mutex_lock_(settings->dbhandle_mutex_), handle_(&settings->dbhandle_) {
}
UserSettings::UserSettings() :
@@ -48,7 +48,7 @@ UserSettings::UserSettings() :
}
string UserSettings::email() const {
- ScopedLock lock(&mutex_);
+ AutoLock lock(mutex_);
return email_;
}
@@ -260,10 +260,8 @@ void UserSettings::StoreHashedPassword(const string& email,
const string& password) {
// Save one-way hashed password:
char binary_salt[kSaltSize];
- {
- ScopedLock lock(&mutex_);
- GetRandomBytes(binary_salt, sizeof(binary_salt));
- }
+ GetRandomBytes(binary_salt, sizeof(binary_salt));
+
const string salt = APEncode(string(binary_salt, sizeof(binary_salt)));
MD5Calculator md5;
md5.AddData(salt.data(), salt.size());
@@ -311,7 +309,7 @@ bool UserSettings::VerifyAgainstStoredHash(const string& email,
void UserSettings::SwitchUser(const string& username) {
{
- ScopedLock lock(&mutex_);
+ AutoLock lock(mutex_);
email_ = username;
}
}
diff --git a/chrome/browser/sync/util/user_settings.h b/chrome/browser/sync/util/user_settings.h
index 303397a..60ad1a9 100644
--- a/chrome/browser/sync/util/user_settings.h
+++ b/chrome/browser/sync/util/user_settings.h
@@ -9,8 +9,8 @@
#include <set>
#include <string>
+#include "base/lock.h"
#include "build/build_config.h"
-#include "chrome/browser/sync/util/pthread_helpers.h"
#include "chrome/browser/sync/util/signin.h"
#include "chrome/browser/sync/util/sync_types.h"
@@ -80,7 +80,7 @@ class UserSettings {
struct ScopedDBHandle {
ScopedDBHandle(UserSettings* settings);
inline sqlite3* get() const { return *handle_; }
- PThreadScopedLock<PThreadMutex> mutex_lock_;
+ AutoLock mutex_lock_;
sqlite3** const handle_;
};
@@ -91,12 +91,11 @@ class UserSettings {
private:
std::string email_;
- mutable PThreadMutex mutex_; // protects email_
- typedef PThreadScopedLock<PThreadMutex> ScopedLock;
+ mutable Lock mutex_; // protects email_.
// We keep a single dbhandle.
sqlite3* dbhandle_;
- PThreadMutex dbhandle_mutex_;
+ Lock dbhandle_mutex_;
// TODO(sync): Use in-memory cache for service auth tokens on posix.
// Have someone competent in Windows switch it over to not use Sqlite in the