summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/util
diff options
context:
space:
mode:
authortimsteele@google.com <timsteele@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-07 18:42:35 +0000
committertimsteele@google.com <timsteele@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-07 18:42:35 +0000
commitde32e5eec767c4472d708488f98619c7bc2f7227 (patch)
treed295030fbf6f1fe43dfed00a88ad68d909129429 /chrome/browser/sync/util
parent9424883141ce8f7c1052827f519f001c89a47213 (diff)
downloadchromium_src-de32e5eec767c4472d708488f98619c7bc2f7227.zip
chromium_src-de32e5eec767c4472d708488f98619c7bc2f7227.tar.gz
chromium_src-de32e5eec767c4472d708488f98619c7bc2f7227.tar.bz2
Sync: Replace pthread mutex with base::Lock in a few more places.
This leaves just ServerConnectionManager behind. BUG=19895 TEST=sync_unit_tests Review URL: http://codereview.chromium.org/251098 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28278 0039d316-1c4b-4281-b951-d872f2087c98
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