diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-21 04:55:52 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-21 04:55:52 +0000 |
commit | 20305ec6f1acf21392c2f3938a14a96f1e28e76d (patch) | |
tree | 6eff1f7be4bad1a1362d3466f0ac59292dc51acc /chrome | |
parent | c6e8346b56ab61b35845aefcf9b241c654fe1253 (diff) | |
download | chromium_src-20305ec6f1acf21392c2f3938a14a96f1e28e76d.zip chromium_src-20305ec6f1acf21392c2f3938a14a96f1e28e76d.tar.gz chromium_src-20305ec6f1acf21392c2f3938a14a96f1e28e76d.tar.bz2 |
Remove obsolete base/lock.h and fix up callers to use the new header file and
the base namespace. Fix several files including lock.h unnecessarily.
BUG=none
TEST=none
Original review=http://codereview.chromium.org/6142009/
Patch by leviw@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72106 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
129 files changed, 421 insertions, 431 deletions
diff --git a/chrome/browser/automation/automation_resource_message_filter.h b/chrome/browser/automation/automation_resource_message_filter.h index 89357e6..d1a192d 100644 --- a/chrome/browser/automation/automation_resource_message_filter.h +++ b/chrome/browser/automation/automation_resource_message_filter.h @@ -10,7 +10,6 @@ #include "base/atomicops.h" #include "base/lazy_instance.h" -#include "base/lock.h" #include "ipc/ipc_channel_proxy.h" #include "net/base/completion_callback.h" #include "net/base/cookie_store.h" diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc index a4091a3..31b99ce 100644 --- a/chrome/browser/bookmarks/bookmark_model.cc +++ b/chrome/browser/bookmarks/bookmark_model.cc @@ -296,7 +296,7 @@ void BookmarkModel::SetURL(const BookmarkNode* node, const GURL& url) { CancelPendingFavIconLoadRequests(AsMutable(node)); { - AutoLock url_lock(url_lock_); + base::AutoLock url_lock(url_lock_); NodesOrderedByURLSet::iterator i = nodes_ordered_by_url_set_.find( AsMutable(node)); DCHECK(i != nodes_ordered_by_url_set_.end()); @@ -323,7 +323,7 @@ bool BookmarkModel::IsLoaded() { void BookmarkModel::GetNodesByURL(const GURL& url, std::vector<const BookmarkNode*>* nodes) { - AutoLock url_lock(url_lock_); + base::AutoLock url_lock(url_lock_); BookmarkNode tmp_node(url); NodesOrderedByURLSet::iterator i = nodes_ordered_by_url_set_.find(&tmp_node); while (i != nodes_ordered_by_url_set_.end() && (*i)->GetURL() == url) { @@ -344,7 +344,7 @@ const BookmarkNode* BookmarkModel::GetMostRecentlyAddedNodeForURL( } void BookmarkModel::GetBookmarks(std::vector<GURL>* urls) { - AutoLock url_lock(url_lock_); + base::AutoLock url_lock(url_lock_); const GURL* last_url = NULL; for (NodesOrderedByURLSet::iterator i = nodes_ordered_by_url_set_.begin(); i != nodes_ordered_by_url_set_.end(); ++i) { @@ -357,12 +357,12 @@ void BookmarkModel::GetBookmarks(std::vector<GURL>* urls) { } bool BookmarkModel::HasBookmarks() { - AutoLock url_lock(url_lock_); + base::AutoLock url_lock(url_lock_); return !nodes_ordered_by_url_set_.empty(); } bool BookmarkModel::IsBookmarked(const GURL& url) { - AutoLock url_lock(url_lock_); + base::AutoLock url_lock(url_lock_); return IsBookmarkedNoLock(url); } @@ -419,7 +419,7 @@ const BookmarkNode* BookmarkModel::AddURLWithCreationTime( { // Only hold the lock for the duration of the insert. - AutoLock url_lock(url_lock_); + base::AutoLock url_lock(url_lock_); nodes_ordered_by_url_set_.insert(new_node); } @@ -574,7 +574,7 @@ void BookmarkModel::DoneLoading( root_.Add(1, other_node_); { - AutoLock url_lock(url_lock_); + base::AutoLock url_lock(url_lock_); // Update nodes_ordered_by_url_set_ from the nodes. PopulateNodesByURL(&root_); } @@ -602,7 +602,7 @@ void BookmarkModel::RemoveAndDeleteNode(BookmarkNode* delete_me) { parent->Remove(index); history::URLsStarredDetails details(false); { - AutoLock url_lock(url_lock_); + base::AutoLock url_lock(url_lock_); RemoveNode(node.get(), &details.changed_urls); // RemoveNode adds an entry to changed_urls for each node of type URL. As we diff --git a/chrome/browser/bookmarks/bookmark_model.h b/chrome/browser/bookmarks/bookmark_model.h index 703a78a..51e8a17 100644 --- a/chrome/browser/bookmarks/bookmark_model.h +++ b/chrome/browser/bookmarks/bookmark_model.h @@ -11,9 +11,9 @@ #include <set> #include <vector> -#include "base/lock.h" #include "base/observer_list.h" #include "base/string16.h" +#include "base/synchronization/lock.h" #include "base/synchronization/waitable_event.h" #include "chrome/browser/bookmarks/bookmark_model_observer.h" #include "chrome/browser/bookmarks/bookmark_service.h" @@ -455,7 +455,7 @@ class BookmarkModel : public NotificationObserver, public BookmarkService { // such, be sure and wrap all usage of it around url_lock_. typedef std::multiset<BookmarkNode*, NodeURLComparator> NodesOrderedByURLSet; NodesOrderedByURLSet nodes_ordered_by_url_set_; - Lock url_lock_; + base::Lock url_lock_; // Used for loading favicons and the empty history request. CancelableRequestConsumerTSimple<BookmarkNode*> load_consumer_; diff --git a/chrome/browser/browser_thread.cc b/chrome/browser/browser_thread.cc index 60d4450..877c2c5 100644 --- a/chrome/browser/browser_thread.cc +++ b/chrome/browser/browser_thread.cc @@ -63,7 +63,7 @@ class BrowserThreadMessageLoopProxy : public base::MessageLoopProxy { }; -Lock BrowserThread::lock_; +base::Lock BrowserThread::lock_; BrowserThread* BrowserThread::browser_threads_[ID_COUNT]; @@ -81,7 +81,7 @@ BrowserThread::BrowserThread(ID identifier, MessageLoop* message_loop) } void BrowserThread::Initialize() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); DCHECK(identifier_ >= 0 && identifier_ < ID_COUNT); DCHECK(browser_threads_[identifier_] == NULL); browser_threads_[identifier_] = this; @@ -93,7 +93,7 @@ BrowserThread::~BrowserThread() { // correct BrowserThread succeeds. Stop(); - AutoLock lock(lock_); + base::AutoLock lock(lock_); browser_threads_[identifier_] = NULL; #ifndef NDEBUG // Double check that the threads are ordered correctly in the enumeration. @@ -106,7 +106,7 @@ BrowserThread::~BrowserThread() { // static bool BrowserThread::IsWellKnownThread(ID identifier) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); return (identifier >= 0 && identifier < ID_COUNT && browser_threads_[identifier]); } @@ -118,7 +118,7 @@ bool BrowserThread::CurrentlyOn(ID identifier) { // function. // http://crbug.com/63678 base::ThreadRestrictions::ScopedAllowSingleton allow_singleton; - AutoLock lock(lock_); + base::AutoLock lock(lock_); DCHECK(identifier >= 0 && identifier < ID_COUNT); return browser_threads_[identifier] && browser_threads_[identifier]->message_loop() == MessageLoop::current(); @@ -126,7 +126,7 @@ bool BrowserThread::CurrentlyOn(ID identifier) { // static bool BrowserThread::IsMessageLoopValid(ID identifier) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); DCHECK(identifier >= 0 && identifier < ID_COUNT); return browser_threads_[identifier] && browser_threads_[identifier]->message_loop(); diff --git a/chrome/browser/browser_thread.h b/chrome/browser/browser_thread.h index ce3c295..dc4b00b 100644 --- a/chrome/browser/browser_thread.h +++ b/chrome/browser/browser_thread.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_BROWSER_THREAD_H_ #pragma once -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "base/task.h" #include "base/threading/thread.h" @@ -197,7 +197,7 @@ class BrowserThread : public base::Thread { // This lock protects |browser_threads_|. Do not read or modify that array // without holding this lock. Do not block while holding this lock. - static Lock lock_; + static base::Lock lock_; // An array of the BrowserThread objects. This array is protected by |lock_|. // The threads are not owned by this array. Typically, the threads are owned diff --git a/chrome/browser/cancelable_request.h b/chrome/browser/cancelable_request.h index 5f2b1c7..dce7a2c 100644 --- a/chrome/browser/cancelable_request.h +++ b/chrome/browser/cancelable_request.h @@ -92,12 +92,12 @@ #include "base/basictypes.h" #include "base/callback.h" -#include "base/lock.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "base/synchronization/cancellation_flag.h" +#include "base/synchronization/lock.h" #include "base/task.h" #include "build/build_config.h" diff --git a/chrome/browser/cert_store.cc b/chrome/browser/cert_store.cc index 30ef867..6def04e 100644 --- a/chrome/browser/cert_store.cc +++ b/chrome/browser/cert_store.cc @@ -46,7 +46,7 @@ CertStore::~CertStore() { int CertStore::StoreCert(net::X509Certificate* cert, int process_id) { DCHECK(cert); - AutoLock autoLock(cert_lock_); + base::AutoLock autoLock(cert_lock_); int cert_id; @@ -86,7 +86,7 @@ int CertStore::StoreCert(net::X509Certificate* cert, int process_id) { bool CertStore::RetrieveCert(int cert_id, scoped_refptr<net::X509Certificate>* cert) { - AutoLock autoLock(cert_lock_); + base::AutoLock autoLock(cert_lock_); CertMap::iterator iter = id_to_cert_.find(cert_id); if (iter == id_to_cert_.end()) @@ -109,7 +109,7 @@ void CertStore::RemoveCertInternal(int cert_id) { } void CertStore::RemoveCertsForRenderProcesHost(int process_id) { - AutoLock autoLock(cert_lock_); + base::AutoLock autoLock(cert_lock_); // We iterate through all the cert ids for that process. IDMap::iterator ids_iter; diff --git a/chrome/browser/cert_store.h b/chrome/browser/cert_store.h index 0af7ef4..fb5eeec 100644 --- a/chrome/browser/cert_store.h +++ b/chrome/browser/cert_store.h @@ -8,8 +8,8 @@ #include <map> -#include "base/lock.h" #include "base/singleton.h" +#include "base/synchronization/lock.h" #include "chrome/common/notification_observer.h" #include "chrome/common/notification_registrar.h" #include "net/base/x509_certificate.h" @@ -76,7 +76,7 @@ class CertStore : public NotificationObserver { // This lock protects: process_to_ids_, id_to_processes_, id_to_cert_ and // cert_to_id_. - Lock cert_lock_; + base::Lock cert_lock_; DISALLOW_COPY_AND_ASSIGN(CertStore); }; diff --git a/chrome/browser/child_process_launcher.cc b/chrome/browser/child_process_launcher.cc index 6058cc8..598bbef 100644 --- a/chrome/browser/child_process_launcher.cc +++ b/chrome/browser/child_process_launcher.cc @@ -7,9 +7,9 @@ #include <utility> // For std::pair. #include "base/command_line.h" -#include "base/lock.h" #include "base/logging.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "base/threading/thread.h" #include "chrome/browser/browser_thread.h" #include "chrome/common/chrome_descriptors.h" @@ -174,7 +174,7 @@ class ChildProcessLauncher::Context // AddPlaceholderForPid(), enabling proper cleanup. { // begin scope for AutoLock MachBroker* broker = MachBroker::GetInstance(); - AutoLock lock(broker->GetLock()); + base::AutoLock lock(broker->GetLock()); // This call to |PrepareForFork()| will start the MachBroker listener // thread, if it is not already running. Therefore the browser process diff --git a/chrome/browser/child_process_security_policy.cc b/chrome/browser/child_process_security_policy.cc index ea1f725..0ea3e1d 100644 --- a/chrome/browser/child_process_security_policy.cc +++ b/chrome/browser/child_process_security_policy.cc @@ -151,7 +151,7 @@ ChildProcessSecurityPolicy* ChildProcessSecurityPolicy::GetInstance() { } void ChildProcessSecurityPolicy::Add(int child_id) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (security_state_.count(child_id) != 0) { NOTREACHED() << "Add child process at most once."; return; @@ -161,7 +161,7 @@ void ChildProcessSecurityPolicy::Add(int child_id) { } void ChildProcessSecurityPolicy::Remove(int child_id) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (!security_state_.count(child_id)) return; // May be called multiple times. @@ -171,7 +171,7 @@ void ChildProcessSecurityPolicy::Remove(int child_id) { void ChildProcessSecurityPolicy::RegisterWebSafeScheme( const std::string& scheme) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); DCHECK(web_safe_schemes_.count(scheme) == 0) << "Add schemes at most once."; DCHECK(pseudo_schemes_.count(scheme) == 0) << "Web-safe implies not psuedo."; @@ -179,14 +179,14 @@ void ChildProcessSecurityPolicy::RegisterWebSafeScheme( } bool ChildProcessSecurityPolicy::IsWebSafeScheme(const std::string& scheme) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); return (web_safe_schemes_.find(scheme) != web_safe_schemes_.end()); } void ChildProcessSecurityPolicy::RegisterPseudoScheme( const std::string& scheme) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); DCHECK(pseudo_schemes_.count(scheme) == 0) << "Add schemes at most once."; DCHECK(web_safe_schemes_.count(scheme) == 0) << "Psuedo implies not web-safe."; @@ -195,7 +195,7 @@ void ChildProcessSecurityPolicy::RegisterPseudoScheme( } bool ChildProcessSecurityPolicy::IsPseudoScheme(const std::string& scheme) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); return (pseudo_schemes_.find(scheme) != pseudo_schemes_.end()); } @@ -224,7 +224,7 @@ void ChildProcessSecurityPolicy::GrantRequestURL( } { - AutoLock lock(lock_); + base::AutoLock lock(lock_); SecurityStateMap::iterator state = security_state_.find(child_id); if (state == security_state_.end()) return; @@ -242,7 +242,7 @@ void ChildProcessSecurityPolicy::GrantReadFile(int child_id, void ChildProcessSecurityPolicy::GrantPermissionsForFile( int child_id, const FilePath& file, int permissions) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); SecurityStateMap::iterator state = security_state_.find(child_id); if (state == security_state_.end()) @@ -253,7 +253,7 @@ void ChildProcessSecurityPolicy::GrantPermissionsForFile( void ChildProcessSecurityPolicy::RevokeAllPermissionsForFile( int child_id, const FilePath& file) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); SecurityStateMap::iterator state = security_state_.find(child_id); if (state == security_state_.end()) @@ -264,7 +264,7 @@ void ChildProcessSecurityPolicy::RevokeAllPermissionsForFile( void ChildProcessSecurityPolicy::GrantScheme(int child_id, const std::string& scheme) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); SecurityStateMap::iterator state = security_state_.find(child_id); if (state == security_state_.end()) @@ -274,7 +274,7 @@ void ChildProcessSecurityPolicy::GrantScheme(int child_id, } void ChildProcessSecurityPolicy::GrantDOMUIBindings(int child_id) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); SecurityStateMap::iterator state = security_state_.find(child_id); if (state == security_state_.end()) @@ -290,7 +290,7 @@ void ChildProcessSecurityPolicy::GrantDOMUIBindings(int child_id) { } void ChildProcessSecurityPolicy::GrantExtensionBindings(int child_id) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); SecurityStateMap::iterator state = security_state_.find(child_id); if (state == security_state_.end()) @@ -300,7 +300,7 @@ void ChildProcessSecurityPolicy::GrantExtensionBindings(int child_id) { } void ChildProcessSecurityPolicy::GrantReadRawCookies(int child_id) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); SecurityStateMap::iterator state = security_state_.find(child_id); if (state == security_state_.end()) @@ -310,7 +310,7 @@ void ChildProcessSecurityPolicy::GrantReadRawCookies(int child_id) { } void ChildProcessSecurityPolicy::RevokeReadRawCookies(int child_id) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); SecurityStateMap::iterator state = security_state_.find(child_id); if (state == security_state_.end()) @@ -354,7 +354,7 @@ bool ChildProcessSecurityPolicy::CanRequestURL( return true; // This URL request is destined for ShellExecute. { - AutoLock lock(lock_); + base::AutoLock lock(lock_); SecurityStateMap::iterator state = security_state_.find(child_id); if (state == security_state_.end()) @@ -373,7 +373,7 @@ bool ChildProcessSecurityPolicy::CanReadFile(int child_id, bool ChildProcessSecurityPolicy::HasPermissionsForFile( int child_id, const FilePath& file, int permissions) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); SecurityStateMap::iterator state = security_state_.find(child_id); if (state == security_state_.end()) @@ -383,7 +383,7 @@ bool ChildProcessSecurityPolicy::HasPermissionsForFile( } bool ChildProcessSecurityPolicy::HasDOMUIBindings(int child_id) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); SecurityStateMap::iterator state = security_state_.find(child_id); if (state == security_state_.end()) @@ -393,7 +393,7 @@ bool ChildProcessSecurityPolicy::HasDOMUIBindings(int child_id) { } bool ChildProcessSecurityPolicy::HasExtensionBindings(int child_id) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); SecurityStateMap::iterator state = security_state_.find(child_id); if (state == security_state_.end()) @@ -403,7 +403,7 @@ bool ChildProcessSecurityPolicy::HasExtensionBindings(int child_id) { } bool ChildProcessSecurityPolicy::CanReadRawCookies(int child_id) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); SecurityStateMap::iterator state = security_state_.find(child_id); if (state == security_state_.end()) diff --git a/chrome/browser/child_process_security_policy.h b/chrome/browser/child_process_security_policy.h index 9280400..dd2244d 100644 --- a/chrome/browser/child_process_security_policy.h +++ b/chrome/browser/child_process_security_policy.h @@ -13,8 +13,8 @@ #include "base/basictypes.h" #include "base/gtest_prod_util.h" -#include "base/lock.h" #include "base/singleton.h" +#include "base/synchronization/lock.h" class FilePath; class GURL; @@ -141,7 +141,7 @@ class ChildProcessSecurityPolicy { // You must acquire this lock before reading or writing any members of this // class. You must not block while holding this lock. - Lock lock_; + base::Lock lock_; // These schemes are white-listed for all child processes. This set is // protected by |lock_|. diff --git a/chrome/browser/chromeos/audio_mixer_alsa.cc b/chrome/browser/chromeos/audio_mixer_alsa.cc index 1dcc964..28e51147 100644 --- a/chrome/browser/chromeos/audio_mixer_alsa.cc +++ b/chrome/browser/chromeos/audio_mixer_alsa.cc @@ -79,7 +79,7 @@ bool AudioMixerAlsa::InitSync() { } double AudioMixerAlsa::GetVolumeDb() const { - AutoLock lock(mixer_state_lock_); + base::AutoLock lock(mixer_state_lock_); if (mixer_state_ != READY) return kSilenceDb; @@ -87,7 +87,7 @@ double AudioMixerAlsa::GetVolumeDb() const { } bool AudioMixerAlsa::GetVolumeLimits(double* vol_min, double* vol_max) { - AutoLock lock(mixer_state_lock_); + base::AutoLock lock(mixer_state_lock_); if (mixer_state_ != READY) return false; if (vol_min) @@ -98,7 +98,7 @@ bool AudioMixerAlsa::GetVolumeLimits(double* vol_min, double* vol_max) { } void AudioMixerAlsa::SetVolumeDb(double vol_db) { - AutoLock lock(mixer_state_lock_); + base::AutoLock lock(mixer_state_lock_); if (mixer_state_ != READY) return; if (vol_db < kSilenceDb) @@ -108,7 +108,7 @@ void AudioMixerAlsa::SetVolumeDb(double vol_db) { } bool AudioMixerAlsa::IsMute() const { - AutoLock lock(mixer_state_lock_); + base::AutoLock lock(mixer_state_lock_); if (mixer_state_ != READY) return false; return GetElementMuted_Locked(elem_master_); @@ -121,7 +121,7 @@ static bool PrefVolumeValid(double volume) { } void AudioMixerAlsa::SetMute(bool mute) { - AutoLock lock(mixer_state_lock_); + base::AutoLock lock(mixer_state_lock_); if (mixer_state_ != READY) return; @@ -150,7 +150,7 @@ void AudioMixerAlsa::SetMute(bool mute) { } AudioMixer::State AudioMixerAlsa::GetState() const { - AutoLock lock(mixer_state_lock_); + base::AutoLock lock(mixer_state_lock_); // If we think it's ready, verify it is actually so. if ((mixer_state_ == READY) && (alsa_mixer_ == NULL)) mixer_state_ = IN_ERROR; @@ -184,7 +184,7 @@ void AudioMixerAlsa::DoInit(InitDoneCallback* callback) { } bool AudioMixerAlsa::InitThread() { - AutoLock lock(mixer_state_lock_); + base::AutoLock lock(mixer_state_lock_); if (mixer_state_ != UNINITIALIZED) return false; @@ -209,7 +209,7 @@ void AudioMixerAlsa::InitPrefs() { } bool AudioMixerAlsa::InitializeAlsaMixer() { - AutoLock lock(mixer_state_lock_); + base::AutoLock lock(mixer_state_lock_); if (mixer_state_ != INITIALIZING) return false; @@ -273,7 +273,7 @@ bool AudioMixerAlsa::InitializeAlsaMixer() { } void AudioMixerAlsa::FreeAlsaMixer() { - AutoLock lock(mixer_state_lock_); + base::AutoLock lock(mixer_state_lock_); mixer_state_ = SHUTTING_DOWN; if (alsa_mixer_) { snd_mixer_close(alsa_mixer_); @@ -282,7 +282,7 @@ void AudioMixerAlsa::FreeAlsaMixer() { } void AudioMixerAlsa::DoSetVolumeMute(double pref_volume, int pref_mute) { - AutoLock lock(mixer_state_lock_); + base::AutoLock lock(mixer_state_lock_); if (mixer_state_ != READY) return; diff --git a/chrome/browser/chromeos/audio_mixer_alsa.h b/chrome/browser/chromeos/audio_mixer_alsa.h index 2cd8489..56010de 100644 --- a/chrome/browser/chromeos/audio_mixer_alsa.h +++ b/chrome/browser/chromeos/audio_mixer_alsa.h @@ -8,8 +8,8 @@ #include "base/basictypes.h" #include "base/callback.h" -#include "base/lock.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "base/threading/thread.h" #include "chrome/browser/chromeos/audio_mixer.h" #include "chrome/browser/prefs/pref_member.h" @@ -88,7 +88,7 @@ class AudioMixerAlsa : public AudioMixer { // no effect. double save_volume_; - mutable Lock mixer_state_lock_; + mutable base::Lock mixer_state_lock_; mutable State mixer_state_; // Cached contexts for use in ALSA calls. diff --git a/chrome/browser/chromeos/audio_mixer_pulse.cc b/chrome/browser/chromeos/audio_mixer_pulse.cc index 0001548..ddff135 100644 --- a/chrome/browser/chromeos/audio_mixer_pulse.cc +++ b/chrome/browser/chromeos/audio_mixer_pulse.cc @@ -144,7 +144,7 @@ void AudioMixerPulse::SetMute(bool mute) { } AudioMixer::State AudioMixerPulse::GetState() const { - AutoLock lock(mixer_state_lock_); + base::AutoLock lock(mixer_state_lock_); // If we think it's ready, verify it is actually so. if ((mixer_state_ == READY) && (pa_context_get_state(pa_context_) != PA_CONTEXT_READY)) @@ -162,7 +162,7 @@ void AudioMixerPulse::DoInit(InitDoneCallback* callback) { } bool AudioMixerPulse::InitThread() { - AutoLock lock(mixer_state_lock_); + base::AutoLock lock(mixer_state_lock_); if (mixer_state_ != UNINITIALIZED) return false; @@ -202,7 +202,7 @@ bool AudioMixerPulse::PulseAudioInit() { pa_context_state_t state = PA_CONTEXT_FAILED; { - AutoLock lock(mixer_state_lock_); + base::AutoLock lock(mixer_state_lock_); if (mixer_state_ != INITIALIZING) return false; @@ -286,7 +286,7 @@ bool AudioMixerPulse::PulseAudioInit() { break; { - AutoLock lock(mixer_state_lock_); + base::AutoLock lock(mixer_state_lock_); if (mixer_state_ == SHUTTING_DOWN) return false; mixer_state_ = READY; @@ -302,7 +302,7 @@ bool AudioMixerPulse::PulseAudioInit() { void AudioMixerPulse::PulseAudioFree() { { - AutoLock lock(mixer_state_lock_); + base::AutoLock lock(mixer_state_lock_); if (!pa_mainloop_) mixer_state_ = UNINITIALIZED; if ((mixer_state_ == UNINITIALIZED) || (mixer_state_ == SHUTTING_DOWN)) @@ -327,7 +327,7 @@ void AudioMixerPulse::PulseAudioFree() { pa_mainloop_ = NULL; { - AutoLock lock(mixer_state_lock_); + base::AutoLock lock(mixer_state_lock_); mixer_state_ = UNINITIALIZED; } } @@ -441,7 +441,7 @@ inline void AudioMixerPulse::MainloopSignal() const { } inline bool AudioMixerPulse::MainloopSafeLock() const { - AutoLock lock(mixer_state_lock_); + base::AutoLock lock(mixer_state_lock_); if ((mixer_state_ == SHUTTING_DOWN) || (!pa_mainloop_)) return false; @@ -451,7 +451,7 @@ inline bool AudioMixerPulse::MainloopSafeLock() const { } inline bool AudioMixerPulse::MainloopLockIfReady() const { - AutoLock lock(mixer_state_lock_); + base::AutoLock lock(mixer_state_lock_); if (mixer_state_ != READY) return false; if (!pa_mainloop_) diff --git a/chrome/browser/chromeos/audio_mixer_pulse.h b/chrome/browser/chromeos/audio_mixer_pulse.h index 8ce8274..4eb3f9c 100644 --- a/chrome/browser/chromeos/audio_mixer_pulse.h +++ b/chrome/browser/chromeos/audio_mixer_pulse.h @@ -8,8 +8,8 @@ #include "base/basictypes.h" #include "base/callback.h" -#include "base/lock.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "base/threading/thread.h" #include "chrome/browser/chromeos/audio_mixer.h" @@ -100,7 +100,7 @@ class AudioMixerPulse : public AudioMixer { // For informational purposes only, just used to assert lock is held. mutable int mainloop_lock_count_; - mutable Lock mixer_state_lock_; + mutable base::Lock mixer_state_lock_; mutable State mixer_state_; // Cached contexts for use in PulseAudio calls. diff --git a/chrome/browser/chromeos/dom_ui/system_settings_provider.cc b/chrome/browser/chromeos/dom_ui/system_settings_provider.cc index fcfa7dc..2667e0c 100644 --- a/chrome/browser/chromeos/dom_ui/system_settings_provider.cc +++ b/chrome/browser/chromeos/dom_ui/system_settings_provider.cc @@ -8,11 +8,11 @@ #include "app/l10n_util.h" #include "base/i18n/rtl.h" -#include "base/lock.h" #include "base/scoped_ptr.h" #include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/stringprintf.h" +#include "base/synchronization/lock.h" #include "base/time.h" #include "base/utf_string_conversions.h" #include "base/values.h" @@ -120,7 +120,7 @@ static const char* kTimeZones[] = { "Pacific/Tongatapu", }; -static Lock timezone_bundle_lock; +static base::Lock timezone_bundle_lock; struct UResClose { inline void operator() (UResourceBundle* b) const { @@ -138,7 +138,7 @@ string16 GetExemplarCity(const icu::TimeZone& zone) { UErrorCode status = U_ZERO_ERROR; { - AutoLock lock(timezone_bundle_lock); + base::AutoLock lock(timezone_bundle_lock); if (zone_bundle == NULL) zone_bundle = ures_open(zone_bundle_name, uloc_getDefault(), &status); diff --git a/chrome/browser/chromeos/login/camera.cc b/chrome/browser/chromeos/login/camera.cc index bfc8136..7c2c2e4 100644 --- a/chrome/browser/chromeos/login/camera.cc +++ b/chrome/browser/chromeos/login/camera.cc @@ -324,7 +324,7 @@ void Camera::DoStopCapturing() { } void Camera::GetFrame(SkBitmap* frame) { - AutoLock lock(image_lock_); + base::AutoLock lock(image_lock_); frame->swap(frame_image_); } @@ -527,7 +527,7 @@ void Camera::ProcessImage(void* data) { } image.setIsOpaque(true); { - AutoLock lock(image_lock_); + base::AutoLock lock(image_lock_); frame_image_.swap(image); } BrowserThread::PostTask( @@ -573,13 +573,13 @@ void Camera::OnCaptureFailure() { } bool Camera::IsOnCameraThread() const { - AutoLock lock(thread_lock_); + base::AutoLock lock(thread_lock_); return thread_ && MessageLoop::current() == thread_->message_loop(); } void Camera::PostCameraTask(const tracked_objects::Location& from_here, Task* task) { - AutoLock lock(thread_lock_); + base::AutoLock lock(thread_lock_); if (!thread_) return; DCHECK(thread_->IsRunning()); diff --git a/chrome/browser/chromeos/login/camera.h b/chrome/browser/chromeos/login/camera.h index c30f2df..9b51088 100644 --- a/chrome/browser/chromeos/login/camera.h +++ b/chrome/browser/chromeos/login/camera.h @@ -9,8 +9,8 @@ #include <string> #include <vector> -#include "base/lock.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #include "base/threading/thread.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -181,10 +181,10 @@ class Camera : public base::RefCountedThreadSafe<Camera> { SkBitmap frame_image_; // Lock that guards references to |frame_image_|. - mutable Lock image_lock_; + mutable base::Lock image_lock_; // Lock that guards references to |camera_thread_|. - mutable Lock thread_lock_; + mutable base::Lock thread_lock_; DISALLOW_COPY_AND_ASSIGN(Camera); }; diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc index a11c66f..65e4214 100644 --- a/chrome/browser/chromeos/login/login_utils.cc +++ b/chrome/browser/chromeos/login/login_utils.cc @@ -9,12 +9,12 @@ #include "base/command_line.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/lock.h" #include "base/path_service.h" #include "base/scoped_ptr.h" #include "base/singleton.h" #include "base/string_util.h" #include "base/stringprintf.h" +#include "base/synchronization/lock.h" #include "base/time.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" @@ -172,7 +172,7 @@ class LoginUtilsWrapper { } LoginUtils* get() { - AutoLock create(create_lock_); + base::AutoLock create(create_lock_); if (!ptr_.get()) reset(new LoginUtilsImpl); return ptr_.get(); @@ -187,7 +187,7 @@ class LoginUtilsWrapper { LoginUtilsWrapper() {} - Lock create_lock_; + base::Lock create_lock_; scoped_ptr<LoginUtils> ptr_; DISALLOW_COPY_AND_ASSIGN(LoginUtilsWrapper); diff --git a/chrome/browser/content_settings/host_content_settings_map.cc b/chrome/browser/content_settings/host_content_settings_map.cc index 133e66f..d893d69 100644 --- a/chrome/browser/content_settings/host_content_settings_map.cc +++ b/chrome/browser/content_settings/host_content_settings_map.cc @@ -225,7 +225,7 @@ ContentSetting HostContentSettingsMap::GetNonDefaultContentSetting( return GetDefaultContentSetting(content_type); } - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); const std::string host(net::GetHostOrSpecFromURL(url)); ContentSettingsTypeResourceIdentifierPair @@ -307,7 +307,7 @@ ContentSettings HostContentSettingsMap::GetNonDefaultContentSettings( if (ShouldAllowAllContent(url)) return ContentSettings(CONTENT_SETTING_ALLOW); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); const std::string host(net::GetHostOrSpecFromURL(url)); ContentSettings output; @@ -371,7 +371,7 @@ void HostContentSettingsMap::GetSettingsForOneType( ContentSettingsTypeResourceIdentifierPair requested_setting(content_type, resource_identifier); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); for (HostContentSettings::const_iterator i(map_to_return->begin()); i != map_to_return->end(); ++i) { ContentSetting setting; @@ -446,7 +446,7 @@ void HostContentSettingsMap::SetContentSetting( } { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (!map_to_modify->count(pattern_str)) (*map_to_modify)[pattern_str].content_settings = ContentSettings(); HostContentSettings::iterator @@ -556,7 +556,7 @@ void HostContentSettingsMap::ClearSettingsForOneType( } { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); for (HostContentSettings::iterator i(map_to_modify->begin()); i != map_to_modify->end(); ) { if (RequiresResourceIdentifier(content_type) || @@ -626,7 +626,7 @@ void HostContentSettingsMap::SetBlockThirdPartyCookies(bool block) { } { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); block_third_party_cookies_ = block; } @@ -647,7 +647,7 @@ void HostContentSettingsMap::SetBlockNonsandboxedPlugins(bool block) { } { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); block_nonsandboxed_plugins_ = block; } @@ -668,7 +668,7 @@ void HostContentSettingsMap::ResetToDefaults() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); for (provider_iterator provider = content_settings_providers_.begin(); provider != content_settings_providers_.end(); ++provider) { (*provider)->ResetToDefaults(); @@ -711,14 +711,14 @@ void HostContentSettingsMap::Observe(NotificationType type, if (*name == prefs::kContentSettingsPatterns) { ReadExceptions(true); } else if (*name == prefs::kBlockThirdPartyCookies) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); block_third_party_cookies_ = profile_->GetPrefs()->GetBoolean( prefs::kBlockThirdPartyCookies); is_block_third_party_cookies_managed_ = profile_->GetPrefs()->IsManagedPreference( prefs::kBlockThirdPartyCookies); } else if (*name == prefs::kBlockNonsandboxedPlugins) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); block_nonsandboxed_plugins_ = profile_->GetPrefs()->GetBoolean( prefs::kBlockNonsandboxedPlugins); } else { @@ -822,7 +822,7 @@ bool HostContentSettingsMap::IsDefaultContentSettingManaged( } void HostContentSettingsMap::ReadExceptions(bool overwrite) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); PrefService* prefs = profile_->GetPrefs(); DictionaryValue* all_settings_dictionary = diff --git a/chrome/browser/content_settings/host_content_settings_map.h b/chrome/browser/content_settings/host_content_settings_map.h index 915d974..a557223 100644 --- a/chrome/browser/content_settings/host_content_settings_map.h +++ b/chrome/browser/content_settings/host_content_settings_map.h @@ -16,8 +16,8 @@ #include "base/basictypes.h" #include "base/linked_ptr.h" -#include "base/lock.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/content_settings/content_settings_pattern.h" #include "chrome/browser/prefs/pref_change_registrar.h" @@ -233,7 +233,7 @@ class HostContentSettingsMap content_settings_providers_; // Used around accesses to the following objects to guarantee thread safety. - mutable Lock lock_; + mutable base::Lock lock_; // Copies of the pref data, so that we can read it on threads other than the // UI thread. diff --git a/chrome/browser/content_settings/policy_content_settings_provider.cc b/chrome/browser/content_settings/policy_content_settings_provider.cc index d1cafb2..d271e74 100644 --- a/chrome/browser/content_settings/policy_content_settings_provider.cc +++ b/chrome/browser/content_settings/policy_content_settings_provider.cc @@ -71,7 +71,7 @@ PolicyContentSettingsProvider::~PolicyContentSettingsProvider() { bool PolicyContentSettingsProvider::CanProvideDefaultSetting( ContentSettingsType content_type) const { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (managed_default_content_settings_.settings[content_type] != CONTENT_SETTING_DEFAULT) { return true; @@ -82,7 +82,7 @@ bool PolicyContentSettingsProvider::CanProvideDefaultSetting( ContentSetting PolicyContentSettingsProvider::ProvideDefaultSetting( ContentSettingsType content_type) const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return managed_default_content_settings_.settings[content_type]; } @@ -93,7 +93,7 @@ void PolicyContentSettingsProvider::UpdateDefaultSetting( bool PolicyContentSettingsProvider::DefaultSettingIsManaged( ContentSettingsType content_type) const { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (managed_default_content_settings_.settings[content_type] != CONTENT_SETTING_DEFAULT) { return true; @@ -183,7 +183,7 @@ void PolicyContentSettingsProvider::UpdateManagedDefaultSetting( PrefService* prefs = profile_->GetPrefs(); DCHECK(!prefs->HasPrefPath(kPrefToManageType[type]) || prefs->IsManagedPreference(kPrefToManageType[type])); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); managed_default_content_settings_.settings[type] = IntToContentSetting( prefs->GetInteger(kPrefToManageType[type])); } diff --git a/chrome/browser/content_settings/policy_content_settings_provider.h b/chrome/browser/content_settings/policy_content_settings_provider.h index 1844234..320c054 100644 --- a/chrome/browser/content_settings/policy_content_settings_provider.h +++ b/chrome/browser/content_settings/policy_content_settings_provider.h @@ -9,7 +9,7 @@ // A content settings provider that takes its settings out of policies. #include "base/basictypes.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "chrome/browser/content_settings/content_settings_provider.h" #include "chrome/browser/prefs/pref_change_registrar.h" #include "chrome/common/notification_observer.h" @@ -67,7 +67,7 @@ class PolicyContentSettingsProvider : public ContentSettingsProviderInterface, // Used around accesses to the managed_default_content_settings_ object to // guarantee thread safety. - mutable Lock lock_; + mutable base::Lock lock_; PrefChangeRegistrar pref_change_registrar_; NotificationRegistrar notification_registrar_; diff --git a/chrome/browser/content_settings/pref_content_settings_provider.cc b/chrome/browser/content_settings/pref_content_settings_provider.cc index 01ac055..0afe1f9 100644 --- a/chrome/browser/content_settings/pref_content_settings_provider.cc +++ b/chrome/browser/content_settings/pref_content_settings_provider.cc @@ -85,7 +85,7 @@ bool PrefContentSettingsProvider::CanProvideDefaultSetting( ContentSetting PrefContentSettingsProvider::ProvideDefaultSetting( ContentSettingsType content_type) const { - AutoLock lock(lock_); + base::AutoLock lock(lock_); return default_content_settings_.settings[content_type]; } @@ -111,7 +111,7 @@ void PrefContentSettingsProvider::UpdateDefaultSetting( std::string dictionary_path(kTypeNames[content_type]); updating_preferences_ = true; { - AutoLock lock(lock_); + base::AutoLock lock(lock_); ScopedPrefUpdate update(prefs, prefs::kDefaultContentSettings); if ((setting == CONTENT_SETTING_DEFAULT) || (setting == kDefaultSettings[content_type])) { @@ -138,7 +138,7 @@ bool PrefContentSettingsProvider::DefaultSettingIsManaged( void PrefContentSettingsProvider::ResetToDefaults() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - AutoLock lock(lock_); + base::AutoLock lock(lock_); default_content_settings_ = ContentSettings(); ForceDefaultsToBeExplicit(); @@ -195,7 +195,7 @@ void PrefContentSettingsProvider::ReadDefaultSettings(bool overwrite) { const DictionaryValue* default_settings_dictionary = prefs->GetDictionary(prefs::kDefaultContentSettings); - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (overwrite) default_content_settings_ = ContentSettings(); diff --git a/chrome/browser/content_settings/pref_content_settings_provider.h b/chrome/browser/content_settings/pref_content_settings_provider.h index 178e903..442851e 100644 --- a/chrome/browser/content_settings/pref_content_settings_provider.h +++ b/chrome/browser/content_settings/pref_content_settings_provider.h @@ -9,7 +9,7 @@ // A content settings provider that takes its settings out of the pref service. #include "base/basictypes.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "chrome/browser/content_settings/content_settings_provider.h" #include "chrome/browser/prefs/pref_change_registrar.h" #include "chrome/common/notification_observer.h" @@ -73,7 +73,7 @@ class PrefContentSettingsProvider : public ContentSettingsProviderInterface, // Used around accesses to the default_content_settings_ object to guarantee // thread safety. - mutable Lock lock_; + mutable base::Lock lock_; PrefChangeRegistrar pref_change_registrar_; NotificationRegistrar notification_registrar_; diff --git a/chrome/browser/cross_site_request_manager.cc b/chrome/browser/cross_site_request_manager.cc index d12e9a4..6514933 100644 --- a/chrome/browser/cross_site_request_manager.cc +++ b/chrome/browser/cross_site_request_manager.cc @@ -8,7 +8,7 @@ bool CrossSiteRequestManager::HasPendingCrossSiteRequest(int renderer_id, int render_view_id) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); std::pair<int, int> key(renderer_id, render_view_id); return pending_cross_site_views_.find(key) != @@ -18,7 +18,7 @@ bool CrossSiteRequestManager::HasPendingCrossSiteRequest(int renderer_id, void CrossSiteRequestManager::SetHasPendingCrossSiteRequest(int renderer_id, int render_view_id, bool has_pending) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); std::pair<int, int> key(renderer_id, render_view_id); if (has_pending) { diff --git a/chrome/browser/cross_site_request_manager.h b/chrome/browser/cross_site_request_manager.h index 6c90b24..6615ad1 100644 --- a/chrome/browser/cross_site_request_manager.h +++ b/chrome/browser/cross_site_request_manager.h @@ -10,7 +10,7 @@ #include <utility> #include "base/basictypes.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" template <typename T> struct DefaultSingletonTraits; @@ -47,7 +47,7 @@ class CrossSiteRequestManager { // You must acquire this lock before reading or writing any members of this // class. You must not block while holding this lock. - Lock lock_; + base::Lock lock_; // Set of (render_process_host_id, render_view_id) pairs of all // RenderViewHosts that have pending cross-site requests. Used to pass diff --git a/chrome/browser/device_orientation/provider_unittest.cc b/chrome/browser/device_orientation/provider_unittest.cc index a84de5bc..131504a 100644 --- a/chrome/browser/device_orientation/provider_unittest.cc +++ b/chrome/browser/device_orientation/provider_unittest.cc @@ -4,8 +4,8 @@ #include <queue> -#include "base/lock.h" #include "base/message_loop.h" +#include "base/synchronization/lock.h" #include "base/task.h" #include "chrome/browser/device_orientation/data_fetcher.h" #include "chrome/browser/device_orientation/orientation.h" @@ -78,7 +78,7 @@ class MockOrientationFactory : public base::RefCounted<MockOrientationFactory> { } void SetOrientation(const Orientation& orientation) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); orientation_ = orientation; } @@ -91,7 +91,7 @@ class MockOrientationFactory : public base::RefCounted<MockOrientationFactory> { // From DataFetcher. Called by the Provider. virtual bool GetOrientation(Orientation* orientation) { - AutoLock auto_lock(orientation_factory_->lock_); + base::AutoLock auto_lock(orientation_factory_->lock_); *orientation = orientation_factory_->orientation_; return true; } @@ -102,7 +102,7 @@ class MockOrientationFactory : public base::RefCounted<MockOrientationFactory> { static MockOrientationFactory* instance_; Orientation orientation_; - Lock lock_; + base::Lock lock_; }; MockOrientationFactory* MockOrientationFactory::instance_; diff --git a/chrome/browser/download/download_file_manager.cc b/chrome/browser/download/download_file_manager.cc index b897464..05b8147 100644 --- a/chrome/browser/download/download_file_manager.cc +++ b/chrome/browser/download/download_file_manager.cc @@ -196,7 +196,7 @@ void DownloadFileManager::UpdateDownload(int id, DownloadBuffer* buffer) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); std::vector<DownloadBuffer::Contents> contents; { - AutoLock auto_lock(buffer->lock); + base::AutoLock auto_lock(buffer->lock); contents.swap(buffer->contents); } diff --git a/chrome/browser/download/download_types.h b/chrome/browser/download/download_types.h index bf3a9c7..56d07af 100644 --- a/chrome/browser/download/download_types.h +++ b/chrome/browser/download/download_types.h @@ -10,7 +10,7 @@ #include "base/file_path.h" #include "base/linked_ptr.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "net/base/file_stream.h" namespace net { @@ -27,7 +27,7 @@ struct DownloadBuffer { DownloadBuffer(); ~DownloadBuffer(); - Lock lock; + base::Lock lock; typedef std::pair<net::IOBuffer*, int> Contents; std::vector<Contents> contents; }; diff --git a/chrome/browser/file_path_watcher/file_path_watcher_inotify.cc b/chrome/browser/file_path_watcher/file_path_watcher_inotify.cc index bc59a2e..19a18a69 100644 --- a/chrome/browser/file_path_watcher/file_path_watcher_inotify.cc +++ b/chrome/browser/file_path_watcher/file_path_watcher_inotify.cc @@ -21,10 +21,10 @@ #include "base/file_util.h" #include "base/hash_tables.h" #include "base/lazy_instance.h" -#include "base/lock.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "base/task.h" #include "base/threading/thread.h" @@ -62,7 +62,7 @@ class InotifyReader { base::hash_map<Watch, WatcherSet> watchers_; // Lock to protect watchers_. - Lock lock_; + base::Lock lock_; // Separate thread on which we run blocking read for inotify events. base::Thread thread_; @@ -237,7 +237,7 @@ InotifyReader::Watch InotifyReader::AddWatch( if (!valid_) return kInvalidWatch; - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); Watch watch = inotify_add_watch(inotify_fd_, path.value().c_str(), IN_CREATE | IN_DELETE | @@ -257,7 +257,7 @@ bool InotifyReader::RemoveWatch(Watch watch, if (!valid_) return false; - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); watchers_[watch].erase(watcher); @@ -274,7 +274,7 @@ void InotifyReader::OnInotifyEvent(const inotify_event* event) { return; FilePath::StringType child(event->len ? event->name : FILE_PATH_LITERAL("")); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); for (WatcherSet::iterator watcher = watchers_[event->wd].begin(); watcher != watchers_[event->wd].end(); diff --git a/chrome/browser/geolocation/gateway_data_provider_common.cc b/chrome/browser/geolocation/gateway_data_provider_common.cc index 363967c..2289371 100644 --- a/chrome/browser/geolocation/gateway_data_provider_common.cc +++ b/chrome/browser/geolocation/gateway_data_provider_common.cc @@ -32,7 +32,7 @@ void GatewayDataProviderCommon::StopDataProvider() { bool GatewayDataProviderCommon::GetData(GatewayData *data) { DCHECK(CalledOnClientThread()); DCHECK(data); - AutoLock lock(data_mutex_); + base::AutoLock lock(data_mutex_); *data = gateway_data_; // If we've successfully completed a scan, indicate that we have all of the // data we can get. @@ -67,7 +67,7 @@ void GatewayDataProviderCommon::DoRouterScanTask() { ScheduleNextScan(polling_policy_->NoRouterInterval()); } else { { - AutoLock lock(data_mutex_); + base::AutoLock lock(data_mutex_); update_available = gateway_data_.DiffersSignificantly(new_data); gateway_data_ = new_data; } diff --git a/chrome/browser/geolocation/gateway_data_provider_common.h b/chrome/browser/geolocation/gateway_data_provider_common.h index cc1c85a..ba0eb58 100644 --- a/chrome/browser/geolocation/gateway_data_provider_common.h +++ b/chrome/browser/geolocation/gateway_data_provider_common.h @@ -83,7 +83,7 @@ class GatewayDataProviderCommon // Will schedule a scan; i.e. enqueue DoRouterScanTask deferred task. void ScheduleNextScan(int interval); - Lock data_mutex_; + base::Lock data_mutex_; // Whether we've successfully completed a scan for gateway data (or the // polling thread has terminated early). bool is_first_scan_complete_; diff --git a/chrome/browser/geolocation/wifi_data_provider_common.cc b/chrome/browser/geolocation/wifi_data_provider_common.cc index bfa1c5e..3874cfd 100644 --- a/chrome/browser/geolocation/wifi_data_provider_common.cc +++ b/chrome/browser/geolocation/wifi_data_provider_common.cc @@ -42,7 +42,7 @@ void WifiDataProviderCommon::StopDataProvider() { bool WifiDataProviderCommon::GetData(WifiData *data) { DCHECK(CalledOnClientThread()); DCHECK(data); - AutoLock lock(data_mutex_); + base::AutoLock lock(data_mutex_); *data = wifi_data_; // If we've successfully completed a scan, indicate that we have all of the // data we can get. @@ -81,7 +81,7 @@ void WifiDataProviderCommon::DoWifiScanTask() { ScheduleNextScan(polling_policy_->NoWifiInterval()); } else { { - AutoLock lock(data_mutex_); + base::AutoLock lock(data_mutex_); update_available = wifi_data_.DiffersSignificantly(new_data); wifi_data_ = new_data; } diff --git a/chrome/browser/geolocation/wifi_data_provider_common.h b/chrome/browser/geolocation/wifi_data_provider_common.h index c647c06..70477c1 100644 --- a/chrome/browser/geolocation/wifi_data_provider_common.h +++ b/chrome/browser/geolocation/wifi_data_provider_common.h @@ -105,7 +105,7 @@ class WifiDataProviderCommon void ScheduleNextScan(int interval); WifiData wifi_data_; - Lock data_mutex_; + base::Lock data_mutex_; // Whether we've successfully completed a scan for WiFi data (or the polling // thread has terminated early). diff --git a/chrome/browser/hang_monitor/hung_window_detector.cc b/chrome/browser/hang_monitor/hung_window_detector.cc index a9bdead..ea864be 100644 --- a/chrome/browser/hang_monitor/hung_window_detector.cc +++ b/chrome/browser/hang_monitor/hung_window_detector.cc @@ -48,7 +48,7 @@ bool HungWindowDetector::Initialize(HWND top_level_window, void HungWindowDetector::OnTick() { do { - AutoLock lock(hang_detection_lock_); + base::AutoLock lock(hang_detection_lock_); // If we already are checking for hung windows on another thread, // don't do this again. if (enumerating_) { diff --git a/chrome/browser/hang_monitor/hung_window_detector.h b/chrome/browser/hang_monitor/hung_window_detector.h index 0e48739..50ea31f 100644 --- a/chrome/browser/hang_monitor/hung_window_detector.h +++ b/chrome/browser/hang_monitor/hung_window_detector.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_HANG_MONITOR_HUNG_WINDOW_DETECTOR_H__ #pragma once -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "chrome/common/worker_thread_ticker.h" // This class provides the following functionality: @@ -81,7 +81,7 @@ class HungWindowDetector : public WorkerThreadTicker::Callback { // How long do we wait before we consider a window hung (in ms) int message_response_timeout_; - Lock hang_detection_lock_; + base::Lock hang_detection_lock_; // Indicates if this object is currently enumerating hung windows bool enumerating_; diff --git a/chrome/browser/history/top_sites.cc b/chrome/browser/history/top_sites.cc index ac0cc7c..e35aca3 100644 --- a/chrome/browser/history/top_sites.cc +++ b/chrome/browser/history/top_sites.cc @@ -217,7 +217,7 @@ void TopSites::GetMostVisitedURLs(CancelableRequestConsumer* consumer, AddRequest(request, consumer); MostVisitedURLList filtered_urls; { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (!loaded_) { // A request came in before we finished loading. Put the request in // pending_callbacks_ and we'll notify it when we finish loading. @@ -233,7 +233,7 @@ void TopSites::GetMostVisitedURLs(CancelableRequestConsumer* consumer, bool TopSites::GetPageThumbnail(const GURL& url, scoped_refptr<RefCountedBytes>* bytes) { // WARNING: this may be invoked on any thread. - AutoLock lock(lock_); + base::AutoLock lock(lock_); return thread_safe_cache_->GetPageThumbnail(url, bytes); } @@ -800,7 +800,7 @@ void TopSites::MoveStateToLoaded() { MostVisitedURLList filtered_urls; PendingCallbackSet pending_callbacks; { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (loaded_) return; // Don't do anything if we're already loaded. @@ -822,14 +822,14 @@ void TopSites::MoveStateToLoaded() { } void TopSites::ResetThreadSafeCache() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); MostVisitedURLList cached; ApplyBlacklistAndPinnedURLs(cache_->top_sites(), &cached); thread_safe_cache_->SetTopSites(cached); } void TopSites::ResetThreadSafeImageCache() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); thread_safe_cache_->SetThumbnails(cache_->images()); thread_safe_cache_->RemoveUnreferencedThumbnails(); } diff --git a/chrome/browser/history/top_sites.h b/chrome/browser/history/top_sites.h index 556bc131..00d2343 100644 --- a/chrome/browser/history/top_sites.h +++ b/chrome/browser/history/top_sites.h @@ -13,9 +13,9 @@ #include "base/basictypes.h" #include "base/gtest_prod_util.h" -#include "base/lock.h" #include "base/ref_counted.h" #include "base/ref_counted_memory.h" +#include "base/synchronization/lock.h" #include "base/time.h" #include "base/timer.h" #include "chrome/browser/cancelable_request.h" @@ -297,7 +297,7 @@ class TopSites Profile* profile_; // Lock used to access |thread_safe_cache_|. - mutable Lock lock_; + mutable base::Lock lock_; CancelableRequestConsumer cancelable_consumer_; diff --git a/chrome/browser/host_zoom_map.cc b/chrome/browser/host_zoom_map.cc index 9f014e3..598450e 100644 --- a/chrome/browser/host_zoom_map.cc +++ b/chrome/browser/host_zoom_map.cc @@ -51,7 +51,7 @@ void HostZoomMap::Load() { if (!profile_) return; - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); host_zoom_levels_.clear(); const DictionaryValue* host_zoom_dictionary = profile_->GetPrefs()->GetDictionary(prefs::kPerHostZoomLevels); @@ -95,7 +95,7 @@ void HostZoomMap::RegisterUserPrefs(PrefService* prefs) { double HostZoomMap::GetZoomLevel(const GURL& url) const { std::string host(net::GetHostOrSpecFromURL(url)); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); HostZoomLevels::const_iterator i(host_zoom_levels_.find(host)); return (i == host_zoom_levels_.end()) ? default_zoom_level_ : i->second; } @@ -108,7 +108,7 @@ void HostZoomMap::SetZoomLevel(const GURL& url, double level) { std::string host(net::GetHostOrSpecFromURL(url)); { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (level == default_zoom_level_) host_zoom_levels_.erase(host); else @@ -141,7 +141,7 @@ void HostZoomMap::SetZoomLevel(const GURL& url, double level) { double HostZoomMap::GetTemporaryZoomLevel(int render_process_id, int render_view_id) const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); for (size_t i = 0; i < temporary_zoom_levels_.size(); ++i) { if (temporary_zoom_levels_[i].render_process_id == render_process_id && temporary_zoom_levels_[i].render_view_id == render_view_id) { @@ -159,7 +159,7 @@ void HostZoomMap::SetTemporaryZoomLevel(int render_process_id, return; { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); size_t i; for (i = 0; i < temporary_zoom_levels_.size(); ++i) { if (temporary_zoom_levels_[i].render_process_id == render_process_id && @@ -193,7 +193,7 @@ void HostZoomMap::ResetToDefaults() { return; { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); host_zoom_levels_.clear(); } @@ -224,7 +224,7 @@ void HostZoomMap::Observe( Shutdown(); break; case NotificationType::RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW: { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); int render_view_id = Source<RenderViewHost>(source)->routing_id(); int render_process_id = Source<RenderViewHost>(source)->process()->id(); diff --git a/chrome/browser/host_zoom_map.h b/chrome/browser/host_zoom_map.h index 6030f4c..85e02ed 100644 --- a/chrome/browser/host_zoom_map.h +++ b/chrome/browser/host_zoom_map.h @@ -14,8 +14,8 @@ #include <vector> #include "base/basictypes.h" -#include "base/lock.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/prefs/pref_change_registrar.h" #include "chrome/common/notification_observer.h" @@ -112,7 +112,7 @@ class HostZoomMap : // Used around accesses to |host_zoom_levels_|, |default_zoom_level_| and // |temporary_zoom_levels_| to guarantee thread safety. - mutable Lock lock_; + mutable base::Lock lock_; // Whether we are currently updating preferences, this is used to ignore // notifications from the preference service that we triggered ourself. diff --git a/chrome/browser/in_process_webkit/webkit_thread.h b/chrome/browser/in_process_webkit/webkit_thread.h index 856007c..ed17434 100644 --- a/chrome/browser/in_process_webkit/webkit_thread.h +++ b/chrome/browser/in_process_webkit/webkit_thread.h @@ -7,7 +7,6 @@ #pragma once #include "base/basictypes.h" -#include "base/lock.h" #include "base/scoped_ptr.h" #include "base/threading/thread.h" #include "chrome/browser/browser_thread.h" diff --git a/chrome/browser/mach_broker_mac.cc b/chrome/browser/mach_broker_mac.cc index 4ea2069..03932ad 100644 --- a/chrome/browser/mach_broker_mac.cc +++ b/chrome/browser/mach_broker_mac.cc @@ -91,7 +91,7 @@ class MachListenerThreadDelegate : public base::PlatformThread::Delegate { // leaking MachBroker map entries in this case, lock around both these // calls. If the child dies, the death notification will be processed // after the call to FinalizePid(), ensuring proper cleanup. - AutoLock lock(broker_->GetLock()); + base::AutoLock lock(broker_->GetLock()); int pid; err = pid_for_task(child_task, &pid); @@ -170,7 +170,7 @@ void MachBroker::FinalizePid(base::ProcessHandle pid, // Removes all mappings belonging to |pid| from the broker. void MachBroker::InvalidatePid(base::ProcessHandle pid) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); MachBroker::MachMap::iterator it = mach_map_.find(pid); if (it == mach_map_.end()) return; @@ -183,13 +183,13 @@ void MachBroker::InvalidatePid(base::ProcessHandle pid) { mach_map_.erase(it); } -Lock& MachBroker::GetLock() { +base::Lock& MachBroker::GetLock() { return lock_; } // Returns the mach task belonging to |pid|. mach_port_t MachBroker::TaskForPid(base::ProcessHandle pid) const { - AutoLock lock(lock_); + base::AutoLock lock(lock_); MachBroker::MachMap::const_iterator it = mach_map_.find(pid); if (it == mach_map_.end()) return MACH_PORT_NULL; diff --git a/chrome/browser/mach_broker_mac.h b/chrome/browser/mach_broker_mac.h index 2007055..0d4baa8 100644 --- a/chrome/browser/mach_broker_mac.h +++ b/chrome/browser/mach_broker_mac.h @@ -11,10 +11,10 @@ #include <mach/mach.h> -#include "base/lock.h" #include "base/process.h" #include "base/process_util.h" #include "base/singleton.h" +#include "base/synchronization/lock.h" #include "chrome/common/notification_observer.h" #include "chrome/common/notification_registrar.h" @@ -70,7 +70,7 @@ class MachBroker : public base::ProcessMetrics::PortProvider, // The lock that protects this MachBroker object. Clients MUST acquire and // release this lock around calls to PlaceholderForPid() and FinalizePid(). - Lock& GetLock(); + base::Lock& GetLock(); // Returns the Mach port name to use when sending or receiving messages. // Does the Right Thing in the browser and in child processes. @@ -99,7 +99,7 @@ class MachBroker : public base::ProcessMetrics::PortProvider, MachMap mach_map_; // Mutex that guards |mach_map_|. - mutable Lock lock_; + mutable base::Lock lock_; friend class MachBrokerTest; friend class RegisterNotificationTask; diff --git a/chrome/browser/mach_broker_mac_unittest.cc b/chrome/browser/mach_broker_mac_unittest.cc index b0e5b05..5ed66524 100644 --- a/chrome/browser/mach_broker_mac_unittest.cc +++ b/chrome/browser/mach_broker_mac_unittest.cc @@ -4,21 +4,21 @@ #include "chrome/browser/mach_broker_mac.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "testing/gtest/include/gtest/gtest.h" class MachBrokerTest : public testing::Test { public: // Helper function to acquire/release locks and call |PlaceholderForPid()|. void AddPlaceholderForPid(base::ProcessHandle pid) { - AutoLock lock(broker_.GetLock()); + base::AutoLock lock(broker_.GetLock()); broker_.AddPlaceholderForPid(pid); } // Helper function to acquire/release locks and call |FinalizePid()|. void FinalizePid(base::ProcessHandle pid, const MachBroker::MachInfo& mach_info) { - AutoLock lock(broker_.GetLock()); + base::AutoLock lock(broker_.GetLock()); broker_.FinalizePid(pid, mach_info); } @@ -28,7 +28,7 @@ class MachBrokerTest : public testing::Test { TEST_F(MachBrokerTest, Locks) { // Acquire and release the locks. Nothing bad should happen. - AutoLock lock(broker_.GetLock()); + base::AutoLock lock(broker_.GetLock()); } TEST_F(MachBrokerTest, AddPlaceholderAndFinalize) { diff --git a/chrome/browser/multi_process_notification_mac.mm b/chrome/browser/multi_process_notification_mac.mm index 3c6259d..2861a14 100644 --- a/chrome/browser/multi_process_notification_mac.mm +++ b/chrome/browser/multi_process_notification_mac.mm @@ -163,7 +163,7 @@ class LeopardSwitchboardThread // all accesses to entries_ must be controlled by entries_lock_. std::vector<SwitchboardEntry> entries_; - Lock entries_lock_; + base::Lock entries_lock_; base::MessagePumpLibevent::FileDescriptorWatcher watcher_; }; @@ -192,7 +192,7 @@ class ListenerImpl : public base::MessagePumpLibevent::Watcher { bool started_; int fd_; int token_; - Lock switchboard_lock_; + base::Lock switchboard_lock_; static LeopardSwitchboardThread* g_switchboard_thread_; base::MessagePumpLibevent::FileDescriptorWatcher watcher_; scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; diff --git a/chrome/browser/net/chrome_net_log.cc b/chrome/browser/net/chrome_net_log.cc index 6cfc893..58fe6ad 100644 --- a/chrome/browser/net/chrome_net_log.cc +++ b/chrome/browser/net/chrome_net_log.cc @@ -36,7 +36,7 @@ void ChromeNetLog::ThreadSafeObserver::AssertNetLogLockAcquired() const { void ChromeNetLog::ThreadSafeObserver::SetLogLevel( net::NetLog::LogLevel log_level) { DCHECK(net_log_); - AutoLock lock(net_log_->lock_); + base::AutoLock lock(net_log_->lock_); log_level_ = log_level; net_log_->UpdateLogLevel_(); } @@ -85,7 +85,7 @@ void ChromeNetLog::AddEntry(EventType type, const Source& source, EventPhase phase, EventParameters* params) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); // Notify all of the log observers. FOR_EACH_OBSERVER(ThreadSafeObserver, observers_, @@ -102,12 +102,12 @@ net::NetLog::LogLevel ChromeNetLog::GetLogLevel() const { } void ChromeNetLog::AddObserver(ThreadSafeObserver* observer) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); AddObserverWhileLockHeld(observer); } void ChromeNetLog::RemoveObserver(ThreadSafeObserver* observer) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); DCHECK_EQ(observer->net_log_, this); observer->net_log_ = NULL; observers_.RemoveObserver(observer); @@ -116,18 +116,18 @@ void ChromeNetLog::RemoveObserver(ThreadSafeObserver* observer) { void ChromeNetLog::AddObserverAndGetAllPassivelyCapturedEvents( ThreadSafeObserver* observer, EntryList* passive_entries) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); AddObserverWhileLockHeld(observer); passive_collector_->GetAllCapturedEvents(passive_entries); } void ChromeNetLog::GetAllPassivelyCapturedEvents(EntryList* passive_entries) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); passive_collector_->GetAllCapturedEvents(passive_entries); } void ChromeNetLog::ClearAllPassivelyCapturedEvents() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); passive_collector_->Clear(); } diff --git a/chrome/browser/net/chrome_net_log.h b/chrome/browser/net/chrome_net_log.h index 12daee8..9b2c480 100644 --- a/chrome/browser/net/chrome_net_log.h +++ b/chrome/browser/net/chrome_net_log.h @@ -9,9 +9,9 @@ #include <vector> #include "base/atomicops.h" -#include "base/lock.h" #include "base/observer_list.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "base/time.h" #include "net/base/net_log.h" @@ -142,7 +142,7 @@ class ChromeNetLog : public net::NetLog { // |lock_| protects access to |observers_| and, indirectly, to // |passive_collector_|. Should not be acquired by observers. - Lock lock_; + base::Lock lock_; // Last assigned source ID. Incremented to get the next one. base::subtle::Atomic32 last_id_; diff --git a/chrome/browser/net/passive_log_collector.cc b/chrome/browser/net/passive_log_collector.cc index 21e2935..8ac8e53 100644 --- a/chrome/browser/net/passive_log_collector.cc +++ b/chrome/browser/net/passive_log_collector.cc @@ -7,7 +7,6 @@ #include <algorithm> #include "base/compiler_specific.h" -#include "base/lock.h" #include "base/string_util.h" #include "base/format_macros.h" #include "net/url_request/url_request_netlog_params.h" diff --git a/chrome/browser/net/sqlite_persistent_cookie_store.cc b/chrome/browser/net/sqlite_persistent_cookie_store.cc index 622ee50..734e00b 100644 --- a/chrome/browser/net/sqlite_persistent_cookie_store.cc +++ b/chrome/browser/net/sqlite_persistent_cookie_store.cc @@ -107,7 +107,7 @@ class SQLitePersistentCookieStore::Backend // True if the persistent store should be deleted upon destruction. bool clear_local_state_on_exit_; // Guard |pending_|, |num_pending_| and |clear_local_state_on_exit_|. - Lock lock_; + base::Lock lock_; DISALLOW_COPY_AND_ASSIGN(Backend); }; @@ -306,7 +306,7 @@ void SQLitePersistentCookieStore::Backend::BatchOperation( PendingOperationsList::size_type num_pending; { - AutoLock locked(lock_); + base::AutoLock locked(lock_); pending_.push_back(po.release()); num_pending = ++num_pending_; } @@ -329,7 +329,7 @@ void SQLitePersistentCookieStore::Backend::Commit() { PendingOperationsList ops; { - AutoLock locked(lock_); + base::AutoLock locked(lock_); pending_.swap(ops); num_pending_ = 0; } @@ -449,7 +449,7 @@ void SQLitePersistentCookieStore::Backend::InternalBackgroundClose() { void SQLitePersistentCookieStore::Backend::SetClearLocalStateOnExit( bool clear_local_state) { - AutoLock locked(lock_); + base::AutoLock locked(lock_); clear_local_state_on_exit_ = clear_local_state; } SQLitePersistentCookieStore::SQLitePersistentCookieStore(const FilePath& path) diff --git a/chrome/browser/policy/device_management_policy_cache.cc b/chrome/browser/policy/device_management_policy_cache.cc index 75f72bf..cc6a34e 100644 --- a/chrome/browser/policy/device_management_policy_cache.cc +++ b/chrome/browser/policy/device_management_policy_cache.cc @@ -104,7 +104,7 @@ void DeviceManagementPolicyCache::LoadPolicyFromFile() { // Decode and swap in the new policy information. scoped_ptr<DictionaryValue> value(DecodePolicy(cached_policy.policy())); { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (!fresh_policy_) policy_.reset(value.release()); last_policy_refresh_time_ = timestamp; @@ -118,7 +118,7 @@ bool DeviceManagementPolicyCache::SetPolicy( const bool new_policy_differs = !(value->Equals(policy_.get())); base::Time now(base::Time::NowFromSystemTime()); { - AutoLock lock(lock_); + base::AutoLock lock(lock_); policy_.reset(value); fresh_policy_ = true; last_policy_refresh_time_ = now; @@ -134,7 +134,7 @@ bool DeviceManagementPolicyCache::SetPolicy( } DictionaryValue* DeviceManagementPolicyCache::GetPolicy() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); return policy_->DeepCopy(); } @@ -142,7 +142,7 @@ void DeviceManagementPolicyCache::SetDeviceUnmanaged() { is_device_unmanaged_ = true; base::Time now(base::Time::NowFromSystemTime()); { - AutoLock lock(lock_); + base::AutoLock lock(lock_); policy_.reset(new DictionaryValue); last_policy_refresh_time_ = now; } diff --git a/chrome/browser/policy/device_management_policy_cache.h b/chrome/browser/policy/device_management_policy_cache.h index 3ec13ed..50441eb 100644 --- a/chrome/browser/policy/device_management_policy_cache.h +++ b/chrome/browser/policy/device_management_policy_cache.h @@ -7,9 +7,9 @@ #include "base/file_path.h" #include "base/gtest_prod_util.h" -#include "base/lock.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "base/time.h" #include "chrome/browser/policy/proto/device_management_backend.pb.h" @@ -74,7 +74,7 @@ class DeviceManagementPolicyCache { const FilePath backing_file_path_; // Protects |policy_|. - Lock lock_; + base::Lock lock_; // Policy key-value information. scoped_ptr<DictionaryValue> policy_; diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc index 06e130e..717fadc 100644 --- a/chrome/browser/printing/print_dialog_cloud.cc +++ b/chrome/browser/printing/print_dialog_cloud.cc @@ -148,7 +148,7 @@ void CloudPrintDataSenderHelper::CallJavascriptFunction( // potentially expensive enough that stopping whatever is in progress // is worth it. void CloudPrintDataSender::CancelPrintDataFile() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); // We don't own helper, it was passed in to us, so no need to // delete, just let it go. helper_ = NULL; @@ -202,7 +202,7 @@ void CloudPrintDataSender::ReadPrintDataFile(const FilePath& path_to_pdf) { // needed. - 4/1/2010 void CloudPrintDataSender::SendPrintDataFile() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (helper_ && print_data_.get()) { StringValue title(print_job_title_); diff --git a/chrome/browser/printing/print_dialog_cloud_internal.h b/chrome/browser/printing/print_dialog_cloud_internal.h index 9c83154..b3004c5 100644 --- a/chrome/browser/printing/print_dialog_cloud_internal.h +++ b/chrome/browser/printing/print_dialog_cloud_internal.h @@ -10,8 +10,8 @@ #include <vector> #include "base/file_path.h" -#include "base/lock.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "chrome/browser/dom_ui/dom_ui.h" #include "chrome/browser/dom_ui/html_dialog_ui.h" #include "chrome/common/notification_observer.h" @@ -70,7 +70,7 @@ class CloudPrintDataSender friend class base::RefCountedThreadSafe<CloudPrintDataSender>; virtual ~CloudPrintDataSender(); - Lock lock_; + base::Lock lock_; CloudPrintDataSenderHelper* volatile helper_; scoped_ptr<StringValue> print_data_; string16 print_job_title_; diff --git a/chrome/browser/printing/print_dialog_gtk.cc b/chrome/browser/printing/print_dialog_gtk.cc index 302f224..2421e91 100644 --- a/chrome/browser/printing/print_dialog_gtk.cc +++ b/chrome/browser/printing/print_dialog_gtk.cc @@ -11,8 +11,8 @@ #include "base/file_util.h" #include "base/file_util_proxy.h" #include "base/lazy_instance.h" -#include "base/lock.h" #include "base/logging.h" +#include "base/synchronization/lock.h" #include "base/threading/thread_restrictions.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_list.h" @@ -26,8 +26,8 @@ namespace { PrintDialogGtk* g_print_dialog = NULL; // Used to make accesses to the above thread safe. -Lock& DialogLock() { - static base::LazyInstance<Lock> dialog_lock(base::LINKER_INITIALIZED); +base::Lock& DialogLock() { + static base::LazyInstance<base::Lock> dialog_lock(base::LINKER_INITIALIZED); return dialog_lock.Get(); } @@ -77,7 +77,7 @@ void PrintDialogGtk::CreatePrintDialogForPdf(const FilePath& path) { // static bool PrintDialogGtk::DialogShowing() { - AutoLock lock(DialogLock()); + base::AutoLock lock(DialogLock()); return !!g_print_dialog; } @@ -87,7 +87,7 @@ void PrintDialogGtk::CreateDialogImpl(const FilePath& path) { // locking up the system with // // while(true){print();} - AutoLock lock(DialogLock()); + base::AutoLock lock(DialogLock()); if (g_print_dialog) { // Clean up the temporary file. base::FileUtilProxy::Delete( @@ -112,7 +112,7 @@ PrintDialogGtk::PrintDialogGtk(const FilePath& path_to_pdf) } PrintDialogGtk::~PrintDialogGtk() { - AutoLock lock(DialogLock()); + base::AutoLock lock(DialogLock()); DCHECK_EQ(this, g_print_dialog); g_print_dialog = NULL; } diff --git a/chrome/browser/printing/print_job_manager.cc b/chrome/browser/printing/print_job_manager.cc index 25f4791..fd01d62 100644 --- a/chrome/browser/printing/print_job_manager.cc +++ b/chrome/browser/printing/print_job_manager.cc @@ -21,7 +21,7 @@ PrintJobManager::PrintJobManager() { } PrintJobManager::~PrintJobManager() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); queued_queries_.clear(); } @@ -59,7 +59,7 @@ void PrintJobManager::StopJobs(bool wait_for_finish) { } void PrintJobManager::QueuePrinterQuery(PrinterQuery* job) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); DCHECK(job); queued_queries_.push_back(make_scoped_refptr(job)); DCHECK(job->is_valid()); @@ -67,7 +67,7 @@ void PrintJobManager::QueuePrinterQuery(PrinterQuery* job) { void PrintJobManager::PopPrinterQuery(int document_cookie, scoped_refptr<PrinterQuery>* job) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); for (PrinterQueries::iterator itr = queued_queries_.begin(); itr != queued_queries_.end(); ++itr) { @@ -162,12 +162,12 @@ void PrintJobManager::OnPrintJobEvent( } bool PrintJobManager::printing_enabled() { - AutoLock lock(enabled_lock_); + base::AutoLock lock(enabled_lock_); return printing_enabled_; } void PrintJobManager::set_printing_enabled(bool printing_enabled) { - AutoLock lock(enabled_lock_); + base::AutoLock lock(enabled_lock_); printing_enabled_ = printing_enabled; } diff --git a/chrome/browser/printing/print_job_manager.h b/chrome/browser/printing/print_job_manager.h index 228f7ad..a030303 100644 --- a/chrome/browser/printing/print_job_manager.h +++ b/chrome/browser/printing/print_job_manager.h @@ -8,8 +8,8 @@ #include <vector> -#include "base/lock.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #include "chrome/common/notification_observer.h" #include "chrome/common/notification_registrar.h" @@ -62,10 +62,10 @@ class PrintJobManager : public NotificationObserver { NotificationRegistrar registrar_; // Used to serialize access to queued_workers_. - Lock lock_; + base::Lock lock_; // Used to serialize access to printing_enabled_ - Lock enabled_lock_; + base::Lock enabled_lock_; PrinterQueries queued_queries_; diff --git a/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.cc b/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.cc index a96782b..ff1f052 100644 --- a/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.cc +++ b/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.cc @@ -18,7 +18,7 @@ AcceleratedSurfaceContainerManagerMac::AcceleratedSurfaceContainerManagerMac() gfx::PluginWindowHandle AcceleratedSurfaceContainerManagerMac::AllocateFakePluginWindowHandle( bool opaque, bool root) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); AcceleratedSurfaceContainerMac* container = new AcceleratedSurfaceContainerMac(this, opaque); @@ -34,7 +34,7 @@ AcceleratedSurfaceContainerManagerMac::AllocateFakePluginWindowHandle( void AcceleratedSurfaceContainerManagerMac::DestroyFakePluginWindowHandle( gfx::PluginWindowHandle id) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); AcceleratedSurfaceContainerMac* container = MapIDToContainer(id); if (container) { @@ -65,7 +65,7 @@ void AcceleratedSurfaceContainerManagerMac::SetSizeAndIOSurface( int32 width, int32 height, uint64 io_surface_identifier) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); AcceleratedSurfaceContainerMac* container = MapIDToContainer(id); if (container) { @@ -78,7 +78,7 @@ void AcceleratedSurfaceContainerManagerMac::SetSizeAndTransportDIB( int32 width, int32 height, TransportDIB::Handle transport_dib) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); AcceleratedSurfaceContainerMac* container = MapIDToContainer(id); if (container) @@ -87,7 +87,7 @@ void AcceleratedSurfaceContainerManagerMac::SetSizeAndTransportDIB( void AcceleratedSurfaceContainerManagerMac::SetPluginContainerGeometry( const webkit::npapi::WebPluginGeometry& move) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); AcceleratedSurfaceContainerMac* container = MapIDToContainer(move.window); if (container) @@ -96,7 +96,7 @@ void AcceleratedSurfaceContainerManagerMac::SetPluginContainerGeometry( void AcceleratedSurfaceContainerManagerMac::Draw(CGLContextObj context, gfx::PluginWindowHandle id) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); glColorMask(true, true, true, true); // Should match the clear color of RenderWidgetHostViewMac. @@ -123,7 +123,7 @@ void AcceleratedSurfaceContainerManagerMac::Draw(CGLContextObj context, } void AcceleratedSurfaceContainerManagerMac::ForceTextureReload() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); for (PluginWindowToContainerMap::const_iterator i = plugin_window_to_container_map_.begin(); @@ -135,7 +135,7 @@ void AcceleratedSurfaceContainerManagerMac::ForceTextureReload() { void AcceleratedSurfaceContainerManagerMac::SetSurfaceWasPaintedTo( gfx::PluginWindowHandle id, uint64 surface_id) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); AcceleratedSurfaceContainerMac* container = MapIDToContainer(id); if (container) @@ -143,14 +143,14 @@ void AcceleratedSurfaceContainerManagerMac::SetSurfaceWasPaintedTo( } void AcceleratedSurfaceContainerManagerMac::SetRootSurfaceInvalid() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (root_container_) root_container_->set_surface_invalid(); } bool AcceleratedSurfaceContainerManagerMac::SurfaceShouldBeVisible( gfx::PluginWindowHandle id) const { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (IsRootContainer(id) && !gpu_rendering_active_) return false; diff --git a/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.h b/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.h index a2855a4..be2806a 100644 --- a/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.h +++ b/chrome/browser/renderer_host/accelerated_surface_container_manager_mac.h @@ -11,7 +11,7 @@ #include "app/surface/transport_dib.h" #include "base/basictypes.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "gfx/native_widget_types.h" namespace webkit { @@ -116,7 +116,7 @@ class AcceleratedSurfaceContainerManagerMac { // Both |plugin_window_to_container_map_| and the // AcceleratedSurfaceContainerMac in it are not threadsafe, but accessed from // multiple threads. All these accesses are guarded by this lock. - mutable Lock lock_; + mutable base::Lock lock_; DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerManagerMac); }; diff --git a/chrome/browser/renderer_host/download_resource_handler.cc b/chrome/browser/renderer_host/download_resource_handler.cc index b186c01..a297244 100644 --- a/chrome/browser/renderer_host/download_resource_handler.cc +++ b/chrome/browser/renderer_host/download_resource_handler.cc @@ -186,7 +186,7 @@ bool DownloadResourceHandler::OnReadCompleted(int request_id, int* bytes_read) { if (!*bytes_read) return true; DCHECK(read_buffer_); - AutoLock auto_lock(buffer_->lock); + base::AutoLock auto_lock(buffer_->lock); bool need_update = buffer_->contents.empty(); // We are passing ownership of this buffer to the download file manager. @@ -265,7 +265,7 @@ void DownloadResourceHandler::CheckWriteProgress() { size_t contents_size; { - AutoLock lock(buffer_->lock); + base::AutoLock lock(buffer_->lock); contents_size = buffer_->contents.size(); } diff --git a/chrome/browser/renderer_host/render_message_filter_gtk.cc b/chrome/browser/renderer_host/render_message_filter_gtk.cc index 63c400f..4c77831 100644 --- a/chrome/browser/renderer_host/render_message_filter_gtk.cc +++ b/chrome/browser/renderer_host/render_message_filter_gtk.cc @@ -64,7 +64,7 @@ void RenderMessageFilter::DoOnGetWindowRect(gfx::NativeViewId view, gfx::Rect rect; XID window; - AutoLock lock(GtkNativeViewManager::GetInstance()->unrealize_lock()); + base::AutoLock lock(GtkNativeViewManager::GetInstance()->unrealize_lock()); if (GtkNativeViewManager::GetInstance()->GetXIDForId(&window, view)) { if (window) { int x, y; @@ -100,7 +100,7 @@ void RenderMessageFilter::DoOnGetRootWindowRect(gfx::NativeViewId view, gfx::Rect rect; XID window; - AutoLock lock(GtkNativeViewManager::GetInstance()->unrealize_lock()); + base::AutoLock lock(GtkNativeViewManager::GetInstance()->unrealize_lock()); if (GtkNativeViewManager::GetInstance()->GetXIDForId(&window, view)) { if (window) { const XID toplevel = GetTopLevelWindow(window); diff --git a/chrome/browser/renderer_host/render_widget_helper.cc b/chrome/browser/renderer_host/render_widget_helper.cc index 0ea4f8c..6d13366 100644 --- a/chrome/browser/renderer_host/render_widget_helper.cc +++ b/chrome/browser/renderer_host/render_widget_helper.cc @@ -102,7 +102,7 @@ bool RenderWidgetHelper::WaitForUpdateMsg(int render_widget_id, for (;;) { UpdateMsgProxy* proxy = NULL; { - AutoLock lock(pending_paints_lock_); + base::AutoLock lock(pending_paints_lock_); UpdateMsgProxyMap::iterator it = pending_paints_.find(render_widget_id); if (it != pending_paints_.end()) { @@ -139,7 +139,7 @@ void RenderWidgetHelper::DidReceiveUpdateMsg(const IPC::Message& msg) { UpdateMsgProxy* proxy = NULL; { - AutoLock lock(pending_paints_lock_); + base::AutoLock lock(pending_paints_lock_); UpdateMsgProxyMap::value_type new_value(render_widget_id, NULL); @@ -169,7 +169,7 @@ void RenderWidgetHelper::OnDiscardUpdateMsg(UpdateMsgProxy* proxy) { // Remove the proxy from the map now that we are going to handle it normally. { - AutoLock lock(pending_paints_lock_); + base::AutoLock lock(pending_paints_lock_); UpdateMsgProxyMap::iterator it = pending_paints_.find(msg.routing_id()); DCHECK(it != pending_paints_.end()); @@ -276,7 +276,7 @@ void RenderWidgetHelper::OnCreateFullscreenWidgetOnUI( #if defined(OS_MACOSX) TransportDIB* RenderWidgetHelper::MapTransportDIB(TransportDIB::Id dib_id) { - AutoLock locked(allocated_dibs_lock_); + base::AutoLock locked(allocated_dibs_lock_); const std::map<TransportDIB::Id, int>::iterator i = allocated_dibs_.find(dib_id); @@ -300,13 +300,13 @@ void RenderWidgetHelper::AllocTransportDIB( if (cache_in_browser) { // Keep a copy of the file descriptor around - AutoLock locked(allocated_dibs_lock_); + base::AutoLock locked(allocated_dibs_lock_); allocated_dibs_[shared_memory->id()] = dup(result->fd); } } void RenderWidgetHelper::FreeTransportDIB(TransportDIB::Id dib_id) { - AutoLock locked(allocated_dibs_lock_); + base::AutoLock locked(allocated_dibs_lock_); const std::map<TransportDIB::Id, int>::iterator i = allocated_dibs_.find(dib_id); diff --git a/chrome/browser/renderer_host/render_widget_helper.h b/chrome/browser/renderer_host/render_widget_helper.h index 4eb32ea..982e56c 100644 --- a/chrome/browser/renderer_host/render_widget_helper.h +++ b/chrome/browser/renderer_host/render_widget_helper.h @@ -13,7 +13,7 @@ #include "base/hash_tables.h" #include "base/process.h" #include "base/ref_counted.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "base/synchronization/waitable_event.h" #include "chrome/common/window_container_type.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" @@ -197,7 +197,7 @@ class RenderWidgetHelper // On OSX we keep file descriptors to all the allocated DIBs around until // the renderer frees them. - Lock allocated_dibs_lock_; + base::Lock allocated_dibs_lock_; std::map<TransportDIB::Id, int> allocated_dibs_; #endif @@ -205,7 +205,7 @@ class RenderWidgetHelper // The UpdateMsgProxy objects are not owned by this map. (See UpdateMsgProxy // for details about how the lifetime of instances are managed.) UpdateMsgProxyMap pending_paints_; - Lock pending_paints_lock_; + base::Lock pending_paints_lock_; int render_process_id_; diff --git a/chrome/browser/safe_browsing/safe_browsing_database.cc b/chrome/browser/safe_browsing/safe_browsing_database.cc index 9b4c57e..e717655 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database.cc @@ -287,7 +287,7 @@ void SafeBrowsingDatabaseNew::Init(const FilePath& filename_base) { // until it returns, there are no pointers to this class on other // threads. Then again, that means there is no possibility of // contention on the lock... - AutoLock locked(lookup_lock_); + base::AutoLock locked(lookup_lock_); DCHECK(browse_filename_.empty()); // Ensure we haven't been run before. DCHECK(download_filename_.empty()); // Ensure we haven't been run before. @@ -324,7 +324,7 @@ bool SafeBrowsingDatabaseNew::ResetDatabase() { // Reset objects in memory. { - AutoLock locked(lookup_lock_); + base::AutoLock locked(lookup_lock_); full_browse_hashes_.clear(); pending_browse_hashes_.clear(); prefix_miss_cache_.clear(); @@ -355,7 +355,7 @@ bool SafeBrowsingDatabaseNew::ContainsBrowseUrl( // This function is called on the I/O thread, prevent changes to // bloom filter and caches. - AutoLock locked(lookup_lock_); + base::AutoLock locked(lookup_lock_); if (!browse_bloom_filter_.get()) return false; @@ -607,7 +607,7 @@ void SafeBrowsingDatabaseNew::CacheHashResults( const std::vector<SBPrefix>& prefixes, const std::vector<SBFullHashResult>& full_hits) { // This is called on the I/O thread, lock against updates. - AutoLock locked(lookup_lock_); + base::AutoLock locked(lookup_lock_); if (full_hits.empty()) { prefix_miss_cache_.insert(prefixes.begin(), prefixes.end()); @@ -729,7 +729,7 @@ void SafeBrowsingDatabaseNew::UpdateBrowseStore() { // case |ContainsBrowseURL()| is called before the new filter is complete. std::vector<SBAddFullHash> pending_add_hashes; { - AutoLock locked(lookup_lock_); + base::AutoLock locked(lookup_lock_); pending_add_hashes.insert(pending_add_hashes.end(), pending_browse_hashes_.begin(), pending_browse_hashes_.end()); @@ -778,7 +778,7 @@ void SafeBrowsingDatabaseNew::UpdateBrowseStore() { // Swap in the newly built filter and cache. { - AutoLock locked(lookup_lock_); + base::AutoLock locked(lookup_lock_); full_browse_hashes_.swap(add_full_hashes); // TODO(shess): If |CacheHashResults()| is posted between the diff --git a/chrome/browser/safe_browsing/safe_browsing_database.h b/chrome/browser/safe_browsing/safe_browsing_database.h index 980a8d3..4bd6db9 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database.h +++ b/chrome/browser/safe_browsing/safe_browsing_database.h @@ -10,8 +10,8 @@ #include <vector> #include "base/file_path.h" -#include "base/lock.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "base/task.h" #include "chrome/browser/safe_browsing/safe_browsing_store.h" #include "testing/gtest/include/gtest/gtest_prod.h" @@ -236,7 +236,7 @@ class SafeBrowsingDatabaseNew : public SafeBrowsingDatabase { // Lock for protecting access to variables that may be used on the // IO thread. This includes |browse_bloom_filter_|, |full_browse_hashes_|, // |pending_browse_hashes_|, and |prefix_miss_cache_|. - Lock lookup_lock_; + base::Lock lookup_lock_; // Underlying persistent store for chunk data. // For browsing related (phishing and malware URLs) chunks and prefixes. diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc index a0f8384..046ea52c 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service.cc @@ -592,7 +592,7 @@ void SafeBrowsingService::OnIOShutdown() { } bool SafeBrowsingService::DatabaseAvailable() const { - AutoLock lock(database_lock_); + base::AutoLock lock(database_lock_); return !closing_database_ && (database_ != NULL); } @@ -625,7 +625,7 @@ SafeBrowsingDatabase* SafeBrowsingService::GetDatabase() { { // Acquiring the lock here guarantees correct ordering between the writes to // the new database object above, and the setting of |databse_| below. - AutoLock lock(database_lock_); + base::AutoLock lock(database_lock_); database_ = database; } @@ -829,7 +829,7 @@ void SafeBrowsingService::OnCloseDatabase() { // of |database_| above and of |closing_database_| below, which ensures there // won't be a window during which the IO thread falsely believes the database // is available. - AutoLock lock(database_lock_); + base::AutoLock lock(database_lock_); closing_database_ = false; } diff --git a/chrome/browser/safe_browsing/safe_browsing_service.h b/chrome/browser/safe_browsing/safe_browsing_service.h index 28f74de..85255e5 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.h +++ b/chrome/browser/safe_browsing/safe_browsing_service.h @@ -15,9 +15,9 @@ #include <vector> #include "base/hash_tables.h" -#include "base/lock.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "base/time.h" #include "chrome/browser/safe_browsing/safe_browsing_util.h" #include "googleurl/src/gurl.h" @@ -353,7 +353,7 @@ class SafeBrowsingService SafeBrowsingDatabase* database_; // Lock used to prevent possible data races due to compiler optimizations. - mutable Lock database_lock_; + mutable base::Lock database_lock_; // Handles interaction with SafeBrowsing servers. SafeBrowsingProtocolManager* protocol_manager_; diff --git a/chrome/browser/speech/speech_input_manager.cc b/chrome/browser/speech/speech_input_manager.cc index 56a87c9..4cdc608 100644 --- a/chrome/browser/speech/speech_input_manager.cc +++ b/chrome/browser/speech/speech_input_manager.cc @@ -10,8 +10,8 @@ #include "app/l10n_util.h" #include "base/command_line.h" #include "base/lazy_instance.h" -#include "base/lock.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #include "base/threading/thread_restrictions.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" @@ -62,7 +62,7 @@ class OptionalRequestInfo void GetHardwareInfo() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - AutoLock lock(lock_); + base::AutoLock lock(lock_); can_report_metrics_ = true; #if defined(OS_WIN) value_ = UTF16ToUTF8( @@ -75,17 +75,17 @@ class OptionalRequestInfo } std::string value() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); return value_; } bool can_report_metrics() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); return can_report_metrics_; } private: - Lock lock_; + base::Lock lock_; std::string value_; bool can_report_metrics_; diff --git a/chrome/browser/sync/engine/all_status.cc b/chrome/browser/sync/engine/all_status.cc index 8d4b85e..1580dc4 100644 --- a/chrome/browser/sync/engine/all_status.cc +++ b/chrome/browser/sync/engine/all_status.cc @@ -138,7 +138,7 @@ void AllStatus::HandleServerConnectionEvent( } sync_api::SyncManager::Status AllStatus::status() const { - AutoLock lock(mutex_); + base::AutoLock lock(mutex_); return status_; } diff --git a/chrome/browser/sync/engine/all_status.h b/chrome/browser/sync/engine/all_status.h index 5b2f1d0..015bfb7 100644 --- a/chrome/browser/sync/engine/all_status.h +++ b/chrome/browser/sync/engine/all_status.h @@ -11,8 +11,8 @@ #include <map> -#include "base/lock.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "chrome/browser/sync/engine/syncapi.h" #include "chrome/browser/sync/engine/syncer_types.h" @@ -57,7 +57,7 @@ class AllStatus : public SyncEngineEventListener { sync_api::SyncManager::Status status_; - mutable Lock mutex_; // Protects all data members. + mutable base::Lock mutex_; // Protects all data members. DISALLOW_COPY_AND_ASSIGN(AllStatus); }; diff --git a/chrome/browser/sync/engine/net/server_connection_manager.cc b/chrome/browser/sync/engine/net/server_connection_manager.cc index 20776fe..7f53a29 100644 --- a/chrome/browser/sync/engine/net/server_connection_manager.cc +++ b/chrome/browser/sync/engine/net/server_connection_manager.cc @@ -255,7 +255,7 @@ bool ServerConnectionManager::CheckServerReachable() { void ServerConnectionManager::kill() { { - AutoLock lock(terminate_all_io_mutex_); + base::AutoLock lock(terminate_all_io_mutex_); terminate_all_io_ = true; } } @@ -294,7 +294,7 @@ void ServerConnectionManager::SetServerParameters(const string& server_url, int port, bool use_ssl) { { - AutoLock lock(server_parameters_mutex_); + base::AutoLock lock(server_parameters_mutex_); sync_server_ = server_url; sync_server_port_ = port; use_ssl_ = use_ssl; @@ -305,7 +305,7 @@ void ServerConnectionManager::SetServerParameters(const string& server_url, void ServerConnectionManager::GetServerParameters(string* server_url, int* port, bool* use_ssl) const { - AutoLock lock(server_parameters_mutex_); + base::AutoLock lock(server_parameters_mutex_); if (server_url != NULL) *server_url = sync_server_; if (port != NULL) diff --git a/chrome/browser/sync/engine/net/server_connection_manager.h b/chrome/browser/sync/engine/net/server_connection_manager.h index 6380151..8921428 100644 --- a/chrome/browser/sync/engine/net/server_connection_manager.h +++ b/chrome/browser/sync/engine/net/server_connection_manager.h @@ -10,8 +10,8 @@ #include <string> #include "base/atomicops.h" -#include "base/lock.h" #include "base/string_util.h" +#include "base/synchronization/lock.h" #include "chrome/browser/sync/syncable/syncable_id.h" #include "chrome/common/deprecated/event_sys.h" #include "chrome/common/deprecated/event_sys-inl.h" @@ -149,7 +149,7 @@ class ScopedServerStatusWatcher { // one instance for every server that you need to talk to. class ServerConnectionManager { public: - typedef EventChannel<ServerConnectionEvent, Lock> Channel; + typedef EventChannel<ServerConnectionEvent, base::Lock> Channel; // buffer_in - will be POSTed // buffer_out - string will be overwritten with response @@ -192,7 +192,7 @@ class ServerConnectionManager { void GetServerParams(std::string* server, int* server_port, bool* use_ssl) const { - AutoLock lock(scm_->server_parameters_mutex_); + base::AutoLock lock(scm_->server_parameters_mutex_); server->assign(scm_->sync_server_); *server_port = scm_->sync_server_port_; *use_ssl = scm_->use_ssl_; @@ -269,7 +269,7 @@ class ServerConnectionManager { std::string GetServerHost() const; bool terminate_all_io() const { - AutoLock lock(terminate_all_io_mutex_); + base::AutoLock lock(terminate_all_io_mutex_); return terminate_all_io_; } @@ -284,23 +284,23 @@ class ServerConnectionManager { void set_auth_token(const std::string& auth_token) { // TODO(chron): Consider adding a message loop check here. - AutoLock lock(auth_token_mutex_); + base::AutoLock lock(auth_token_mutex_); auth_token_.assign(auth_token); } const std::string auth_token() const { - AutoLock lock(auth_token_mutex_); + base::AutoLock lock(auth_token_mutex_); return auth_token_; } protected: inline std::string proto_sync_path() const { - AutoLock lock(path_mutex_); + base::AutoLock lock(path_mutex_); return proto_sync_path_; } std::string get_time_path() const { - AutoLock lock(path_mutex_); + base::AutoLock lock(path_mutex_); return get_time_path_; } @@ -317,7 +317,7 @@ class ServerConnectionManager { ScopedServerStatusWatcher* watcher); // Protects access to sync_server_, sync_server_port_ and use_ssl_: - mutable Lock server_parameters_mutex_; + mutable base::Lock server_parameters_mutex_; // The sync_server_ is the server that requests will be made to. std::string sync_server_; @@ -335,15 +335,15 @@ class ServerConnectionManager { bool use_ssl_; // The paths we post to. - mutable Lock path_mutex_; + mutable base::Lock path_mutex_; std::string proto_sync_path_; std::string get_time_path_; - mutable Lock auth_token_mutex_; + mutable base::Lock auth_token_mutex_; // The auth token to use in authenticated requests. Set by the AuthWatcher. std::string auth_token_; - Lock error_count_mutex_; // Protects error_count_ + base::Lock error_count_mutex_; // Protects error_count_ int error_count_; // Tracks the number of connection errors. Channel* const channel_; @@ -363,7 +363,7 @@ class ServerConnectionManager { void NotifyStatusChanged(); void ResetConnection(); - mutable Lock terminate_all_io_mutex_; + mutable base::Lock terminate_all_io_mutex_; bool terminate_all_io_; // When set to true, terminate all connections asap. DISALLOW_COPY_AND_ASSIGN(ServerConnectionManager); }; diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc index 7725afd..bc11b31 100644 --- a/chrome/browser/sync/engine/syncapi.cc +++ b/chrome/browser/sync/engine/syncapi.cc @@ -11,12 +11,12 @@ #include <vector> #include "base/base64.h" -#include "base/lock.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/scoped_ptr.h" #include "base/sha1.h" #include "base/string_util.h" +#include "base/synchronization/lock.h" #include "base/task.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_thread.h" @@ -1070,7 +1070,7 @@ class SyncManager::SyncInternal // Whether we're initialized to the point of being able to accept changes // (and hence allow transaction creation). See initialized_ for details. bool initialized() const { - AutoLock lock(initialized_mutex_); + base::AutoLock lock(initialized_mutex_); return initialized_; } @@ -1310,7 +1310,7 @@ class SyncManager::SyncInternal // meaning we are ready to accept changes. Protected by initialized_mutex_ // as it can get read/set by both the SyncerThread and the AuthWatcherThread. bool initialized_; - mutable Lock initialized_mutex_; + mutable base::Lock initialized_mutex_; notifier::NotifierOptions notifier_options_; @@ -1531,7 +1531,7 @@ void SyncManager::SyncInternal::MarkAndNotifyInitializationComplete() { // between their respective threads to call MarkAndNotify. We need to make // sure the observer is notified once and only once. { - AutoLock lock(initialized_mutex_); + base::AutoLock lock(initialized_mutex_); if (initialized_) return; initialized_ = true; diff --git a/chrome/browser/sync/engine/syncer.cc b/chrome/browser/sync/engine/syncer.cc index cbf9753..70d585f 100644 --- a/chrome/browser/sync/engine/syncer.cc +++ b/chrome/browser/sync/engine/syncer.cc @@ -62,12 +62,12 @@ Syncer::Syncer() Syncer::~Syncer() {} bool Syncer::ExitRequested() { - AutoLock lock(early_exit_requested_lock_); + base::AutoLock lock(early_exit_requested_lock_); return early_exit_requested_; } void Syncer::RequestEarlyExit() { - AutoLock lock(early_exit_requested_lock_); + base::AutoLock lock(early_exit_requested_lock_); early_exit_requested_ = true; } diff --git a/chrome/browser/sync/engine/syncer.h b/chrome/browser/sync/engine/syncer.h index 2789ed2..89f1307 100644 --- a/chrome/browser/sync/engine/syncer.h +++ b/chrome/browser/sync/engine/syncer.h @@ -12,8 +12,8 @@ #include "base/basictypes.h" #include "base/callback.h" #include "base/gtest_prod_util.h" -#include "base/lock.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "chrome/browser/sync/engine/conflict_resolver.h" #include "chrome/browser/sync/engine/syncer_types.h" #include "chrome/browser/sync/engine/syncproto.h" @@ -109,7 +109,7 @@ class Syncer { SyncerStep last_step); bool early_exit_requested_; - Lock early_exit_requested_lock_; + base::Lock early_exit_requested_lock_; int32 max_commit_batch_size_; diff --git a/chrome/browser/sync/engine/syncer_thread.cc b/chrome/browser/sync/engine/syncer_thread.cc index e9a3a20..8813709 100644 --- a/chrome/browser/sync/engine/syncer_thread.cc +++ b/chrome/browser/sync/engine/syncer_thread.cc @@ -556,7 +556,7 @@ SyncSession* SyncerThread::SyncMain(Syncer* syncer, bool was_throttled, continue_sync_cycle, initial_sync_for_thread, was_nudged)); scoped_ptr<SyncSession> session; - AutoUnlock unlock(lock_); + base::AutoUnlock unlock(lock_); do { session.reset(new SyncSession(session_context_.get(), this, info, routes, workers)); diff --git a/chrome/browser/sync/engine/syncer_thread_unittest.cc b/chrome/browser/sync/engine/syncer_thread_unittest.cc index 4b13e8f..1553e9c 100644 --- a/chrome/browser/sync/engine/syncer_thread_unittest.cc +++ b/chrome/browser/sync/engine/syncer_thread_unittest.cc @@ -5,8 +5,8 @@ #include <list> #include <map> -#include "base/lock.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "base/time.h" #include "base/synchronization/waitable_event.h" #include "chrome/browser/sync/engine/model_safe_worker.h" @@ -125,7 +125,7 @@ class SyncerThreadWithSyncerTest : public testing::Test, void WaitForDisconnect() { // Wait for the SyncerThread to detect loss of connection, up to a max of // 10 seconds to timeout the test. - AutoLock lock(syncer_thread()->lock_); + base::AutoLock lock(syncer_thread()->lock_); TimeTicks start = TimeTicks::Now(); TimeDelta ten_seconds = TimeDelta::FromSeconds(10); while (syncer_thread()->vault_.connected_) { @@ -139,7 +139,7 @@ class SyncerThreadWithSyncerTest : public testing::Test, bool Pause(ListenerMock* listener) { WaitableEvent event(false, false); { - AutoLock lock(syncer_thread()->lock_); + base::AutoLock lock(syncer_thread()->lock_); EXPECT_CALL(*listener, OnSyncEngineEvent( Field(&SyncEngineEvent::what_happened, SyncEngineEvent::SYNCER_THREAD_PAUSED))). @@ -153,7 +153,7 @@ class SyncerThreadWithSyncerTest : public testing::Test, bool Resume(ListenerMock* listener) { WaitableEvent event(false, false); { - AutoLock lock(syncer_thread()->lock_); + base::AutoLock lock(syncer_thread()->lock_); EXPECT_CALL(*listener, OnSyncEngineEvent( Field(&SyncEngineEvent::what_happened, SyncEngineEvent::SYNCER_THREAD_RESUMED))). @@ -330,7 +330,7 @@ TEST_F(SyncerThreadTest, CalculatePollingWaitTime) { scoped_refptr<SyncerThread> syncer_thread(new SyncerThread(context)); syncer_thread->DisableIdleDetection(); // Hold the lock to appease asserts in code. - AutoLock lock(syncer_thread->lock_); + base::AutoLock lock(syncer_thread->lock_); // Notifications disabled should result in a polling interval of // kDefaultShortPollInterval. diff --git a/chrome/browser/sync/glue/autofill_data_type_controller.cc b/chrome/browser/sync/glue/autofill_data_type_controller.cc index 8661e14..1c57df2 100644 --- a/chrome/browser/sync/glue/autofill_data_type_controller.cc +++ b/chrome/browser/sync/glue/autofill_data_type_controller.cc @@ -109,7 +109,7 @@ void AutofillDataTypeController::Stop() { // thread to finish the StartImpl() task. if (state_ == ASSOCIATING) { { - AutoLock lock(abort_association_lock_); + base::AutoLock lock(abort_association_lock_); abort_association_ = true; if (model_associator_.get()) model_associator_->AbortAssociation(); @@ -189,7 +189,7 @@ void AutofillDataTypeController::StartImpl() { // No additional services need to be started before we can proceed // with model association. { - AutoLock lock(abort_association_lock_); + base::AutoLock lock(abort_association_lock_); if (abort_association_) { abort_association_complete_.Signal(); return; @@ -232,7 +232,7 @@ void AutofillDataTypeController::StartDone( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); abort_association_complete_.Signal(); - AutoLock lock(abort_association_lock_); + base::AutoLock lock(abort_association_lock_); if (!abort_association_) { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, NewRunnableMethod( diff --git a/chrome/browser/sync/glue/autofill_data_type_controller.h b/chrome/browser/sync/glue/autofill_data_type_controller.h index 2daedb42..05b964c 100644 --- a/chrome/browser/sync/glue/autofill_data_type_controller.h +++ b/chrome/browser/sync/glue/autofill_data_type_controller.h @@ -101,7 +101,7 @@ class AutofillDataTypeController : public DataTypeController, NotificationRegistrar notification_registrar_; - Lock abort_association_lock_; + base::Lock abort_association_lock_; bool abort_association_; base::WaitableEvent abort_association_complete_; diff --git a/chrome/browser/sync/glue/autofill_model_associator.cc b/chrome/browser/sync/glue/autofill_model_associator.cc index 43e4db6..14b9f2b 100644 --- a/chrome/browser/sync/glue/autofill_model_associator.cc +++ b/chrome/browser/sync/glue/autofill_model_associator.cc @@ -136,7 +136,7 @@ bool AutofillModelAssociator::AssociateModels() { VLOG(1) << "Associating Autofill Models"; DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); { - AutoLock lock(abort_association_pending_lock_); + base::AutoLock lock(abort_association_pending_lock_); abort_association_pending_ = false; } @@ -401,7 +401,7 @@ bool AutofillModelAssociator::SyncModelHasUserCreatedNodes(bool* has_nodes) { void AutofillModelAssociator::AbortAssociation() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - AutoLock lock(abort_association_pending_lock_); + base::AutoLock lock(abort_association_pending_lock_); abort_association_pending_ = true; } @@ -454,7 +454,7 @@ bool AutofillModelAssociator::GetSyncIdForTaggedNode(const std::string& tag, } bool AutofillModelAssociator::IsAbortPending() { - AutoLock lock(abort_association_pending_lock_); + base::AutoLock lock(abort_association_pending_lock_); return abort_association_pending_; } diff --git a/chrome/browser/sync/glue/autofill_model_associator.h b/chrome/browser/sync/glue/autofill_model_associator.h index fb660e6..a0eee27 100644 --- a/chrome/browser/sync/glue/autofill_model_associator.h +++ b/chrome/browser/sync/glue/autofill_model_associator.h @@ -12,8 +12,8 @@ #include <vector> #include "base/basictypes.h" -#include "base/lock.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #include "chrome/browser/autofill/personal_data_manager.h" #include "chrome/browser/sync/engine/syncapi.h" #include "chrome/browser/sync/glue/model_associator.h" @@ -183,7 +183,7 @@ class AutofillModelAssociator // Abort association pending flag and lock. If this is set to true // (via the AbortAssociation method), return from the // AssociateModels method as soon as possible. - Lock abort_association_pending_lock_; + base::Lock abort_association_pending_lock_; bool abort_association_pending_; int number_of_entries_created_; diff --git a/chrome/browser/sync/glue/autofill_profile_model_associator.cc b/chrome/browser/sync/glue/autofill_profile_model_associator.cc index c517e2c..d6a6792 100644 --- a/chrome/browser/sync/glue/autofill_profile_model_associator.cc +++ b/chrome/browser/sync/glue/autofill_profile_model_associator.cc @@ -129,7 +129,7 @@ bool AutofillProfileModelAssociator::AssociateModels() { VLOG(1) << "Associating Autofill Models"; DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); { - AutoLock lock(abort_association_pending_lock_); + base::AutoLock lock(abort_association_pending_lock_); abort_association_pending_ = false; } @@ -458,7 +458,7 @@ int64 AutofillProfileModelAssociator::GetSyncIdFromChromeId( void AutofillProfileModelAssociator::AbortAssociation() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - AutoLock lock(abort_association_pending_lock_); + base::AutoLock lock(abort_association_pending_lock_); abort_association_pending_ = true; } @@ -469,7 +469,7 @@ const std::string* AutofillProfileModelAssociator::GetChromeNodeFromSyncId( } bool AutofillProfileModelAssociator::IsAbortPending() { - AutoLock lock(abort_association_pending_lock_); + base::AutoLock lock(abort_association_pending_lock_); return abort_association_pending_; } diff --git a/chrome/browser/sync/glue/autofill_profile_model_associator.h b/chrome/browser/sync/glue/autofill_profile_model_associator.h index e2abdaf..3286283 100644 --- a/chrome/browser/sync/glue/autofill_profile_model_associator.h +++ b/chrome/browser/sync/glue/autofill_profile_model_associator.h @@ -12,8 +12,8 @@ #include <vector> #include "base/basictypes.h" -#include "base/lock.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #include "chrome/browser/autofill/personal_data_manager.h" #include "chrome/browser/sync/engine/syncapi.h" #include "chrome/browser/sync/glue/model_associator.h" @@ -175,7 +175,7 @@ class AutofillProfileModelAssociator // Abort association pending flag and lock. If this is set to true // (via the AbortAssociation method), return from the // AssociateModels method as soon as possible. - Lock abort_association_pending_lock_; + base::Lock abort_association_pending_lock_; bool abort_association_pending_; int number_of_profiles_created_; diff --git a/chrome/browser/sync/glue/password_model_associator.cc b/chrome/browser/sync/glue/password_model_associator.cc index 3c9d01a..d6708b5 100644 --- a/chrome/browser/sync/glue/password_model_associator.cc +++ b/chrome/browser/sync/glue/password_model_associator.cc @@ -41,7 +41,7 @@ PasswordModelAssociator::~PasswordModelAssociator() {} bool PasswordModelAssociator::AssociateModels() { DCHECK(expected_loop_ == MessageLoop::current()); { - AutoLock lock(abort_association_pending_lock_); + base::AutoLock lock(abort_association_pending_lock_); abort_association_pending_ = false; } @@ -194,7 +194,7 @@ bool PasswordModelAssociator::SyncModelHasUserCreatedNodes(bool* has_nodes) { void PasswordModelAssociator::AbortAssociation() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - AutoLock lock(abort_association_pending_lock_); + base::AutoLock lock(abort_association_pending_lock_); abort_association_pending_ = true; } @@ -210,7 +210,7 @@ bool PasswordModelAssociator::InitSyncNodeFromChromeId( } bool PasswordModelAssociator::IsAbortPending() { - AutoLock lock(abort_association_pending_lock_); + base::AutoLock lock(abort_association_pending_lock_); return abort_association_pending_; } diff --git a/chrome/browser/sync/glue/password_model_associator.h b/chrome/browser/sync/glue/password_model_associator.h index 15eb3724..cfe0dab 100644 --- a/chrome/browser/sync/glue/password_model_associator.h +++ b/chrome/browser/sync/glue/password_model_associator.h @@ -11,7 +11,7 @@ #include <vector> #include "base/basictypes.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "base/task.h" #include "chrome/browser/history/history_types.h" #include "chrome/browser/sync/glue/model_associator.h" @@ -132,7 +132,7 @@ class PasswordModelAssociator // Abort association pending flag and lock. If this is set to true // (via the AbortAssociation method), return from the // AssociateModels method as soon as possible. - Lock abort_association_pending_lock_; + base::Lock abort_association_pending_lock_; bool abort_association_pending_; MessageLoop* expected_loop_; diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc index 62b9aae..3e600e1 100644 --- a/chrome/browser/sync/glue/sync_backend_host.cc +++ b/chrome/browser/sync/glue/sync_backend_host.cc @@ -156,7 +156,7 @@ std::string SyncBackendHost::RestoreEncryptionBootstrapToken() { } bool SyncBackendHost::IsNigoriEnabled() const { - AutoLock lock(registrar_lock_); + base::AutoLock lock(registrar_lock_); // Note that NIGORI is only ever added/removed from routing_info once, // during initialization / first configuration, so there is no real 'race' // possible here or possibility of stale return value. @@ -333,7 +333,7 @@ void SyncBackendHost::ConfigureDataTypes( bool deleted_type = false; { - AutoLock lock(registrar_lock_); + base::AutoLock lock(registrar_lock_); for (DataTypeController::TypeMap::const_iterator it = data_type_controllers.begin(); it != data_type_controllers.end(); ++it) { @@ -391,7 +391,7 @@ void SyncBackendHost::RequestNudge() { void SyncBackendHost::ActivateDataType( DataTypeController* data_type_controller, ChangeProcessor* change_processor) { - AutoLock lock(registrar_lock_); + base::AutoLock lock(registrar_lock_); // Ensure that the given data type is in the PASSIVE group. browser_sync::ModelSafeRoutingInfo::iterator i = @@ -411,7 +411,7 @@ void SyncBackendHost::ActivateDataType( void SyncBackendHost::DeactivateDataType( DataTypeController* data_type_controller, ChangeProcessor* change_processor) { - AutoLock lock(registrar_lock_); + base::AutoLock lock(registrar_lock_); registrar_.routing_info.erase(data_type_controller->type()); std::map<syncable::ModelType, ChangeProcessor*>::size_type erased = @@ -516,7 +516,7 @@ const SyncSessionSnapshot* SyncBackendHost::GetLastSessionSnapshot() const { } void SyncBackendHost::GetWorkers(std::vector<ModelSafeWorker*>* out) { - AutoLock lock(registrar_lock_); + base::AutoLock lock(registrar_lock_); out->clear(); for (WorkerMap::const_iterator it = registrar_.workers.begin(); it != registrar_.workers.end(); ++it) { @@ -525,7 +525,7 @@ void SyncBackendHost::GetWorkers(std::vector<ModelSafeWorker*>* out) { } void SyncBackendHost::GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) { - AutoLock lock(registrar_lock_); + base::AutoLock lock(registrar_lock_); ModelSafeRoutingInfo copy(registrar_.routing_info); out->swap(copy); } @@ -771,7 +771,7 @@ void SyncBackendHost::HandleInitializationCompletedOnFrontendLoop() { bool SyncBackendHost::Core::IsCurrentThreadSafeForModel( syncable::ModelType model_type) { - AutoLock lock(host_->registrar_lock_); + base::AutoLock lock(host_->registrar_lock_); browser_sync::ModelSafeRoutingInfo::const_iterator routing_it = host_->registrar_.routing_info.find(model_type); diff --git a/chrome/browser/sync/glue/sync_backend_host.h b/chrome/browser/sync/glue/sync_backend_host.h index cd418aa..964f7a5 100644 --- a/chrome/browser/sync/glue/sync_backend_host.h +++ b/chrome/browser/sync/glue/sync_backend_host.h @@ -11,9 +11,9 @@ #include <vector> #include "base/file_path.h" -#include "base/lock.h" #include "base/message_loop.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #include "base/threading/thread.h" #include "base/timer.h" #include "base/utf_string_conversions.h" @@ -507,7 +507,7 @@ class SyncBackendHost : public browser_sync::ModelSafeWorkerRegistrar { // pointer value", and then invoke methods), because lifetimes are managed on // the UI thread. Of course, this comment only applies to ModelSafeWorker // impls that are themselves thread-safe, such as UIModelWorker. - mutable Lock registrar_lock_; + mutable base::Lock registrar_lock_; // The frontend which we serve (and are owned by). SyncFrontend* frontend_; diff --git a/chrome/browser/sync/syncable/directory_manager.cc b/chrome/browser/sync/syncable/directory_manager.cc index fbdeb46..989fd0e 100644 --- a/chrome/browser/sync/syncable/directory_manager.cc +++ b/chrome/browser/sync/syncable/directory_manager.cc @@ -44,7 +44,7 @@ DirectoryManager::DirectoryManager(const FilePath& path) } DirectoryManager::~DirectoryManager() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); DCHECK_EQ(managed_directory_, static_cast<Directory*>(NULL)) << "Dir " << managed_directory_->name() << " not closed!"; delete channel_; @@ -63,7 +63,7 @@ DirOpenResult DirectoryManager::OpenImpl(const std::string& name, bool* was_open) { bool opened = false; { - AutoLock lock(lock_); + base::AutoLock lock(lock_); // Check to see if it's already open. if (managed_directory_) { DCHECK_EQ(ComparePathNames(name, managed_directory_->name()), 0) @@ -79,7 +79,7 @@ DirOpenResult DirectoryManager::OpenImpl(const std::string& name, scoped_ptr<Directory> dir(new Directory); const DirOpenResult result = dir->Open(path, name); if (syncable::OPENED == result) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); managed_directory_ = dir.release(); } return result; @@ -90,7 +90,7 @@ DirOpenResult DirectoryManager::OpenImpl(const std::string& name, void DirectoryManager::Close(const std::string& name) { // Erase from mounted and opened directory lists. { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (!managed_directory_ || ComparePathNames(name, managed_directory_->name()) != 0) { // It wasn't open. @@ -109,14 +109,14 @@ void DirectoryManager::Close(const std::string& name) { } void DirectoryManager::FinalSaveChangesForAll() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (managed_directory_) managed_directory_->SaveChanges(); } void DirectoryManager::GetOpenDirectories(DirNames* result) { result->clear(); - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (managed_directory_) result->push_back(managed_directory_->name()); } diff --git a/chrome/browser/sync/syncable/directory_manager.h b/chrome/browser/sync/syncable/directory_manager.h index 0c0b55d..625d082 100644 --- a/chrome/browser/sync/syncable/directory_manager.h +++ b/chrome/browser/sync/syncable/directory_manager.h @@ -18,7 +18,7 @@ #include "base/basictypes.h" #include "base/file_path.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "chrome/browser/sync/syncable/dir_open_result.h" #include "chrome/browser/sync/syncable/path_name_cmp.h" #include "chrome/browser/sync/syncable/syncable.h" @@ -87,7 +87,7 @@ class DirectoryManager { const FilePath root_path_; // protects managed_directory_ - Lock lock_; + base::Lock lock_; Directory* managed_directory_; Channel* const channel_; diff --git a/chrome/browser/sync/syncable/syncable.cc b/chrome/browser/sync/syncable/syncable.cc index 93ca8bb..83053fa 100644 --- a/chrome/browser/sync/syncable/syncable.cc +++ b/chrome/browser/sync/syncable/syncable.cc @@ -586,7 +586,7 @@ bool Directory::SaveChanges() { bool success = false; DCHECK(store_); - AutoLock scoped_lock(kernel_->save_changes_mutex); + base::AutoLock scoped_lock(kernel_->save_changes_mutex); // Snapshot and save. SaveChangesSnapshot snapshot; @@ -1141,7 +1141,7 @@ bool BaseTransaction::NotifyTransactionChangingAndEnding( { // Scoped_lock is only active through the calculate_changes and // transaction_ending events. - AutoLock scoped_lock(dirkernel_->changes_channel_mutex); + base::AutoLock scoped_lock(dirkernel_->changes_channel_mutex); // Tell listeners to calculate changes while we still have the mutex. DirectoryChangeEvent event = { DirectoryChangeEvent::CALCULATE_CHANGES, diff --git a/chrome/browser/sync/syncable/syncable.h b/chrome/browser/sync/syncable/syncable.h index d3b7527..4e1b0b9 100644 --- a/chrome/browser/sync/syncable/syncable.h +++ b/chrome/browser/sync/syncable/syncable.h @@ -18,7 +18,7 @@ #include "base/basictypes.h" #include "base/file_path.h" #include "base/gtest_prod_util.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "base/time.h" #include "chrome/browser/sync/protocol/sync.pb.h" #include "chrome/browser/sync/syncable/autofill_migration.h" @@ -807,7 +807,7 @@ class Directory { } }; public: - typedef EventChannel<DirectoryEventTraits, Lock> Channel; + typedef EventChannel<DirectoryEventTraits, base::Lock> Channel; typedef std::vector<int64> ChildHandles; // Returns the child meta handles for given parent id. @@ -960,7 +960,7 @@ class Directory { volatile base::subtle::AtomicWord refcount; // Implements ReadTransaction / WriteTransaction using a simple lock. - Lock transaction_mutex; + base::Lock transaction_mutex; // The name of this directory. std::string const name; @@ -972,7 +972,7 @@ class Directory { // // Never hold the mutex and do anything with the database or any // other buffered IO. Violating this rule will result in deadlock. - Lock mutex; + base::Lock mutex; MetahandlesIndex* metahandles_index; // Entries indexed by metahandle IdsIndex* ids_index; // Entries indexed by id ParentIdChildIndex* parent_id_child_index; @@ -1000,7 +1000,7 @@ class Directory { // releasing the transaction mutex. browser_sync::Channel<DirectoryChangeEvent> changes_channel; - Lock changes_channel_mutex; + base::Lock changes_channel_mutex; KernelShareInfoStatus info_status; // These 3 members are backed in the share_info table, and @@ -1016,7 +1016,7 @@ class Directory { // It doesn't make sense for two threads to run SaveChanges at the same // time; this mutex protects that activity. - Lock save_changes_mutex; + base::Lock save_changes_mutex; // The next metahandle is protected by kernel mutex. int64 next_metahandle; @@ -1036,7 +1036,7 @@ class ScopedKernelLock { explicit ScopedKernelLock(const Directory*); ~ScopedKernelLock() {} - AutoLock scoped_lock_; + base::AutoLock scoped_lock_; Directory* const dir_; DISALLOW_COPY_AND_ASSIGN(ScopedKernelLock); }; diff --git a/chrome/browser/sync/util/channel.h b/chrome/browser/sync/util/channel.h index 88ddfc4..839d653 100644 --- a/chrome/browser/sync/util/channel.h +++ b/chrome/browser/sync/util/channel.h @@ -50,8 +50,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#include "base/lock.h" #include "base/observer_list.h" +#include "base/synchronization/lock.h" #include "base/threading/platform_thread.h" namespace browser_sync { @@ -98,7 +98,7 @@ class Channel { ChannelHookup<EventType>* AddObserver( ChannelEventHandler<EventType>* observer) { - AutoLock scoped_lock(event_handlers_mutex_); + base::AutoLock scoped_lock(event_handlers_mutex_); event_handlers_.AddObserver(observer); return new ChannelHookup<EventType>(this, observer); } @@ -117,7 +117,7 @@ class Channel { } void Notify(const EventType& event) { - AutoLock scoped_lock(event_handlers_mutex_); + base::AutoLock scoped_lock(event_handlers_mutex_); // This may result in an observer trying to remove itself, so keep track // of the thread we're locked on. @@ -135,7 +135,7 @@ class Channel { } private: - Lock event_handlers_mutex_; + base::Lock event_handlers_mutex_; base::PlatformThreadId locking_thread_; ObserverList<EventHandler> event_handlers_; }; diff --git a/chrome/browser/sync/util/extensions_activity_monitor.cc b/chrome/browser/sync/util/extensions_activity_monitor.cc index aad4ab6..8c7a52a 100644 --- a/chrome/browser/sync/util/extensions_activity_monitor.cc +++ b/chrome/browser/sync/util/extensions_activity_monitor.cc @@ -65,13 +65,13 @@ ExtensionsActivityMonitor::~ExtensionsActivityMonitor() { } void ExtensionsActivityMonitor::GetAndClearRecords(Records* buffer) { - AutoLock lock(records_lock_); + base::AutoLock lock(records_lock_); buffer->clear(); buffer->swap(records_); } void ExtensionsActivityMonitor::PutRecords(const Records& records) { - AutoLock lock(records_lock_); + base::AutoLock lock(records_lock_); for (Records::const_iterator i = records.begin(); i != records.end(); ++i) { records_[i->first].extension_id = i->second.extension_id; records_[i->first].bookmark_write_count += i->second.bookmark_write_count; @@ -81,7 +81,7 @@ void ExtensionsActivityMonitor::PutRecords(const Records& records) { void ExtensionsActivityMonitor::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { - AutoLock lock(records_lock_); + base::AutoLock lock(records_lock_); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); const Extension* extension = Source<const Extension>(source).ptr(); const BookmarksFunction* f = Details<const BookmarksFunction>(details).ptr(); diff --git a/chrome/browser/sync/util/extensions_activity_monitor.h b/chrome/browser/sync/util/extensions_activity_monitor.h index f4d1037..f19090d 100644 --- a/chrome/browser/sync/util/extensions_activity_monitor.h +++ b/chrome/browser/sync/util/extensions_activity_monitor.h @@ -8,8 +8,8 @@ #include <map> -#include "base/lock.h" #include "base/message_loop.h" +#include "base/synchronization/lock.h" #include "chrome/common/notification_observer.h" #include "chrome/common/notification_registrar.h" @@ -62,7 +62,7 @@ class ExtensionsActivityMonitor : public NotificationObserver { const NotificationDetails& details); private: Records records_; - mutable Lock records_lock_; + mutable base::Lock records_lock_; // Used only from UI loop. NotificationRegistrar registrar_; diff --git a/chrome/browser/sync/util/user_settings.cc b/chrome/browser/sync/util/user_settings.cc index 9f52088..d49a071 100644 --- a/chrome/browser/sync/util/user_settings.cc +++ b/chrome/browser/sync/util/user_settings.cc @@ -79,7 +79,7 @@ UserSettings::UserSettings() : dbhandle_(NULL) { } string UserSettings::email() const { - AutoLock lock(mutex_); + base::AutoLock lock(mutex_); return email_; } @@ -421,7 +421,7 @@ bool UserSettings::VerifyAgainstStoredHash(const string& email, void UserSettings::SwitchUser(const string& username) { { - AutoLock lock(mutex_); + base::AutoLock lock(mutex_); email_ = username; } } diff --git a/chrome/browser/sync/util/user_settings.h b/chrome/browser/sync/util/user_settings.h index 5545c8c..546c8b0 100644 --- a/chrome/browser/sync/util/user_settings.h +++ b/chrome/browser/sync/util/user_settings.h @@ -9,7 +9,7 @@ #include <map> #include <string> -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "build/build_config.h" extern "C" struct sqlite3; @@ -79,7 +79,7 @@ class UserSettings { struct ScopedDBHandle { explicit ScopedDBHandle(UserSettings* settings); inline sqlite3* get() const { return *handle_; } - AutoLock mutex_lock_; + base::AutoLock mutex_lock_; sqlite3** const handle_; }; @@ -90,11 +90,11 @@ class UserSettings { private: std::string email_; - mutable Lock mutex_; // protects email_. + mutable base::Lock mutex_; // protects email_. // We keep a single dbhandle. sqlite3* dbhandle_; - Lock dbhandle_mutex_; + base::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 diff --git a/chrome/browser/tab_contents/thumbnail_generator.h b/chrome/browser/tab_contents/thumbnail_generator.h index 335b2cb..1952b53 100644 --- a/chrome/browser/tab_contents/thumbnail_generator.h +++ b/chrome/browser/tab_contents/thumbnail_generator.h @@ -13,7 +13,6 @@ #include "base/basictypes.h" #include "base/callback.h" #include "base/linked_ptr.h" -#include "base/lock.h" #include "base/timer.h" #include "chrome/browser/renderer_host/backing_store.h" #include "chrome/common/notification_observer.h" diff --git a/chrome/browser/task_manager/task_manager.h b/chrome/browser/task_manager/task_manager.h index 7fd1ad8..2b2cbea 100644 --- a/chrome/browser/task_manager/task_manager.h +++ b/chrome/browser/task_manager/task_manager.h @@ -13,7 +13,6 @@ #include "base/basictypes.h" #include "base/gtest_prod_util.h" -#include "base/lock.h" #include "base/observer_list.h" #include "base/process_util.h" #include "base/ref_counted.h" diff --git a/chrome/browser/transport_security_persister.h b/chrome/browser/transport_security_persister.h index 7db6b58..0073ea4 100644 --- a/chrome/browser/transport_security_persister.h +++ b/chrome/browser/transport_security_persister.h @@ -35,7 +35,6 @@ #pragma once #include "base/file_path.h" -#include "base/lock.h" #include "base/ref_counted.h" #include "base/task.h" #include "net/base/transport_security_state.h" diff --git a/chrome/browser/ui/cocoa/objc_zombie.mm b/chrome/browser/ui/cocoa/objc_zombie.mm index 5cf6469..31d2a62a 100644 --- a/chrome/browser/ui/cocoa/objc_zombie.mm +++ b/chrome/browser/ui/cocoa/objc_zombie.mm @@ -10,8 +10,8 @@ #import <objc/objc-class.h> -#include "base/lock.h" #include "base/logging.h" +#include "base/synchronization/lock.h" #import "chrome/app/breakpad_mac.h" #import "chrome/browser/ui/cocoa/objc_method_swizzle.h" @@ -56,7 +56,7 @@ size_t g_fatZombieSize = 0; BOOL g_zombieAllObjects = NO; // Protects |g_zombieCount|, |g_zombieIndex|, and |g_zombies|. -Lock lock_; +base::Lock lock_; // How many zombies to keep before freeing, and the current head of // the circular buffer. @@ -147,7 +147,7 @@ void ZombieDealloc(id self, SEL _cmd) { // Don't involve the lock when creating zombies without a treadmill. if (g_zombieCount > 0) { - AutoLock pin(lock_); + base::AutoLock pin(lock_); // Check the count again in a thread-safe manner. if (g_zombieCount > 0) { @@ -175,7 +175,7 @@ Class ZombieWasa(id object) { // For instances which weren't big enough to store |wasa|, check if // the object is still on the treadmill. - AutoLock pin(lock_); + base::AutoLock pin(lock_); for (size_t i=0; i < g_zombieCount; ++i) { if (g_zombies[i].object == object) return g_zombies[i].wasa; @@ -325,7 +325,7 @@ BOOL ZombieEnable(BOOL zombieAllObjects, ZombieRecord* oldZombies = g_zombies; { - AutoLock pin(lock_); + base::AutoLock pin(lock_); // Save the old index in case zombies need to be transferred. size_t oldIndex = g_zombieIndex; @@ -396,7 +396,7 @@ void ZombieDisable() { ZombieRecord* oldZombies = g_zombies; { - AutoLock pin(lock_); // In case any |-dealloc| are in-progress. + base::AutoLock pin(lock_); // In case any |-dealloc| are in-progress. g_zombieCount = 0; g_zombies = NULL; } diff --git a/chrome/browser/ui/login/login_prompt.cc b/chrome/browser/ui/login/login_prompt.cc index 3f37587..ac2c7c2 100644 --- a/chrome/browser/ui/login/login_prompt.cc +++ b/chrome/browser/ui/login/login_prompt.cc @@ -8,7 +8,7 @@ #include "app/l10n_util.h" #include "base/command_line.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/password_manager/password_manager.h" @@ -318,14 +318,14 @@ void LoginHandler::ReleaseSoon() { // Returns whether authentication had been handled (SetAuth or CancelAuth). bool LoginHandler::WasAuthHandled() const { - AutoLock lock(handled_auth_lock_); + base::AutoLock lock(handled_auth_lock_); bool was_handled = handled_auth_; return was_handled; } // Marks authentication as handled and returns the previous handled state. bool LoginHandler::TestAndSetAuthHandled() { - AutoLock lock(handled_auth_lock_); + base::AutoLock lock(handled_auth_lock_); bool was_handled = handled_auth_; handled_auth_ = true; return was_handled; diff --git a/chrome/browser/ui/login/login_prompt.h b/chrome/browser/ui/login/login_prompt.h index b566402..868da20 100644 --- a/chrome/browser/ui/login/login_prompt.h +++ b/chrome/browser/ui/login/login_prompt.h @@ -9,8 +9,8 @@ #include <string> #include "base/basictypes.h" -#include "base/lock.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #include "chrome/browser/password_manager/password_manager.h" #include "chrome/common/notification_observer.h" #include "chrome/common/notification_registrar.h" @@ -117,7 +117,7 @@ class LoginHandler : public base::RefCountedThreadSafe<LoginHandler>, // True if we've handled auth (SetAuth or CancelAuth has been called). bool handled_auth_; - mutable Lock handled_auth_lock_; + mutable base::Lock handled_auth_lock_; // The ConstrainedWindow that is hosting our LoginView. // This should only be accessed on the UI loop. diff --git a/chrome/browser/webdata/web_data_service.cc b/chrome/browser/webdata/web_data_service.cc index b359ef5..b52f225 100644 --- a/chrome/browser/webdata/web_data_service.cc +++ b/chrome/browser/webdata/web_data_service.cc @@ -73,7 +73,7 @@ void WebDataService::UnloadDatabase() { } void WebDataService::CancelRequest(Handle h) { - AutoLock l(pending_lock_); + base::AutoLock l(pending_lock_); RequestMap::iterator i = pending_requests_.find(h); if (i == pending_requests_.end()) { NOTREACHED() << "Canceling a nonexistent web data service request"; @@ -547,7 +547,7 @@ void WebDataService::RequestCompleted(Handle h) { } void WebDataService::RegisterRequest(WebDataRequest* request) { - AutoLock l(pending_lock_); + base::AutoLock l(pending_lock_); pending_requests_[request->GetHandle()] = request; } @@ -637,7 +637,7 @@ void WebDataService::ScheduleCommit() { } int WebDataService::GetNextRequestHandle() { - AutoLock l(pending_lock_); + base::AutoLock l(pending_lock_); return ++next_request_handle_; } diff --git a/chrome/browser/webdata/web_data_service.h b/chrome/browser/webdata/web_data_service.h index 63c5f5d..b881837 100644 --- a/chrome/browser/webdata/web_data_service.h +++ b/chrome/browser/webdata/web_data_service.h @@ -11,8 +11,8 @@ #include "app/sql/init_status.h" #include "base/file_path.h" -#include "base/lock.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/search_engines/template_url_id.h" #include "webkit/glue/form_field.h" @@ -627,7 +627,7 @@ class WebDataService bool should_commit_; // A lock to protect pending requests and next request handle. - Lock pending_lock_; + base::Lock pending_lock_; // Next handle to be used for requests. Incremented for each use. Handle next_request_handle_; diff --git a/chrome/browser/zygote_host_linux.cc b/chrome/browser/zygote_host_linux.cc index 6e2c7e3..ad6b0726 100644 --- a/chrome/browser/zygote_host_linux.cc +++ b/chrome/browser/zygote_host_linux.cc @@ -235,7 +235,7 @@ pid_t ZygoteHost::ForkRenderer( pid_t pid; { - AutoLock lock(control_lock_); + base::AutoLock lock(control_lock_); if (!UnixDomainSocket::SendMsg(control_fd_, pickle.data(), pickle.size(), fds)) return base::kNullProcessHandle; @@ -331,7 +331,7 @@ base::TerminationStatus ZygoteHost::GetTerminationStatus( char buf[kMaxMessageLength]; ssize_t len; { - AutoLock lock(control_lock_); + base::AutoLock lock(control_lock_); if (HANDLE_EINTR(write(control_fd_, pickle.data(), pickle.size())) < 0) PLOG(ERROR) << "write"; diff --git a/chrome/browser/zygote_host_linux.h b/chrome/browser/zygote_host_linux.h index e13f1b4..bbc00dc 100644 --- a/chrome/browser/zygote_host_linux.h +++ b/chrome/browser/zygote_host_linux.h @@ -12,9 +12,9 @@ #include <vector> #include "base/global_descriptors_posix.h" -#include "base/lock.h" #include "base/process.h" #include "base/process_util.h" +#include "base/synchronization/lock.h" template<typename Type> struct DefaultSingletonTraits; @@ -86,7 +86,7 @@ class ZygoteHost { // A lock protecting all communication with the zygote. This lock must be // acquired before sending a command and released after the result has been // received. - Lock control_lock_; + base::Lock control_lock_; pid_t pid_; bool init_; bool using_suid_sandbox_; diff --git a/chrome/common/net/gaia/gaia_authenticator.h b/chrome/common/net/gaia/gaia_authenticator.h index be1b2d9..ce0500d9 100644 --- a/chrome/common/net/gaia/gaia_authenticator.h +++ b/chrome/common/net/gaia/gaia_authenticator.h @@ -250,7 +250,7 @@ class GaiaAuthenticator { return auth_results_; } - typedef EventChannel<GaiaAuthEvent, Lock> Channel; + typedef EventChannel<GaiaAuthEvent, base::Lock> Channel; inline Channel* channel() const { return channel_; diff --git a/chrome/common/net/url_fetcher.cc b/chrome/common/net/url_fetcher.cc index e2aad81..ddccff1 100644 --- a/chrome/common/net/url_fetcher.cc +++ b/chrome/common/net/url_fetcher.cc @@ -8,7 +8,6 @@ #include "base/compiler_specific.h" #include "base/lazy_instance.h" -#include "base/lock.h" #include "base/message_loop_proxy.h" #include "base/scoped_ptr.h" #include "base/stl_util-inl.h" diff --git a/chrome/common/sqlite_utils.cc b/chrome/common/sqlite_utils.cc index 9d16c7f..15ae2c2 100644 --- a/chrome/common/sqlite_utils.cc +++ b/chrome/common/sqlite_utils.cc @@ -7,11 +7,11 @@ #include <list> #include "base/file_path.h" -#include "base/lock.h" #include "base/lazy_instance.h" #include "base/logging.h" #include "base/stl_util-inl.h" #include "base/string16.h" +#include "base/synchronization/lock.h" // The vanilla error handler implements the common fucntionality for all the // error handlers. Specialized error handlers are expected to only override @@ -67,13 +67,13 @@ class DefaultSQLErrorHandlerFactory : public SQLErrorHandlerFactory { private: void AddHandler(SQLErrorHandler* handler) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); errors_.push_back(handler); } typedef std::list<SQLErrorHandler*> ErrorList; ErrorList errors_; - Lock lock_; + base::Lock lock_; }; static base::LazyInstance<DefaultSQLErrorHandlerFactory> diff --git a/chrome/common/webmessageportchannel_impl.cc b/chrome/common/webmessageportchannel_impl.cc index 933d88a..5326983 100644 --- a/chrome/common/webmessageportchannel_impl.cc +++ b/chrome/common/webmessageportchannel_impl.cc @@ -53,7 +53,7 @@ WebMessagePortChannelImpl::~WebMessagePortChannelImpl() { void WebMessagePortChannelImpl::setClient(WebMessagePortChannelClient* client) { // Must lock here since client_ is called on the main thread. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); client_ = client; } @@ -105,7 +105,7 @@ void WebMessagePortChannelImpl::postMessage( bool WebMessagePortChannelImpl::tryGetMessage( WebString* message, WebMessagePortChannelArray& channels) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (message_queue_.empty()) return false; @@ -194,7 +194,7 @@ void WebMessagePortChannelImpl::OnMessage( const string16& message, const std::vector<int>& sent_message_port_ids, const std::vector<int>& new_routing_ids) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); Message msg; msg.message = message; if (!sent_message_port_ids.empty()) { @@ -215,7 +215,7 @@ void WebMessagePortChannelImpl::OnMessagedQueued() { std::vector<QueuedMessage> queued_messages; { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); queued_messages.reserve(message_queue_.size()); while (!message_queue_.empty()) { string16 message = message_queue_.front().message; diff --git a/chrome/common/webmessageportchannel_impl.h b/chrome/common/webmessageportchannel_impl.h index 46dddfe..846a546 100644 --- a/chrome/common/webmessageportchannel_impl.h +++ b/chrome/common/webmessageportchannel_impl.h @@ -10,9 +10,9 @@ #include <vector> #include "base/basictypes.h" -#include "base/lock.h" #include "base/string16.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #include "ipc/ipc_channel.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebMessagePortChannel.h" @@ -67,7 +67,7 @@ class WebMessagePortChannelImpl MessageQueue message_queue_; WebKit::WebMessagePortChannelClient* client_; - Lock lock_; // Locks access to above. + base::Lock lock_; // Locks access to above. int route_id_; // The routing id for this object. int message_port_id_; // A globally unique identifier for this message port. diff --git a/chrome/common/worker_thread_ticker.cc b/chrome/common/worker_thread_ticker.cc index 909cc8d..abbda88 100644 --- a/chrome/common/worker_thread_ticker.cc +++ b/chrome/common/worker_thread_ticker.cc @@ -44,7 +44,7 @@ WorkerThreadTicker::~WorkerThreadTicker() { bool WorkerThreadTicker::RegisterTickHandler(Callback *tick_handler) { DCHECK(tick_handler); - AutoLock lock(lock_); + base::AutoLock lock(lock_); // You cannot change the list of handlers when the timer is running. // You need to call Stop first. if (IsRunning()) @@ -55,7 +55,7 @@ bool WorkerThreadTicker::RegisterTickHandler(Callback *tick_handler) { bool WorkerThreadTicker::UnregisterTickHandler(Callback *tick_handler) { DCHECK(tick_handler); - AutoLock lock(lock_); + base::AutoLock lock(lock_); // You cannot change the list of handlers when the timer is running. // You need to call Stop first. if (IsRunning()) { @@ -74,7 +74,7 @@ bool WorkerThreadTicker::UnregisterTickHandler(Callback *tick_handler) { bool WorkerThreadTicker::Start() { // Do this in a lock because we don't want 2 threads to // call Start at the same time - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (IsRunning()) return false; if (!timer_thread_.Start()) @@ -87,7 +87,7 @@ bool WorkerThreadTicker::Start() { bool WorkerThreadTicker::Stop() { // Do this in a lock because we don't want 2 threads to // call Stop at the same time - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (!IsRunning()) return false; is_running_ = false; diff --git a/chrome/common/worker_thread_ticker.h b/chrome/common/worker_thread_ticker.h index d18feec..07f85eb 100644 --- a/chrome/common/worker_thread_ticker.h +++ b/chrome/common/worker_thread_ticker.h @@ -8,7 +8,7 @@ #include <vector> -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "base/threading/thread.h" // This class provides the following functionality: @@ -74,7 +74,7 @@ class WorkerThreadTicker { typedef std::vector<Callback*> TickHandlerListType; // Lock to protect is_running_ and tick_handler_list_ - Lock lock_; + base::Lock lock_; base::Thread timer_thread_; bool is_running_; diff --git a/chrome/gpu/gpu_channel.cc b/chrome/gpu/gpu_channel.cc index 1c07793..66b928e 100644 --- a/chrome/gpu/gpu_channel.cc +++ b/chrome/gpu/gpu_channel.cc @@ -9,7 +9,6 @@ #endif #include "base/command_line.h" -#include "base/lock.h" #include "base/process_util.h" #include "base/string_util.h" #include "chrome/common/child_process.h" diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc index 1cf45118..4387b51 100644 --- a/chrome/installer/util/browser_distribution.cc +++ b/chrome/installer/util/browser_distribution.cc @@ -13,7 +13,6 @@ #include "base/command_line.h" #include "base/file_path.h" #include "base/path_service.h" -#include "base/lock.h" #include "base/logging.h" #include "base/win/registry.h" #include "chrome/common/env_vars.h" diff --git a/chrome/plugin/plugin_channel.cc b/chrome/plugin/plugin_channel.cc index 74a2ac0..205b3fa 100644 --- a/chrome/plugin/plugin_channel.cc +++ b/chrome/plugin/plugin_channel.cc @@ -5,9 +5,9 @@ #include "chrome/plugin/plugin_channel.h" #include "base/command_line.h" -#include "base/lock.h" #include "base/process_util.h" #include "base/string_util.h" +#include "base/synchronization/lock.h" #include "base/synchronization/waitable_event.h" #include "build/build_config.h" #include "chrome/common/child_process.h" @@ -50,7 +50,7 @@ class PluginChannel::MessageFilter : public IPC::ChannelProxy::MessageFilter { base::WaitableEvent* GetModalDialogEvent( gfx::NativeViewId containing_window) { - AutoLock auto_lock(modal_dialog_event_map_lock_); + base::AutoLock auto_lock(modal_dialog_event_map_lock_); if (!modal_dialog_event_map_.count(containing_window)) { NOTREACHED(); return NULL; @@ -62,7 +62,7 @@ class PluginChannel::MessageFilter : public IPC::ChannelProxy::MessageFilter { // Decrement the ref count associated with the modal dialog event for the // given tab. void ReleaseModalDialogEvent(gfx::NativeViewId containing_window) { - AutoLock auto_lock(modal_dialog_event_map_lock_); + base::AutoLock auto_lock(modal_dialog_event_map_lock_); if (!modal_dialog_event_map_.count(containing_window)) { NOTREACHED(); return; @@ -98,7 +98,7 @@ class PluginChannel::MessageFilter : public IPC::ChannelProxy::MessageFilter { } void OnInit(const PluginMsg_Init_Params& params, IPC::Message* reply_msg) { - AutoLock auto_lock(modal_dialog_event_map_lock_); + base::AutoLock auto_lock(modal_dialog_event_map_lock_); if (modal_dialog_event_map_.count(params.containing_window)) { modal_dialog_event_map_[params.containing_window].refcount++; return; @@ -111,13 +111,13 @@ class PluginChannel::MessageFilter : public IPC::ChannelProxy::MessageFilter { } void OnSignalModalDialogEvent(gfx::NativeViewId containing_window) { - AutoLock auto_lock(modal_dialog_event_map_lock_); + base::AutoLock auto_lock(modal_dialog_event_map_lock_); if (modal_dialog_event_map_.count(containing_window)) modal_dialog_event_map_[containing_window].event->Signal(); } void OnResetModalDialogEvent(gfx::NativeViewId containing_window) { - AutoLock auto_lock(modal_dialog_event_map_lock_); + base::AutoLock auto_lock(modal_dialog_event_map_lock_); if (modal_dialog_event_map_.count(containing_window)) modal_dialog_event_map_[containing_window].event->Reset(); } @@ -128,7 +128,7 @@ class PluginChannel::MessageFilter : public IPC::ChannelProxy::MessageFilter { }; typedef std::map<gfx::NativeViewId, WaitableEventWrapper> ModalDialogEventMap; ModalDialogEventMap modal_dialog_event_map_; - Lock modal_dialog_event_map_lock_; + base::Lock modal_dialog_event_map_lock_; IPC::Channel* channel_; }; diff --git a/chrome/renderer/media/audio_renderer_impl.cc b/chrome/renderer/media/audio_renderer_impl.cc index 0021656..77f82b2 100644 --- a/chrome/renderer/media/audio_renderer_impl.cc +++ b/chrome/renderer/media/audio_renderer_impl.cc @@ -71,7 +71,7 @@ bool AudioRendererImpl::OnInitialize(const media::MediaFormat& media_format) { } void AudioRendererImpl::OnStop() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stopped_) return; stopped_ = true; @@ -84,7 +84,7 @@ void AudioRendererImpl::OnStop() { void AudioRendererImpl::ConsumeAudioSamples( scoped_refptr<media::Buffer> buffer_in) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stopped_) return; @@ -101,7 +101,7 @@ void AudioRendererImpl::ConsumeAudioSamples( void AudioRendererImpl::SetPlaybackRate(float rate) { DCHECK(rate >= 0.0f); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // Handle the case where we stopped due to |io_loop_| dying. if (stopped_) { AudioRendererBase::SetPlaybackRate(rate); @@ -132,7 +132,7 @@ void AudioRendererImpl::SetPlaybackRate(float rate) { void AudioRendererImpl::Pause(media::FilterCallback* callback) { AudioRendererBase::Pause(callback); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stopped_) return; @@ -143,7 +143,7 @@ void AudioRendererImpl::Pause(media::FilterCallback* callback) { void AudioRendererImpl::Seek(base::TimeDelta time, media::FilterCallback* callback) { AudioRendererBase::Seek(time, callback); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stopped_) return; @@ -154,7 +154,7 @@ void AudioRendererImpl::Seek(base::TimeDelta time, void AudioRendererImpl::Play(media::FilterCallback* callback) { AudioRendererBase::Play(callback); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stopped_) return; @@ -168,7 +168,7 @@ void AudioRendererImpl::Play(media::FilterCallback* callback) { } void AudioRendererImpl::SetVolume(float volume) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stopped_) return; io_loop_->PostTask(FROM_HERE, @@ -180,7 +180,7 @@ void AudioRendererImpl::OnCreated(base::SharedMemoryHandle handle, uint32 length) { DCHECK(MessageLoop::current() == io_loop_); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stopped_) return; @@ -199,7 +199,7 @@ void AudioRendererImpl::OnRequestPacket(AudioBuffersState buffers_state) { DCHECK(MessageLoop::current() == io_loop_); { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK(!pending_request_); pending_request_ = true; request_buffers_state_ = buffers_state; @@ -213,7 +213,7 @@ void AudioRendererImpl::OnStateChanged( const ViewMsg_AudioStreamState_Params& state) { DCHECK(MessageLoop::current() == io_loop_); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stopped_) return; @@ -244,7 +244,7 @@ void AudioRendererImpl::OnVolume(double volume) { void AudioRendererImpl::CreateStreamTask(AudioParameters audio_params) { DCHECK(MessageLoop::current() == io_loop_); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stopped_) return; @@ -297,7 +297,7 @@ void AudioRendererImpl::DestroyTask() { void AudioRendererImpl::SetVolumeTask(double volume) { DCHECK(MessageLoop::current() == io_loop_); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stopped_) return; filter_->Send(new ViewHostMsg_SetAudioVolume(0, stream_id_, volume)); @@ -306,7 +306,7 @@ void AudioRendererImpl::SetVolumeTask(double volume) { void AudioRendererImpl::NotifyPacketReadyTask() { DCHECK(MessageLoop::current() == io_loop_); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stopped_) return; if (pending_request_ && GetPlaybackRate() > 0.0f) { @@ -352,7 +352,7 @@ void AudioRendererImpl::WillDestroyCurrentMessageLoop() { DCHECK(MessageLoop::current() == io_loop_); // We treat the IO loop going away the same as stopping. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stopped_) return; diff --git a/chrome/renderer/media/audio_renderer_impl.h b/chrome/renderer/media/audio_renderer_impl.h index 6463b27..7ea3dd5 100644 --- a/chrome/renderer/media/audio_renderer_impl.h +++ b/chrome/renderer/media/audio_renderer_impl.h @@ -41,8 +41,8 @@ #include "base/gtest_prod_util.h" #include "base/message_loop.h" #include "base/scoped_ptr.h" -#include "base/lock.h" #include "base/shared_memory.h" +#include "base/synchronization/lock.h" #include "chrome/renderer/audio_message_filter.h" #include "media/audio/audio_io.h" #include "media/audio/audio_manager.h" @@ -134,7 +134,7 @@ class AudioRendererImpl : public media::AudioRendererBase, // - |stopped_| // - |pending_request_| // - |request_buffers_state_| - Lock lock_; + base::Lock lock_; // A flag that indicates this filter is called to stop. bool stopped_; diff --git a/chrome/renderer/renderer_webkitclient_impl.cc b/chrome/renderer/renderer_webkitclient_impl.cc index cebbfd2..ab51c01 100644 --- a/chrome/renderer/renderer_webkitclient_impl.cc +++ b/chrome/renderer/renderer_webkitclient_impl.cc @@ -59,7 +59,7 @@ #include <string> #include <map> -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "chrome/renderer/renderer_sandbox_support_linux.h" #include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebSandboxSupport.h" #endif @@ -124,7 +124,7 @@ class RendererWebKitClientImpl::SandboxSupport // unicode code points. It needs this information frequently so we cache it // here. The key in this map is an array of 16-bit UTF16 values from WebKit. // The value is a string containing the correct font family. - Lock unicode_font_families_mutex_; + base::Lock unicode_font_families_mutex_; std::map<std::string, std::string> unicode_font_families_; #endif }; @@ -423,7 +423,7 @@ bool RendererWebKitClientImpl::SandboxSupport::ensureFontLoaded(HFONT font) { WebString RendererWebKitClientImpl::SandboxSupport::getFontFamilyForCharacters( const WebKit::WebUChar* characters, size_t num_characters) { - AutoLock lock(unicode_font_families_mutex_); + base::AutoLock lock(unicode_font_families_mutex_); const std::string key(reinterpret_cast<const char*>(characters), num_characters * sizeof(characters[0])); const std::map<std::string, std::string>::const_iterator iter = diff --git a/chrome/service/cloud_print/print_system_cups.cc b/chrome/service/cloud_print/print_system_cups.cc index a92af54..1e10ccd 100644 --- a/chrome/service/cloud_print/print_system_cups.cc +++ b/chrome/service/cloud_print/print_system_cups.cc @@ -15,7 +15,6 @@ #include "base/file_path.h" #include "base/json/json_reader.h" -#include "base/lock.h" #include "base/logging.h" #include "base/md5.h" #include "base/message_loop.h" diff --git a/chrome/test/automation/automation_handle_tracker.cc b/chrome/test/automation/automation_handle_tracker.cc index 0ad7592..6f01e7b 100644 --- a/chrome/test/automation/automation_handle_tracker.cc +++ b/chrome/test/automation/automation_handle_tracker.cc @@ -34,12 +34,12 @@ AutomationHandleTracker::~AutomationHandleTracker() { } void AutomationHandleTracker::Add(AutomationResourceProxy* proxy) { - AutoLock lock(map_lock_); + base::AutoLock lock(map_lock_); handle_to_object_.insert(MapEntry(proxy->handle(), proxy)); } void AutomationHandleTracker::Remove(AutomationResourceProxy* proxy) { - AutoLock lock(map_lock_); + base::AutoLock lock(map_lock_); HandleToObjectMap::iterator iter = handle_to_object_.find(proxy->handle()); if (iter != handle_to_object_.end()) { AutomationHandle proxy_handle = proxy->handle(); @@ -51,7 +51,7 @@ void AutomationHandleTracker::Remove(AutomationResourceProxy* proxy) { void AutomationHandleTracker::InvalidateHandle(AutomationHandle handle) { // Called in background thread. - AutoLock lock(map_lock_); + base::AutoLock lock(map_lock_); HandleToObjectMap::iterator iter = handle_to_object_.find(handle); if (iter != handle_to_object_.end()) { scoped_refptr<AutomationResourceProxy> proxy = iter->second; @@ -62,7 +62,7 @@ void AutomationHandleTracker::InvalidateHandle(AutomationHandle handle) { AutomationResourceProxy* AutomationHandleTracker::GetResource( AutomationHandle handle) { - AutoLock lock(map_lock_); + base::AutoLock lock(map_lock_); HandleToObjectMap::iterator iter = handle_to_object_.find(handle); if (iter == handle_to_object_.end()) return NULL; diff --git a/chrome/test/automation/automation_handle_tracker.h b/chrome/test/automation/automation_handle_tracker.h index bfa319a..9558af2 100644 --- a/chrome/test/automation/automation_handle_tracker.h +++ b/chrome/test/automation/automation_handle_tracker.h @@ -12,8 +12,8 @@ #include <map> #include "base/basictypes.h" -#include "base/lock.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #include "ipc/ipc_channel.h" // This represents a value that the app's AutomationProvider returns @@ -106,7 +106,7 @@ class AutomationHandleTracker { HandleToObjectMap handle_to_object_; - Lock map_lock_; + base::Lock map_lock_; IPC::Channel* channel_; DISALLOW_COPY_AND_ASSIGN(AutomationHandleTracker); }; diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc index 646e7a8..f7908c4 100644 --- a/chrome/test/automation/tab_proxy.cc +++ b/chrome/test/automation/tab_proxy.cc @@ -789,25 +789,25 @@ void TabProxy::JavaScriptStressTestControl(int cmd, int param) { } void TabProxy::AddObserver(TabProxyDelegate* observer) { - AutoLock lock(list_lock_); + base::AutoLock lock(list_lock_); observers_list_.AddObserver(observer); } void TabProxy::RemoveObserver(TabProxyDelegate* observer) { - AutoLock lock(list_lock_); + base::AutoLock lock(list_lock_); observers_list_.RemoveObserver(observer); } // Called on Channel background thread, if TabMessages filter is installed. bool TabProxy::OnMessageReceived(const IPC::Message& message) { - AutoLock lock(list_lock_); + base::AutoLock lock(list_lock_); FOR_EACH_OBSERVER(TabProxyDelegate, observers_list_, OnMessageReceived(this, message)); return true; } void TabProxy::OnChannelError() { - AutoLock lock(list_lock_); + base::AutoLock lock(list_lock_); FOR_EACH_OBSERVER(TabProxyDelegate, observers_list_, OnChannelError(this)); } diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h index f8aaf6f..aabc2a6 100644 --- a/chrome/test/automation/tab_proxy.h +++ b/chrome/test/automation/tab_proxy.h @@ -432,7 +432,7 @@ class TabProxy : public AutomationResourceProxy, void LastObjectRemoved(); private: - Lock list_lock_; // Protects the observers_list_. + base::Lock list_lock_; // Protects the observers_list_. ObserverList<TabProxyDelegate> observers_list_; DISALLOW_COPY_AND_ASSIGN(TabProxy); }; diff --git a/chrome/test/sync/engine/mock_connection_manager.cc b/chrome/test/sync/engine/mock_connection_manager.cc index 04758aa..371371b 100644 --- a/chrome/test/sync/engine/mock_connection_manager.cc +++ b/chrome/test/sync/engine/mock_connection_manager.cc @@ -140,7 +140,7 @@ bool MockConnectionManager::PostBufferToPath(const PostBufferParams* params, } { - AutoLock lock(response_code_override_lock_); + base::AutoLock lock(response_code_override_lock_); if (throttling_) { response.set_error_code(ClientToServerResponse::THROTTLED); throttling_ = false; @@ -543,7 +543,7 @@ const CommitResponse& MockConnectionManager::last_commit_response() const { void MockConnectionManager::ThrottleNextRequest( ResponseCodeOverrideRequestor* visitor) { - AutoLock lock(response_code_override_lock_); + base::AutoLock lock(response_code_override_lock_); throttling_ = true; if (visitor) visitor->OnOverrideComplete(); @@ -551,7 +551,7 @@ void MockConnectionManager::ThrottleNextRequest( void MockConnectionManager::FailWithAuthInvalid( ResponseCodeOverrideRequestor* visitor) { - AutoLock lock(response_code_override_lock_); + base::AutoLock lock(response_code_override_lock_); fail_with_auth_invalid_ = true; if (visitor) visitor->OnOverrideComplete(); @@ -559,7 +559,7 @@ void MockConnectionManager::FailWithAuthInvalid( void MockConnectionManager::StopFailingWithAuthInvalid( ResponseCodeOverrideRequestor* visitor) { - AutoLock lock(response_code_override_lock_); + base::AutoLock lock(response_code_override_lock_); fail_with_auth_invalid_ = false; if (visitor) visitor->OnOverrideComplete(); diff --git a/chrome/test/sync/engine/mock_connection_manager.h b/chrome/test/sync/engine/mock_connection_manager.h index 5fe44b5..a764eaaae 100644 --- a/chrome/test/sync/engine/mock_connection_manager.h +++ b/chrome/test/sync/engine/mock_connection_manager.h @@ -191,7 +191,7 @@ class MockConnectionManager : public browser_sync::ServerConnectionManager { void set_store_birthday(string new_birthday) { // Multiple threads can set store_birthday_ in our tests, need to lock it to // ensure atomic read/writes and avoid race conditions. - AutoLock lock(store_birthday_lock_); + base::AutoLock lock(store_birthday_lock_); store_birthday_ = new_birthday; } @@ -219,7 +219,7 @@ class MockConnectionManager : public browser_sync::ServerConnectionManager { // Const necessary to avoid any hidden copy-on-write issues that would break // in multithreaded scenarios (see |set_store_birthday|). const std::string& store_birthday() { - AutoLock lock(store_birthday_lock_); + base::AutoLock lock(store_birthday_lock_); return store_birthday_; } @@ -285,7 +285,7 @@ class MockConnectionManager : public browser_sync::ServerConnectionManager { // The store birthday we send to the client. string store_birthday_; - Lock store_birthday_lock_; + base::Lock store_birthday_lock_; bool store_birthday_sent_; bool client_stuck_; string commit_time_rename_prepended_string_; @@ -320,7 +320,7 @@ class MockConnectionManager : public browser_sync::ServerConnectionManager { // Protected by |response_code_override_lock_|. bool fail_with_auth_invalid_; - Lock response_code_override_lock_; + base::Lock response_code_override_lock_; // True if we are only accepting GetUpdatesCallerInfo::PERIODIC requests. bool fail_non_periodic_get_updates_; diff --git a/chrome/test/webdriver/session_manager.h b/chrome/test/webdriver/session_manager.h index 91db207..0c5c5bfd 100644 --- a/chrome/test/webdriver/session_manager.h +++ b/chrome/test/webdriver/session_manager.h @@ -40,7 +40,7 @@ class SessionManager { std::string IPLookup(const std::string& nic); std::map<std::string, Session*> map_; - Lock session_generation_; + base::Lock session_generation_; // Record the address and port for the HTTP 303 See other redirect. // We save the IP and Port of the machine chromedriver is running on since // a HTTP 303, see other, resdirect is sent after a successful creation of diff --git a/chrome/tools/crash_service/crash_service.cc b/chrome/tools/crash_service/crash_service.cc index 4697e92..e672880 100644 --- a/chrome/tools/crash_service/crash_service.cc +++ b/chrome/tools/crash_service/crash_service.cc @@ -162,7 +162,7 @@ CrashService::CrashService(const std::wstring& report_dir) } CrashService::~CrashService() { - AutoLock lock(sending_); + base::AutoLock lock(sending_); delete dumper_; delete sender_; } @@ -316,7 +316,7 @@ void CrashService::OnClientExited(void* context, // thread takes the sending_ lock, so the sleep is just to give it a // chance to start. ::Sleep(1000); - AutoLock lock(self->sending_); + base::AutoLock lock(self->sending_); // Some people can restart chrome very fast, check again if we have // a new client before exiting for real. if (self->clients_connected_ == self->clients_terminated_) { @@ -396,7 +396,7 @@ unsigned long CrashService::AsyncSendDump(void* context) { { // Take the server lock while sending. This also prevent early // termination of the service object. - AutoLock lock(info->self->sending_); + base::AutoLock lock(info->self->sending_); VLOG(1) << "trying to send report for pid = " << info->pid; google_breakpad::ReportResult send_result = info->self->sender_->SendCrashReport(kCrashReportURL, info->map, diff --git a/chrome/tools/crash_service/crash_service.h b/chrome/tools/crash_service/crash_service.h index 2d4c472..82bc4be 100644 --- a/chrome/tools/crash_service/crash_service.h +++ b/chrome/tools/crash_service/crash_service.h @@ -10,7 +10,7 @@ #include "base/basictypes.h" #include "base/file_path.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" namespace google_breakpad { @@ -109,7 +109,7 @@ class CrashService { int requests_sent_; volatile long clients_connected_; volatile long clients_terminated_; - Lock sending_; + base::Lock sending_; DISALLOW_COPY_AND_ASSIGN(CrashService); }; |