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 | |
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
297 files changed, 1085 insertions, 1114 deletions
diff --git a/base/at_exit.h b/base/at_exit.h index 35c96b9..15dcfc8 100644 --- a/base/at_exit.h +++ b/base/at_exit.h @@ -9,7 +9,7 @@ #include <stack> #include "base/basictypes.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" namespace base { @@ -60,7 +60,7 @@ class AtExitManager { void* param_; }; - Lock lock_; + base::Lock lock_; std::stack<CallbackAndParam> stack_; AtExitManager* next_manager_; // Stack of managers to allow shadowing. diff --git a/base/crypto/capi_util.cc b/base/crypto/capi_util.cc index cf47a50..ef57a3c 100644 --- a/base/crypto/capi_util.cc +++ b/base/crypto/capi_util.cc @@ -5,8 +5,8 @@ #include "base/crypto/capi_util.h" #include "base/basictypes.h" -#include "base/lock.h" #include "base/singleton.h" +#include "base/synchronization/lock.h" namespace { @@ -18,7 +18,7 @@ class CAPIUtilSingleton { // Returns a lock to guard calls to CryptAcquireContext with // CRYPT_DELETEKEYSET or CRYPT_NEWKEYSET. - Lock& acquire_context_lock() { + base::Lock& acquire_context_lock() { return acquire_context_lock_; } @@ -28,7 +28,7 @@ class CAPIUtilSingleton { CAPIUtilSingleton() {} - Lock acquire_context_lock_; + base::Lock acquire_context_lock_; DISALLOW_COPY_AND_ASSIGN(CAPIUtilSingleton); }; @@ -43,7 +43,7 @@ BOOL CryptAcquireContextLocked(HCRYPTPROV* prov, DWORD prov_type, DWORD flags) { - AutoLock lock(CAPIUtilSingleton::GetInstance()->acquire_context_lock()); + base::AutoLock lock(CAPIUtilSingleton::GetInstance()->acquire_context_lock()); return CryptAcquireContext(prov, container, provider, prov_type, flags); } diff --git a/base/debug/stack_trace_win.cc b/base/debug/stack_trace_win.cc index 6f4ad02..510d35b 100644 --- a/base/debug/stack_trace_win.cc +++ b/base/debug/stack_trace_win.cc @@ -10,9 +10,9 @@ #include <iostream> #include "base/basictypes.h" -#include "base/lock.h" #include "base/logging.h" #include "base/singleton.h" +#include "base/synchronization/lock.h" namespace base { namespace debug { @@ -59,7 +59,7 @@ class SymbolContext { void OutputTraceToStream(const void* const* trace, int count, std::ostream* os) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); for (size_t i = 0; (i < count) && os->good(); ++i) { const int kMaxNameLength = 256; @@ -129,7 +129,7 @@ class SymbolContext { } DWORD init_error_; - Lock lock_; + base::Lock lock_; DISALLOW_COPY_AND_ASSIGN(SymbolContext); }; diff --git a/base/debug/trace_event.h b/base/debug/trace_event.h index 160bbc8..3eb1f49a 100644 --- a/base/debug/trace_event.h +++ b/base/debug/trace_event.h @@ -31,9 +31,9 @@ #include <string> -#include "base/lock.h" #include "base/scoped_ptr.h" #include "base/singleton.h" +#include "base/synchronization/lock.h" #include "base/time.h" #include "base/timer.h" @@ -135,7 +135,7 @@ class TraceLog { bool enabled_; FILE* log_file_; - Lock file_lock_; + base::Lock file_lock_; TimeTicks trace_start_time_; scoped_ptr<base::ProcessMetrics> process_metrics_; RepeatingTimer<TraceLog> timer_; diff --git a/base/i18n/file_util_icu.cc b/base/i18n/file_util_icu.cc index 34eefac..ba69da0 100644 --- a/base/i18n/file_util_icu.cc +++ b/base/i18n/file_util_icu.cc @@ -90,7 +90,7 @@ class LocaleAwareComparator { int Compare(const string16& a, const string16& b) { // We are not sure if Collator::compare is thread-safe. // Use an AutoLock just in case. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); UErrorCode error_code = U_ZERO_ERROR; UCollationResult result = collator_->compare( @@ -120,7 +120,7 @@ class LocaleAwareComparator { } scoped_ptr<icu::Collator> collator_; - Lock lock_; + base::Lock lock_; friend struct DefaultSingletonTraits<LocaleAwareComparator>; DISALLOW_COPY_AND_ASSIGN(LocaleAwareComparator); diff --git a/base/linux_util.cc b/base/linux_util.cc index e1f7275..4e7cc5c 100644 --- a/base/linux_util.cc +++ b/base/linux_util.cc @@ -17,12 +17,12 @@ #include "base/command_line.h" #include "base/file_util.h" -#include "base/lock.h" #include "base/path_service.h" #include "base/process_util.h" #include "base/singleton.h" #include "base/scoped_ptr.h" #include "base/string_util.h" +#include "base/synchronization/lock.h" namespace { @@ -51,7 +51,7 @@ class LinuxDistroHelper { // we automatically move to STATE_CHECK_STARTED so nobody else will // do the check. LinuxDistroState State() { - AutoLock scoped_lock(lock_); + base::AutoLock scoped_lock(lock_); if (STATE_DID_NOT_CHECK == state_) { state_ = STATE_CHECK_STARTED; return STATE_DID_NOT_CHECK; @@ -61,13 +61,13 @@ class LinuxDistroHelper { // Indicate the check finished, move to STATE_CHECK_FINISHED. void CheckFinished() { - AutoLock scoped_lock(lock_); + base::AutoLock scoped_lock(lock_); DCHECK(state_ == STATE_CHECK_STARTED); state_ = STATE_CHECK_FINISHED; } private: - Lock lock_; + base::Lock lock_; LinuxDistroState state_; }; #endif // if defined(OS_LINUX) diff --git a/base/lock.h b/base/lock.h deleted file mode 100644 index 7c90d86..0000000 --- a/base/lock.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef BASE_LOCK_H_ -#define BASE_LOCK_H_ -#pragma once - -// This is a temporary forwarding file so not every user of lock needs to -// be updated at once. -// TODO(brettw) remove this and fix everybody up to using the new location. -#include "base/synchronization/lock.h" - -using base::AutoLock; -using base::AutoUnlock; -using base::Lock; - -#endif // BASE_LOCK_H_ diff --git a/base/message_loop.cc b/base/message_loop.cc index e74331a..518a0fd 100644 --- a/base/message_loop.cc +++ b/base/message_loop.cc @@ -394,7 +394,7 @@ void MessageLoop::ReloadWorkQueue() { // Acquire all we can from the inter-thread queue with one lock acquisition. { - AutoLock lock(incoming_queue_lock_); + base::AutoLock lock(incoming_queue_lock_); if (incoming_queue_.empty()) return; incoming_queue_.Swap(&work_queue_); // Constant time @@ -495,7 +495,7 @@ void MessageLoop::PostTask_Helper( scoped_refptr<base::MessagePump> pump; { - AutoLock locked(incoming_queue_lock_); + base::AutoLock locked(incoming_queue_lock_); bool was_empty = incoming_queue_.empty(); incoming_queue_.push(pending_task); diff --git a/base/message_loop.h b/base/message_loop.h index d5093a9..7a3af6e 100644 --- a/base/message_loop.h +++ b/base/message_loop.h @@ -10,10 +10,10 @@ #include <string> #include "base/basictypes.h" -#include "base/lock.h" #include "base/message_pump.h" #include "base/observer_list.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #include "base/task.h" #if defined(OS_WIN) @@ -466,7 +466,7 @@ class MessageLoop : public base::MessagePump::Delegate { // will be handled by the TimerManager. TaskQueue incoming_queue_; // Protect access to incoming_queue_. - Lock incoming_queue_lock_; + base::Lock incoming_queue_lock_; RunState* state_; diff --git a/base/message_loop_proxy_impl.h b/base/message_loop_proxy_impl.h index 44ab2ea..03e0271 100644 --- a/base/message_loop_proxy_impl.h +++ b/base/message_loop_proxy_impl.h @@ -6,9 +6,9 @@ #define BASE_MESSAGE_LOOP_PROXY_IMPL_H_ #pragma once -#include "base/lock.h" #include "base/message_loop.h" #include "base/message_loop_proxy.h" +#include "base/synchronization/lock.h" namespace base { @@ -50,7 +50,7 @@ class MessageLoopProxyImpl : public MessageLoopProxy, friend class MessageLoopProxy; // The lock that protects access to target_message_loop_. - mutable Lock message_loop_lock_; + mutable base::Lock message_loop_lock_; MessageLoop* target_message_loop_; DISALLOW_COPY_AND_ASSIGN(MessageLoopProxyImpl); diff --git a/base/metrics/field_trial.h b/base/metrics/field_trial.h index 077a88c..ec3a483 100644 --- a/base/metrics/field_trial.h +++ b/base/metrics/field_trial.h @@ -67,8 +67,8 @@ #include <string> #include "base/gtest_prod_util.h" -#include "base/lock.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #include "base/time.h" namespace base { @@ -271,7 +271,7 @@ class FieldTrialList { TimeTicks application_start_time_; // Lock for access to registered_. - Lock lock_; + base::Lock lock_; RegistrationList registered_; DISALLOW_COPY_AND_ASSIGN(FieldTrialList); diff --git a/base/metrics/stats_table.h b/base/metrics/stats_table.h index 32b22eb..aaf8062 100644 --- a/base/metrics/stats_table.h +++ b/base/metrics/stats_table.h @@ -25,7 +25,7 @@ #include "base/basictypes.h" #include "base/hash_tables.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "base/threading/thread_local_storage.h" namespace base { @@ -175,7 +175,7 @@ class StatsTable { Private* impl_; // The counters_lock_ protects the counters_ hash table. - Lock counters_lock_; + base::Lock counters_lock_; // The counters_ hash map is an in-memory hash of the counters. // It is used for quick lookup of counters, but is cannot be used diff --git a/base/nss_util.cc b/base/nss_util.cc index 384cc0d..8e250c4 100644 --- a/base/nss_util.cc +++ b/base/nss_util.cc @@ -31,8 +31,8 @@ #if defined(USE_NSS) #include "base/crypto/crypto_module_blocking_password_delegate.h" #include "base/environment.h" -#include "base/lock.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #endif // defined(USE_NSS) namespace base { diff --git a/base/observer_list_threadsafe.h b/base/observer_list_threadsafe.h index ecdad90..47a662e 100644 --- a/base/observer_list_threadsafe.h +++ b/base/observer_list_threadsafe.h @@ -93,7 +93,7 @@ class ObserverListThreadSafe if (!loop) return; // Some unittests may access this without a message loop. { - AutoLock lock(list_lock_); + base::AutoLock lock(list_lock_); if (observer_lists_.find(loop) == observer_lists_.end()) observer_lists_[loop] = new ObserverList<ObserverType>(type_); list = observer_lists_[loop]; @@ -112,7 +112,7 @@ class ObserverListThreadSafe if (!loop) return; // On shutdown, it is possible that current() is already null. { - AutoLock lock(list_lock_); + base::AutoLock lock(list_lock_); list = observer_lists_[loop]; if (!list) { NOTREACHED() << "RemoveObserver called on for unknown thread"; @@ -165,7 +165,7 @@ class ObserverListThreadSafe template <class Method, class Params> void Notify(const UnboundMethod<ObserverType, Method, Params>& method) { - AutoLock lock(list_lock_); + base::AutoLock lock(list_lock_); typename ObserversListMap::iterator it; for (it = observer_lists_.begin(); it != observer_lists_.end(); ++it) { MessageLoop* loop = (*it).first; @@ -187,7 +187,7 @@ class ObserverListThreadSafe // Check that this list still needs notifications. { - AutoLock lock(list_lock_); + base::AutoLock lock(list_lock_); typename ObserversListMap::iterator it = observer_lists_.find(MessageLoop::current()); @@ -209,7 +209,7 @@ class ObserverListThreadSafe // If there are no more observers on the list, we can now delete it. if (list->size() == 0) { { - AutoLock lock(list_lock_); + base::AutoLock lock(list_lock_); // Remove |list| if it's not already removed. // This can happen if multiple observers got removed in a notification. // See http://crbug.com/55725. @@ -225,7 +225,7 @@ class ObserverListThreadSafe typedef std::map<MessageLoop*, ObserverList<ObserverType>*> ObserversListMap; // These are marked mutable to facilitate having NotifyAll be const. - Lock list_lock_; // Protects the observer_lists_. + base::Lock list_lock_; // Protects the observer_lists_. ObserversListMap observer_lists_; const NotificationType type_; diff --git a/base/openssl_util.cc b/base/openssl_util.cc index bc174fa..931485a 100644 --- a/base/openssl_util.cc +++ b/base/openssl_util.cc @@ -7,11 +7,11 @@ #include <openssl/err.h> #include <openssl/ssl.h> -#include "base/lock.h" #include "base/logging.h" #include "base/scoped_vector.h" #include "base/singleton.h" #include "base/string_piece.h" +#include "base/synchronization/lock.h" namespace base { @@ -46,7 +46,7 @@ class OpenSSLInitSingleton { int num_locks = CRYPTO_num_locks(); locks_.reserve(num_locks); for (int i = 0; i < num_locks; ++i) - locks_.push_back(new Lock()); + locks_.push_back(new base::Lock()); CRYPTO_set_locking_callback(LockingCallback); CRYPTO_set_id_callback(CurrentThreadId); } @@ -70,7 +70,7 @@ class OpenSSLInitSingleton { } // These locks are used and managed by OpenSSL via LockingCallback(). - ScopedVector<Lock> locks_; + ScopedVector<base::Lock> locks_; DISALLOW_COPY_AND_ASSIGN(OpenSSLInitSingleton); }; diff --git a/base/path_service.cc b/base/path_service.cc index 56ce5fa..117feb5 100644 --- a/base/path_service.cc +++ b/base/path_service.cc @@ -14,8 +14,8 @@ #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/synchronization/lock.h" namespace base { bool PathProvider(int key, FilePath* result); @@ -92,9 +92,9 @@ static Provider base_provider_posix = { struct PathData { - Lock lock; - PathMap cache; // Cache mappings from path key to path value. - PathMap overrides; // Track path overrides. + base::Lock lock; + PathMap cache; // Cache mappings from path key to path value. + PathMap overrides; // Track path overrides. Provider* providers; // Linked list of path service providers. PathData() { @@ -130,7 +130,7 @@ static PathData* GetPathData() { // static bool PathService::GetFromCache(int key, FilePath* result) { PathData* path_data = GetPathData(); - AutoLock scoped_lock(path_data->lock); + base::AutoLock scoped_lock(path_data->lock); // check for a cached version PathMap::const_iterator it = path_data->cache.find(key); @@ -144,7 +144,7 @@ bool PathService::GetFromCache(int key, FilePath* result) { // static bool PathService::GetFromOverrides(int key, FilePath* result) { PathData* path_data = GetPathData(); - AutoLock scoped_lock(path_data->lock); + base::AutoLock scoped_lock(path_data->lock); // check for an overriden version. PathMap::const_iterator it = path_data->overrides.find(key); @@ -158,7 +158,7 @@ bool PathService::GetFromOverrides(int key, FilePath* result) { // static void PathService::AddToCache(int key, const FilePath& path) { PathData* path_data = GetPathData(); - AutoLock scoped_lock(path_data->lock); + base::AutoLock scoped_lock(path_data->lock); // Save the computed path in our cache. path_data->cache[key] = path; } @@ -225,7 +225,7 @@ bool PathService::Override(int key, const FilePath& path) { if (!file_util::AbsolutePath(&file_path)) return false; - AutoLock scoped_lock(path_data->lock); + base::AutoLock scoped_lock(path_data->lock); // Clear the cache now. Some of its entries could have depended // on the value we are overriding, and are now out of sync with reality. @@ -243,7 +243,7 @@ void PathService::RegisterProvider(ProviderFunc func, int key_start, DCHECK(path_data); DCHECK(key_end > key_start); - AutoLock scoped_lock(path_data->lock); + base::AutoLock scoped_lock(path_data->lock); Provider* p; diff --git a/base/synchronization/condition_variable.h b/base/synchronization/condition_variable.h index 3acd0ac..db75a49 100644 --- a/base/synchronization/condition_variable.h +++ b/base/synchronization/condition_variable.h @@ -75,7 +75,7 @@ #endif #include "base/basictypes.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" namespace base { @@ -156,10 +156,10 @@ class ConditionVariable { RunState run_state_; // Private critical section for access to member data. - Lock internal_lock_; + base::Lock internal_lock_; // Lock that is acquired before calling Wait(). - Lock& user_lock_; + base::Lock& user_lock_; // Events that threads are blocked on. Event waiting_list_; @@ -176,7 +176,7 @@ class ConditionVariable { pthread_cond_t condition_; pthread_mutex_t* user_mutex_; #if !defined(NDEBUG) - Lock* user_lock_; // Needed to adjust shadow lock state on wait. + base::Lock* user_lock_; // Needed to adjust shadow lock state on wait. #endif #endif diff --git a/base/synchronization/condition_variable_unittest.cc b/base/synchronization/condition_variable_unittest.cc index 8cfe4fe..cf18320 100644 --- a/base/synchronization/condition_variable_unittest.cc +++ b/base/synchronization/condition_variable_unittest.cc @@ -8,11 +8,11 @@ #include <algorithm> #include <vector> -#include "base/synchronization/condition_variable.h" -#include "base/lock.h" #include "base/logging.h" #include "base/scoped_ptr.h" #include "base/spin_wait.h" +#include "base/synchronization/condition_variable.h" +#include "base/synchronization/lock.h" #include "base/threading/platform_thread.h" #include "base/threading/thread_collision_warner.h" #include "base/time.h" @@ -198,7 +198,7 @@ TEST_F(ConditionVariableTest, MultiThreadConsumerTest) { Time start_time; // Used to time task processing. { - AutoLock auto_lock(*queue.lock()); + base::AutoLock auto_lock(*queue.lock()); while (!queue.EveryIdWasAllocated()) queue.all_threads_have_ids()->Wait(); } @@ -209,7 +209,7 @@ TEST_F(ConditionVariableTest, MultiThreadConsumerTest) { { // Since we have no tasks yet, all threads should be waiting by now. - AutoLock auto_lock(*queue.lock()); + base::AutoLock auto_lock(*queue.lock()); EXPECT_EQ(0, queue.GetNumThreadsTakingAssignments()); EXPECT_EQ(0, queue.GetNumThreadsCompletingTasks()); EXPECT_EQ(0, queue.task_count()); @@ -232,7 +232,7 @@ TEST_F(ConditionVariableTest, MultiThreadConsumerTest) { { // Wait until all 10 work tasks have at least been assigned. - AutoLock auto_lock(*queue.lock()); + base::AutoLock auto_lock(*queue.lock()); while (queue.task_count()) queue.no_more_tasks()->Wait(); // The last of the tasks *might* still be running, but... all but one should @@ -252,7 +252,7 @@ TEST_F(ConditionVariableTest, MultiThreadConsumerTest) { { // Check that all work was done by one thread id. - AutoLock auto_lock(*queue.lock()); + base::AutoLock auto_lock(*queue.lock()); EXPECT_EQ(1, queue.GetNumThreadsTakingAssignments()); EXPECT_EQ(1, queue.GetNumThreadsCompletingTasks()); EXPECT_EQ(0, queue.task_count()); @@ -278,7 +278,7 @@ TEST_F(ConditionVariableTest, MultiThreadConsumerTest) { { // Wait until all work tasks have at least been assigned. - AutoLock auto_lock(*queue.lock()); + base::AutoLock auto_lock(*queue.lock()); while (queue.task_count()) queue.no_more_tasks()->Wait(); @@ -301,7 +301,7 @@ TEST_F(ConditionVariableTest, MultiThreadConsumerTest) { queue.SpinUntilAllThreadsAreWaiting(); { - AutoLock auto_lock(*queue.lock()); + base::AutoLock auto_lock(*queue.lock()); EXPECT_EQ(3, queue.GetNumThreadsTakingAssignments()); EXPECT_EQ(3, queue.GetNumThreadsCompletingTasks()); EXPECT_EQ(0, queue.task_count()); @@ -322,7 +322,7 @@ TEST_F(ConditionVariableTest, MultiThreadConsumerTest) { queue.SpinUntilAllThreadsAreWaiting(); { - AutoLock auto_lock(*queue.lock()); + base::AutoLock auto_lock(*queue.lock()); EXPECT_EQ(3, queue.GetNumThreadsTakingAssignments()); EXPECT_EQ(3, queue.GetNumThreadsCompletingTasks()); EXPECT_EQ(0, queue.task_count()); @@ -343,7 +343,7 @@ TEST_F(ConditionVariableTest, MultiThreadConsumerTest) { queue.SpinUntilAllThreadsAreWaiting(); // Should take about 60 ms. { - AutoLock auto_lock(*queue.lock()); + base::AutoLock auto_lock(*queue.lock()); EXPECT_EQ(10, queue.GetNumThreadsTakingAssignments()); EXPECT_EQ(10, queue.GetNumThreadsCompletingTasks()); EXPECT_EQ(0, queue.task_count()); @@ -362,7 +362,7 @@ TEST_F(ConditionVariableTest, MultiThreadConsumerTest) { queue.SpinUntilAllThreadsAreWaiting(); // Should take about 60 ms. { - AutoLock auto_lock(*queue.lock()); + base::AutoLock auto_lock(*queue.lock()); EXPECT_EQ(10, queue.GetNumThreadsTakingAssignments()); EXPECT_EQ(10, queue.GetNumThreadsCompletingTasks()); EXPECT_EQ(0, queue.task_count()); @@ -381,11 +381,11 @@ TEST_F(ConditionVariableTest, LargeFastTaskTest) { WorkQueue queue(kThreadCount); // Start the threads. Lock private_lock; // Used locally for master to wait. - AutoLock private_held_lock(private_lock); + base::AutoLock private_held_lock(private_lock); ConditionVariable private_cv(&private_lock); { - AutoLock auto_lock(*queue.lock()); + base::AutoLock auto_lock(*queue.lock()); while (!queue.EveryIdWasAllocated()) queue.all_threads_have_ids()->Wait(); } @@ -395,7 +395,7 @@ TEST_F(ConditionVariableTest, LargeFastTaskTest) { { // Since we have no tasks, all threads should be waiting by now. - AutoLock auto_lock(*queue.lock()); + base::AutoLock auto_lock(*queue.lock()); EXPECT_EQ(0, queue.GetNumThreadsTakingAssignments()); EXPECT_EQ(0, queue.GetNumThreadsCompletingTasks()); EXPECT_EQ(0, queue.task_count()); @@ -412,7 +412,7 @@ TEST_F(ConditionVariableTest, LargeFastTaskTest) { queue.work_is_available()->Broadcast(); // Start up all threads. // Wait until we've handed out all tasks. { - AutoLock auto_lock(*queue.lock()); + base::AutoLock auto_lock(*queue.lock()); while (queue.task_count() != 0) queue.no_more_tasks()->Wait(); } @@ -423,7 +423,7 @@ TEST_F(ConditionVariableTest, LargeFastTaskTest) { { // With Broadcast(), every thread should have participated. // but with racing.. they may not all have done equal numbers of tasks. - AutoLock auto_lock(*queue.lock()); + base::AutoLock auto_lock(*queue.lock()); EXPECT_EQ(kThreadCount, queue.GetNumThreadsTakingAssignments()); EXPECT_EQ(kThreadCount, queue.GetNumThreadsCompletingTasks()); EXPECT_EQ(0, queue.task_count()); @@ -440,7 +440,7 @@ TEST_F(ConditionVariableTest, LargeFastTaskTest) { // Wait until we've handed out all tasks { - AutoLock auto_lock(*queue.lock()); + base::AutoLock auto_lock(*queue.lock()); while (queue.task_count() != 0) queue.no_more_tasks()->Wait(); } @@ -451,7 +451,7 @@ TEST_F(ConditionVariableTest, LargeFastTaskTest) { { // With Signal(), every thread should have participated. // but with racing.. they may not all have done four tasks. - AutoLock auto_lock(*queue.lock()); + base::AutoLock auto_lock(*queue.lock()); EXPECT_EQ(kThreadCount, queue.GetNumThreadsTakingAssignments()); EXPECT_EQ(kThreadCount, queue.GetNumThreadsCompletingTasks()); EXPECT_EQ(0, queue.task_count()); @@ -500,7 +500,7 @@ WorkQueue::WorkQueue(int thread_count) WorkQueue::~WorkQueue() { { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); SetShutdown(); } work_is_available_.Broadcast(); // Tell them all to terminate. @@ -558,7 +558,7 @@ bool WorkQueue::shutdown() const { // lock already acquired. bool WorkQueue::ThreadSafeCheckShutdown(int thread_count) { bool all_shutdown; - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); { // Declare in scope so DFAKE is guranteed to be destroyed before AutoLock. DFAKE_SCOPED_RECURSIVE_LOCK(locked_methods_); @@ -657,7 +657,7 @@ void WorkQueue::SetShutdown() { void WorkQueue::SpinUntilAllThreadsAreWaiting() { while (true) { { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (waiting_thread_count_ == thread_count_) break; } @@ -668,7 +668,7 @@ void WorkQueue::SpinUntilAllThreadsAreWaiting() { void WorkQueue::SpinUntilTaskCountLessThan(int task_count) { while (true) { { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (task_count_ < task_count) break; } @@ -698,7 +698,7 @@ void WorkQueue::SpinUntilTaskCountLessThan(int task_count) { void WorkQueue::ThreadMain() { int thread_id; { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); thread_id = GetThreadId(); if (EveryIdWasAllocated()) all_threads_have_ids()->Signal(); // Tell creator we're ready. @@ -709,7 +709,7 @@ void WorkQueue::ThreadMain() { TimeDelta work_time; bool could_use_help; { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); while (0 == task_count() && !shutdown()) { ++waiting_thread_count_; work_is_available()->Wait(); @@ -732,13 +732,13 @@ void WorkQueue::ThreadMain() { if (work_time > TimeDelta::FromMilliseconds(0)) { // We could just sleep(), but we'll instead further exercise the // condition variable class, and do a timed wait. - AutoLock auto_lock(private_lock); + base::AutoLock auto_lock(private_lock); ConditionVariable private_cv(&private_lock); private_cv.TimedWait(work_time); // Unsynchronized waiting. } { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // Send notification that we completed our "work." WorkIsCompleted(thread_id); } diff --git a/base/synchronization/waitable_event.h b/base/synchronization/waitable_event.h index 01b5987..9f357d1 100644 --- a/base/synchronization/waitable_event.h +++ b/base/synchronization/waitable_event.h @@ -15,8 +15,8 @@ #if defined(OS_POSIX) #include <list> #include <utility> -#include "base/lock.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #endif namespace base { @@ -149,7 +149,7 @@ class WaitableEvent { bool Dequeue(Waiter* waiter, void* tag); - Lock lock_; + base::Lock lock_; const bool manual_reset_; bool signaled_; std::list<Waiter*> waiters_; diff --git a/base/third_party/dmg_fp/dtoa_wrapper.cc b/base/third_party/dmg_fp/dtoa_wrapper.cc index fbbaf80..e34b8a6 100644 --- a/base/third_party/dmg_fp/dtoa_wrapper.cc +++ b/base/third_party/dmg_fp/dtoa_wrapper.cc @@ -4,12 +4,12 @@ // // The purpose of this file is to supply the macro definintions necessary // to make third_party/dmg_fp/dtoa.cc threadsafe. -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "base/logging.h" // We need two locks because they're sometimes grabbed at the same time. // A single lock would lead to an attempted recursive grab. -static Lock dtoa_locks[2]; +static base::Lock dtoa_locks[2]; /* * This define and the code below is to trigger thread-safe behavior diff --git a/base/threading/simple_thread.h b/base/threading/simple_thread.h index f55bd62..1631336 100644 --- a/base/threading/simple_thread.h +++ b/base/threading/simple_thread.h @@ -46,8 +46,8 @@ #include <vector> #include "base/basictypes.h" -#include "base/lock.h" #include "base/threading/platform_thread.h" +#include "base/synchronization/lock.h" #include "base/synchronization/waitable_event.h" namespace base { @@ -173,7 +173,7 @@ class DelegateSimpleThreadPool : public DelegateSimpleThread::Delegate { int num_threads_; std::vector<DelegateSimpleThread*> threads_; std::queue<Delegate*> delegates_; - Lock lock_; // Locks delegates_ + base::Lock lock_; // Locks delegates_ WaitableEvent dry_; // Not signaled when there is no work to do. }; diff --git a/base/threading/thread_checker.h b/base/threading/thread_checker.h index c0010fb..712b5b5 100644 --- a/base/threading/thread_checker.h +++ b/base/threading/thread_checker.h @@ -7,7 +7,7 @@ #pragma once #ifndef NDEBUG -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "base/threading/platform_thread.h" #endif // NDEBUG @@ -51,7 +51,7 @@ class ThreadChecker { private: void EnsureThreadIdAssigned() const; - mutable Lock lock_; + mutable base::Lock lock_; // This is mutable so that CalledOnValidThread can set it. // It's guarded by |lock_|. mutable PlatformThreadId valid_thread_id_; diff --git a/base/threading/thread_collision_warner_unittest.cc b/base/threading/thread_collision_warner_unittest.cc index 68987c3..a3d3b66 100644 --- a/base/threading/thread_collision_warner_unittest.cc +++ b/base/threading/thread_collision_warner_unittest.cc @@ -3,8 +3,8 @@ // found in the LICENSE file. #include "base/compiler_specific.h" -#include "base/lock.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "base/threading/platform_thread.h" #include "base/threading/simple_thread.h" #include "base/threading/thread_collision_warner.h" @@ -266,30 +266,30 @@ TEST(ThreadCollisionTest, MTSynchedScopedBookCriticalSectionTest) { // a lock. class QueueUser : public base::DelegateSimpleThread::Delegate { public: - QueueUser(NonThreadSafeQueue& queue, Lock& lock) + QueueUser(NonThreadSafeQueue& queue, base::Lock& lock) : queue_(queue), lock_(lock) {} virtual void Run() { { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); queue_.push(0); } { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); queue_.pop(); } } private: NonThreadSafeQueue& queue_; - Lock& lock_; + base::Lock& lock_; }; AssertReporter* local_reporter = new AssertReporter(); NonThreadSafeQueue queue(local_reporter); - Lock lock; + base::Lock lock; QueueUser queue_user_a(queue, lock); QueueUser queue_user_b(queue, lock); @@ -340,34 +340,34 @@ TEST(ThreadCollisionTest, MTSynchedScopedRecursiveBookCriticalSectionTest) { // a lock. class QueueUser : public base::DelegateSimpleThread::Delegate { public: - QueueUser(NonThreadSafeQueue& queue, Lock& lock) + QueueUser(NonThreadSafeQueue& queue, base::Lock& lock) : queue_(queue), lock_(lock) {} virtual void Run() { { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); queue_.push(0); } { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); queue_.bar(); } { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); queue_.pop(); } } private: NonThreadSafeQueue& queue_; - Lock& lock_; + base::Lock& lock_; }; AssertReporter* local_reporter = new AssertReporter(); NonThreadSafeQueue queue(local_reporter); - Lock lock; + base::Lock lock; QueueUser queue_user_a(queue, lock); QueueUser queue_user_b(queue, lock); diff --git a/base/threading/worker_pool_posix_unittest.cc b/base/threading/worker_pool_posix_unittest.cc index 332c55e..c984ee3 100644 --- a/base/threading/worker_pool_posix_unittest.cc +++ b/base/threading/worker_pool_posix_unittest.cc @@ -6,8 +6,8 @@ #include <set> -#include "base/lock.h" #include "base/synchronization/condition_variable.h" +#include "base/synchronization/lock.h" #include "base/task.h" #include "base/threading/platform_thread.h" #include "base/synchronization/waitable_event.h" @@ -61,12 +61,12 @@ class IncrementingTask : public Task { virtual void Run() { AddSelfToUniqueThreadSet(); - AutoLock locked(*counter_lock_); + base::AutoLock locked(*counter_lock_); (*counter_)++; } void AddSelfToUniqueThreadSet() { - AutoLock locked(*unique_threads_lock_); + base::AutoLock locked(*unique_threads_lock_); unique_threads_->insert(PlatformThread::CurrentId()); } @@ -100,7 +100,7 @@ class BlockingIncrementingTask : public Task { virtual void Run() { { - AutoLock num_waiting_to_start_locked(*num_waiting_to_start_lock_); + base::AutoLock num_waiting_to_start_locked(*num_waiting_to_start_lock_); (*num_waiting_to_start_)++; } num_waiting_to_start_cv_->Signal(); @@ -138,14 +138,14 @@ class PosixDynamicThreadPoolTest : public testing::Test { } void WaitForTasksToStart(int num_tasks) { - AutoLock num_waiting_to_start_locked(num_waiting_to_start_lock_); + base::AutoLock num_waiting_to_start_locked(num_waiting_to_start_lock_); while (num_waiting_to_start_ < num_tasks) { num_waiting_to_start_cv_.Wait(); } } void WaitForIdleThreads(int num_idle_threads) { - AutoLock pool_locked(*peer_.lock()); + base::AutoLock pool_locked(*peer_.lock()); while (peer_.num_idle_threads() < num_idle_threads) { peer_.num_idle_threads_cv()->Wait(); } @@ -249,7 +249,7 @@ TEST_F(PosixDynamicThreadPoolTest, Complex) { // Wake up all idle threads so they can exit. { - AutoLock locked(*peer_.lock()); + base::AutoLock locked(*peer_.lock()); while (peer_.num_idle_threads() > 0) { peer_.tasks_available_cv()->Signal(); peer_.num_idle_threads_cv()->Wait(); diff --git a/base/time_win.cc b/base/time_win.cc index ca3aef1..601211c 100644 --- a/base/time_win.cc +++ b/base/time_win.cc @@ -41,10 +41,10 @@ #include <mmsystem.h> #include "base/basictypes.h" -#include "base/lock.h" #include "base/logging.h" #include "base/cpu.h" #include "base/singleton.h" +#include "base/synchronization/lock.h" using base::Time; using base::TimeDelta; @@ -262,7 +262,7 @@ DWORD last_seen_now = 0; // easy to use a Singleton without even knowing it, and that may lead to many // gotchas). Its impact on startup time should be negligible due to low-level // nature of time code. -Lock rollover_lock; +base::Lock rollover_lock; // We use timeGetTime() to implement TimeTicks::Now(). This can be problematic // because it returns the number of milliseconds since Windows has started, @@ -270,7 +270,7 @@ Lock rollover_lock; // rollover ourselves, which works if TimeTicks::Now() is called at least every // 49 days. TimeDelta RolloverProtectedNow() { - AutoLock locked(rollover_lock); + base::AutoLock locked(rollover_lock); // We should hold the lock while calling tick_function to make sure that // we keep last_seen_now stay correctly in sync. DWORD now = tick_function(); @@ -409,4 +409,4 @@ int64 TimeTicks::GetQPCDriftMicroseconds() { // static bool TimeTicks::IsHighResClockWorking() { return HighResNowSingleton::GetInstance()->IsUsingHighResClock(); -}
\ No newline at end of file +} diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc index d62aa59..a9f81b1 100644 --- a/base/tracked_objects.cc +++ b/base/tracked_objects.cc @@ -85,7 +85,7 @@ Births::Births(const Location& location) // static ThreadData* ThreadData::first_ = NULL; // static -Lock ThreadData::list_lock_; +base::Lock ThreadData::list_lock_; // static ThreadData::Status ThreadData::status_ = ThreadData::UNINITIALIZED; @@ -111,7 +111,7 @@ ThreadData* ThreadData::current() { bool too_late_to_create = false; { registry = new ThreadData; - AutoLock lock(list_lock_); + base::AutoLock lock(list_lock_); // Use lock to insure we have most recent status. if (!IsActive()) { too_late_to_create = true; @@ -285,7 +285,7 @@ Births* ThreadData::TallyABirth(const Location& location) { Births* tracker = new Births(location); // Lock since the map may get relocated now, and other threads sometimes // snapshot it (but they lock before copying it). - AutoLock lock(lock_); + base::AutoLock lock(lock_); birth_map_[location] = tracker; return tracker; } @@ -305,13 +305,13 @@ void ThreadData::TallyADeath(const Births& lifetimes, return; } - AutoLock lock(lock_); // Lock since the map may get relocated now. + base::AutoLock lock(lock_); // Lock since the map may get relocated now. death_map_[&lifetimes].RecordDeath(duration); } // static ThreadData* ThreadData::first() { - AutoLock lock(list_lock_); + base::AutoLock lock(list_lock_); return first_; } @@ -323,7 +323,7 @@ const std::string ThreadData::ThreadName() const { // This may be called from another thread. void ThreadData::SnapshotBirthMap(BirthMap *output) const { - AutoLock lock(lock_); + base::AutoLock lock(lock_); for (BirthMap::const_iterator it = birth_map_.begin(); it != birth_map_.end(); ++it) (*output)[it->first] = it->second; @@ -331,7 +331,7 @@ void ThreadData::SnapshotBirthMap(BirthMap *output) const { // This may be called from another thread. void ThreadData::SnapshotDeathMap(DeathMap *output) const { - AutoLock lock(lock_); + base::AutoLock lock(lock_); for (DeathMap::const_iterator it = death_map_.begin(); it != death_map_.end(); ++it) (*output)[it->first] = it->second; @@ -348,7 +348,7 @@ void ThreadData::ResetAllThreadData() { } void ThreadData::Reset() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); for (DeathMap::iterator it = death_map_.begin(); it != death_map_.end(); ++it) it->second.Clear(); @@ -372,7 +372,7 @@ class ThreadData::ThreadSafeDownCounter { private: size_t remaining_count_; - Lock lock_; // protect access to remaining_count_. + base::Lock lock_; // protect access to remaining_count_. }; ThreadData::ThreadSafeDownCounter::ThreadSafeDownCounter(size_t count) @@ -382,7 +382,7 @@ ThreadData::ThreadSafeDownCounter::ThreadSafeDownCounter(size_t count) bool ThreadData::ThreadSafeDownCounter::LastCaller() { { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (--remaining_count_) return false; } // Release lock, so we can delete everything in this instance. @@ -461,12 +461,12 @@ bool ThreadData::StartTracking(bool status) { #endif if (!status) { - AutoLock lock(list_lock_); + base::AutoLock lock(list_lock_); DCHECK(status_ == ACTIVE || status_ == SHUTDOWN); status_ = SHUTDOWN; return true; } - AutoLock lock(list_lock_); + base::AutoLock lock(list_lock_); DCHECK(status_ == UNINITIALIZED); CHECK(tls_index_.Initialize(NULL)); status_ = ACTIVE; @@ -504,7 +504,7 @@ void ThreadData::ShutdownSingleThreadedCleanup() { return; ThreadData* thread_data_list; { - AutoLock lock(list_lock_); + base::AutoLock lock(list_lock_); thread_data_list = first_; first_ = NULL; } @@ -614,7 +614,7 @@ void DataCollector::Append(const ThreadData& thread_data) { thread_data.SnapshotDeathMap(&death_map); // Use our lock to protect our accumulation activity. - AutoLock lock(accumulation_lock_); + base::AutoLock lock(accumulation_lock_); DCHECK(count_of_contributing_threads_); diff --git a/base/tracked_objects.h b/base/tracked_objects.h index 07731ff..ed629c3 100644 --- a/base/tracked_objects.h +++ b/base/tracked_objects.h @@ -10,7 +10,7 @@ #include <string> #include <vector> -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "base/tracked.h" #include "base/threading/thread_local_storage.h" @@ -322,7 +322,7 @@ class DataCollector { // seen a death count. BirthCount global_birth_count_; - Lock accumulation_lock_; // Protects access during accumulation phase. + base::Lock accumulation_lock_; // Protects access during accumulation phase. DISALLOW_COPY_AND_ASSIGN(DataCollector); }; @@ -577,7 +577,7 @@ class ThreadData { // Link to the most recently created instance (starts a null terminated list). static ThreadData* first_; // Protection for access to first_. - static Lock list_lock_; + static base::Lock list_lock_; // We set status_ to SHUTDOWN when we shut down the tracking service. This // setting is redundantly established by all participating threads so that we @@ -613,7 +613,7 @@ class ThreadData { // thread, or reading from another thread. For reading from this thread we // don't need a lock, as there is no potential for a conflict since the // writing is only done from this thread. - mutable Lock lock_; + mutable base::Lock lock_; DISALLOW_COPY_AND_ASSIGN(ThreadData); }; diff --git a/ceee/ie/broker/broker_rpc_client.cc b/ceee/ie/broker/broker_rpc_client.cc index f86bae52..8800ac7 100644 --- a/ceee/ie/broker/broker_rpc_client.cc +++ b/ceee/ie/broker/broker_rpc_client.cc @@ -8,8 +8,8 @@ #include <atlbase.h> -#include "base/lock.h" #include "base/logging.h" +#include "base/synchronization/lock.h" #include "base/tuple.h" #include "base/win/scoped_comptr.h" #include "ceee/common/com_utils.h" diff --git a/ceee/ie/broker/broker_rpc_server.cc b/ceee/ie/broker/broker_rpc_server.cc index 55f9b2d..eb16d6a 100644 --- a/ceee/ie/broker/broker_rpc_server.cc +++ b/ceee/ie/broker/broker_rpc_server.cc @@ -157,7 +157,7 @@ void BrokerRpcServer_SendUmaHistogramTimes(handle_t binding_handle, int sample) { // We can't unfortunately use the HISTOGRAM_*_TIMES here because they use // static variables to save time. - AutoLock lock(g_metrics_lock); + base::AutoLock lock(g_metrics_lock); scoped_refptr<base::Histogram> counter = base::Histogram::FactoryTimeGet(name, base::TimeDelta::FromMilliseconds(1), @@ -175,7 +175,7 @@ void BrokerRpcServer_SendUmaHistogramData(handle_t binding_handle, int bucket_count) { // We can't unfortunately use the HISTOGRAM_*_COUNT here because they use // static variables to save time. - AutoLock lock(g_metrics_lock); + base::AutoLock lock(g_metrics_lock); scoped_refptr<base::Histogram> counter = base::Histogram::FactoryGet(name, min, max, bucket_count, base::Histogram::kUmaTargetedHistogramFlag); diff --git a/ceee/ie/broker/executors_manager.cc b/ceee/ie/broker/executors_manager.cc index 2256dbc..255cef2 100644 --- a/ceee/ie/broker/executors_manager.cc +++ b/ceee/ie/broker/executors_manager.cc @@ -79,7 +79,7 @@ bool ExecutorsManager::IsKnownWindow(HWND window) { } bool ExecutorsManager::IsKnownWindowImpl(HWND window) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); return handle_map_.find(window) != handle_map_.end() || frame_window_families_.find(window) != frame_window_families_.end(); } @@ -92,7 +92,7 @@ HWND ExecutorsManager::FindTabChildImpl(HWND window) { if (!common_api::CommonApiResult::IsIeFrameClass(window)) return NULL; - AutoLock lock(lock_); + base::AutoLock lock(lock_); FrameTabsMap::iterator it = frame_window_families_.find(window); if (it == frame_window_families_.end()) return NULL; @@ -107,7 +107,7 @@ HRESULT ExecutorsManager::RegisterTabExecutor(ThreadId thread_id, // This way we can add a ref to the module for the existence of the map. bool map_was_empty = false; { - AutoLock lock(lock_); + base::AutoLock lock(lock_); map_was_empty = executors_.empty(); if (!map_was_empty && executors_.find(thread_id) != executors_.end()) { return S_OK; @@ -136,7 +136,7 @@ HRESULT ExecutorsManager::RegisterWindowExecutor(ThreadId thread_id, // our map in a thread safe way... CHandle executor_registration_gate; { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (executors_.find(thread_id) != executors_.end()) { DCHECK(false) << "Unexpected registered thread_id: " << thread_id; return E_UNEXPECTED; @@ -173,7 +173,7 @@ HRESULT ExecutorsManager::RegisterWindowExecutor(ThreadId thread_id, // This way we can add a ref to the module for the existence of the map. bool map_was_empty = false; { - AutoLock lock(lock_); + base::AutoLock lock(lock_); map_was_empty = executors_.empty(); // We should not get here if we already have an executor for that thread. DCHECK(executors_.find(thread_id) == executors_.end()); @@ -206,7 +206,7 @@ HRESULT ExecutorsManager::GetExecutor(ThreadId thread_id, HWND window, // But we must create the executor creator outside of the lock. bool create_executor = false; { - AutoLock lock(lock_); + base::AutoLock lock(lock_); ExecutorsMap::iterator exec_iter = executors_.find(thread_id); if (exec_iter != executors_.end()) { // Found it... We're done... That was quick!!! :-) @@ -266,7 +266,7 @@ HRESULT ExecutorsManager::GetExecutor(ThreadId thread_id, HWND window, reinterpret_cast<CeeeWindowHandle>(window)); if (FAILED(hr)) { // This could happen if the thread we want to hook to died prematurely. - AutoLock lock(lock_); + base::AutoLock lock(lock_); pending_registrations_.erase(thread_id); return hr; } @@ -285,7 +285,7 @@ HRESULT ExecutorsManager::GetExecutor(ThreadId thread_id, HWND window, } // Do our own cleanup and return a reference thread safely... - AutoLock lock(lock_); + base::AutoLock lock(lock_); pending_registrations_.erase(thread_id); ExecutorsMap::iterator iter = executors_.find(thread_id); if (iter == executors_.end()) { @@ -302,7 +302,7 @@ HRESULT ExecutorsManager::RemoveExecutor(ThreadId thread_id) { CComPtr<IUnknown> dead_executor; bool map_is_empty = false; { - AutoLock lock(lock_); + base::AutoLock lock(lock_); ExecutorsMap::iterator iter = executors_.find(thread_id); if (iter == executors_.end()) { return S_FALSE; @@ -348,7 +348,7 @@ void ExecutorsManager::SetTabIdForHandle(int tab_id, HWND handle) { DCHECK(common_api::CommonApiResult::IsIeFrameClass(frame_window)); bool send_on_create = false; { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (tab_id_map_.end() != tab_id_map_.find(tab_id) || handle_map_.end() != handle_map_.find(handle)) { // Avoid double-setting of tab id -> handle mappings, which could @@ -382,7 +382,7 @@ void ExecutorsManager::SetTabIdForHandle(int tab_id, HWND handle) { void ExecutorsManager::SetTabToolBandIdForHandle(int tool_band_id, HWND handle) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (tool_band_id_map_.end() != tool_band_id_map_.find(tool_band_id) || tool_band_handle_map_.end() != tool_band_handle_map_.find(handle)) { // Avoid double-setting of tool band id -> handle mappings, which could @@ -412,7 +412,7 @@ void ExecutorsManager::DeleteTabHandle(HWND handle) { frame_window = NULL; bool send_on_removed = false; - AutoLock lock(lock_); + base::AutoLock lock(lock_); { HandleMap::iterator handle_it = handle_map_.find(handle); // Don't DCHECK, we may be called more than once, but it's fine, @@ -492,7 +492,7 @@ void ExecutorsManager::CleanupMapsForThread(DWORD thread_id) { // of that for us, and 2) we can't call DeleteHandle from within a lock. std::vector<HWND> tab_handles_to_remove; { - AutoLock lock(lock_); + base::AutoLock lock(lock_); HandleMap::iterator handle_it = handle_map_.begin(); for (; handle_it != handle_map_.end(); ++ handle_it) { if (::GetWindowThreadProcessId(handle_it->first, NULL) == thread_id) @@ -507,7 +507,7 @@ void ExecutorsManager::CleanupMapsForThread(DWORD thread_id) { } bool ExecutorsManager::IsTabIdValid(int tab_id) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); TabIdMap::const_iterator it = tab_id_map_.find(tab_id); #ifdef DEBUG return it != tab_id_map_.end() && it->second != INVALID_HANDLE_VALUE; @@ -517,7 +517,7 @@ bool ExecutorsManager::IsTabIdValid(int tab_id) { } HWND ExecutorsManager::GetTabHandleFromId(int tab_id) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); TabIdMap::const_iterator it = tab_id_map_.find(tab_id); DCHECK(it != tab_id_map_.end()); @@ -530,7 +530,7 @@ HWND ExecutorsManager::GetTabHandleFromId(int tab_id) { } bool ExecutorsManager::IsTabHandleValid(HWND tab_handle) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); HandleMap::const_iterator it = handle_map_.find(tab_handle); #ifdef DEBUG return it != handle_map_.end() && it->second != kInvalidChromeSessionId; @@ -540,7 +540,7 @@ bool ExecutorsManager::IsTabHandleValid(HWND tab_handle) { } int ExecutorsManager::GetTabIdFromHandle(HWND tab_handle) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); HandleMap::const_iterator it = handle_map_.find(tab_handle); if (it == handle_map_.end()) return kInvalidChromeSessionId; @@ -549,7 +549,7 @@ int ExecutorsManager::GetTabIdFromHandle(HWND tab_handle) { } HWND ExecutorsManager::GetTabHandleFromToolBandId(int tool_band_id) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); TabIdMap::const_iterator it = tool_band_id_map_.find(tool_band_id); if (it == tool_band_id_map_.end()) @@ -567,7 +567,7 @@ HRESULT ExecutorsManager::GetExecutorCreator( size_t ExecutorsManager::GetThreadHandles( CHandle thread_handles[], ThreadId thread_ids[], size_t num_threads) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); ExecutorsMap::iterator iter = executors_.begin(); size_t index = 0; for (; index < num_threads && iter != executors_.end(); ++index, ++iter) { diff --git a/ceee/ie/broker/executors_manager.h b/ceee/ie/broker/executors_manager.h index 48925d5..a681751 100644 --- a/ceee/ie/broker/executors_manager.h +++ b/ceee/ie/broker/executors_manager.h @@ -14,8 +14,8 @@ #include <map> #include <list> -#include "base/lock.h" #include "base/singleton.h" +#include "base/synchronization/lock.h" #include "base/task.h" #include "ceee/common/window_utils.h" #include "ceee/ie/broker/window_events_funnel.h" @@ -252,7 +252,7 @@ class ExecutorsManager { // To protect the access to the maps (ExecutorsManager::executors_ & // ExecutorsManager::pending_registrations_ & tab_id_map_/handle_map_). - Lock lock_; + base::Lock lock_; // Test seam. WindowEventsFunnel windows_events_funnel_; diff --git a/ceee/ie/plugin/bho/cookie_accountant.cc b/ceee/ie/plugin/bho/cookie_accountant.cc index 1445b97..ad326c9 100644 --- a/ceee/ie/plugin/bho/cookie_accountant.cc +++ b/ceee/ie/plugin/bho/cookie_accountant.cc @@ -235,7 +235,7 @@ void CookieAccountant::ConnectBroker() { void CookieAccountant::Initialize() { { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (initializing_) return; initializing_ = true; @@ -257,7 +257,7 @@ void CookieAccountant::Initialize() { DCHECK(internet_set_cookie_ex_a_patch_.is_patched() || internet_set_cookie_ex_w_patch_.is_patched()); { - AutoLock lock(lock_); + base::AutoLock lock(lock_); initializing_ = false; } } diff --git a/ceee/ie/plugin/bho/cookie_accountant.h b/ceee/ie/plugin/bho/cookie_accountant.h index 23111de..05bef8b 100644 --- a/ceee/ie/plugin/bho/cookie_accountant.h +++ b/ceee/ie/plugin/bho/cookie_accountant.h @@ -13,8 +13,8 @@ #include <string> #include "app/win/iat_patch_function.h" -#include "base/lock.h" #include "base/singleton.h" +#include "base/synchronization/lock.h" #include "base/time.h" #include "ceee/ie/plugin/bho/cookie_events_funnel.h" #include "net/base/cookie_monster.h" @@ -86,7 +86,7 @@ class CookieAccountant { bool initializing_; // A lock that protects access to the function patches. - Lock lock_; + base::Lock lock_; // Cached singleton instance. Useful for unit testing. static CookieAccountant* singleton_instance_; diff --git a/ceee/ie/plugin/bho/window_message_source.cc b/ceee/ie/plugin/bho/window_message_source.cc index cd462d8..c48ab2f 100644 --- a/ceee/ie/plugin/bho/window_message_source.cc +++ b/ceee/ie/plugin/bho/window_message_source.cc @@ -196,7 +196,7 @@ bool WindowMessageSource::AddEntryToMap(DWORD thread_id, WindowMessageSource* source) { DCHECK(source != NULL); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); MessageSourceMap::const_iterator iter = message_source_map_.find(thread_id); if (iter != message_source_map_.end()) return false; @@ -208,13 +208,13 @@ bool WindowMessageSource::AddEntryToMap(DWORD thread_id, // static WindowMessageSource* WindowMessageSource::GetEntryFromMap(DWORD thread_id) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); MessageSourceMap::const_iterator iter = message_source_map_.find(thread_id); return iter == message_source_map_.end() ? NULL : iter->second; } // static void WindowMessageSource::RemoveEntryFromMap(DWORD thread_id) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); message_source_map_.erase(thread_id); } diff --git a/ceee/ie/plugin/bho/window_message_source.h b/ceee/ie/plugin/bho/window_message_source.h index baceafa..bec48089 100644 --- a/ceee/ie/plugin/bho/window_message_source.h +++ b/ceee/ie/plugin/bho/window_message_source.h @@ -10,7 +10,7 @@ #include <vector> #include "base/basictypes.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" // A WindowMessageSource instance monitors keyboard and mouse messages on the // same thread as the one that creates the instance, and fires events to those @@ -95,7 +95,7 @@ class WindowMessageSource { static MessageSourceMap message_source_map_; // Used to protect access to the message_source_map_. - static Lock lock_; + static base::Lock lock_; DISALLOW_COPY_AND_ASSIGN(WindowMessageSource); }; diff --git a/ceee/ie/plugin/scripting/script_host.cc b/ceee/ie/plugin/scripting/script_host.cc index 15a57eb..d1e74ef 100644 --- a/ceee/ie/plugin/scripting/script_host.cc +++ b/ceee/ie/plugin/scripting/script_host.cc @@ -705,7 +705,7 @@ void ScriptHost::DebugApplication::RegisterDebugApplication() { } void ScriptHost::DebugApplication::Initialize() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); ++initialization_count_; @@ -715,7 +715,7 @@ void ScriptHost::DebugApplication::Initialize() { void ScriptHost::DebugApplication::Initialize( IUnknown* debug_application_provider) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); ++initialization_count_; @@ -742,7 +742,7 @@ void ScriptHost::DebugApplication::Initialize( void ScriptHost::DebugApplication::Initialize( IProcessDebugManager* manager, IDebugApplication* app) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); // This function is exposed for testing only. DCHECK_EQ(0U, initialization_count_); @@ -758,7 +758,7 @@ void ScriptHost::DebugApplication::Initialize( void ScriptHost::DebugApplication::Terminate() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); DCHECK_GT(initialization_count_, (size_t)0); --initialization_count_; @@ -778,7 +778,7 @@ void ScriptHost::DebugApplication::Terminate() { HRESULT ScriptHost::DebugApplication::GetDebugApplication( IDebugApplication** app) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (debug_application_ == NULL) return E_NOTIMPL; @@ -788,7 +788,7 @@ HRESULT ScriptHost::DebugApplication::GetDebugApplication( HRESULT ScriptHost::DebugApplication::GetRootApplicationNode( IDebugApplicationNode** debug_app_node) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (debug_application_ == NULL) { *debug_app_node = NULL; @@ -801,7 +801,7 @@ HRESULT ScriptHost::DebugApplication::GetRootApplicationNode( HRESULT ScriptHost::DebugApplication::CreateDebugDocumentHelper( const wchar_t* long_name, const wchar_t* code, TEXT_DOC_ATTR attributes, IDebugDocumentHelper** helper) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (debug_application_ == NULL) return S_OK; diff --git a/ceee/ie/plugin/scripting/script_host.h b/ceee/ie/plugin/scripting/script_host.h index 553d142..5fe64e1 100644 --- a/ceee/ie/plugin/scripting/script_host.h +++ b/ceee/ie/plugin/scripting/script_host.h @@ -19,8 +19,8 @@ #include <map> #include <string> -#include "base/lock.h" #include "base/logging.h" +#include "base/synchronization/lock.h" #include "third_party/activscp/activdbg.h" #include "ceee/common/initializing_coclass.h" @@ -293,7 +293,7 @@ class ScriptHost::DebugApplication { void RegisterDebugApplication(); // Under lock_. // Protects all members below. - ::Lock lock_; // Our containing class has a Lock method. + base::Lock lock_; // Number of initialization calls. size_t initialization_count_; diff --git a/ceee/testing/utils/instance_count_mixin.cc b/ceee/testing/utils/instance_count_mixin.cc index c6d8bdc..14a0ebb 100644 --- a/ceee/testing/utils/instance_count_mixin.cc +++ b/ceee/testing/utils/instance_count_mixin.cc @@ -17,13 +17,13 @@ namespace testing { Lock InstanceCountMixinBase::lock_; InstanceCountMixinBase::InstanceCountMixinBase() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); instances.insert(this); } InstanceCountMixinBase::~InstanceCountMixinBase() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); EXPECT_EQ(1, instances.erase(this)); } @@ -34,7 +34,7 @@ void InstanceCountMixinBase::GetDescription(std::string* description) const { } void InstanceCountMixinBase::LogLeakedInstances() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); InstanceSet::const_iterator it(instances.begin()); InstanceSet::const_iterator end(instances.end()); @@ -49,7 +49,7 @@ void InstanceCountMixinBase::LogLeakedInstances() { typedef InstanceCountMixinBase::InstanceSet InstanceSet; size_t InstanceCountMixinBase::all_instance_count() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); return instances.size(); } diff --git a/ceee/testing/utils/instance_count_mixin.h b/ceee/testing/utils/instance_count_mixin.h index 11627da..5686885 100644 --- a/ceee/testing/utils/instance_count_mixin.h +++ b/ceee/testing/utils/instance_count_mixin.h @@ -10,7 +10,7 @@ #include <string> #include <set> -#include "base/lock.h" +#include "base/synchronization/lock.h" namespace testing { @@ -47,7 +47,7 @@ class InstanceCountMixinBase { static InstanceSet::const_iterator end(); protected: - static Lock lock_; + static base::Lock lock_; }; // Inherit test classes from this class to get a per-class instance count. @@ -60,11 +60,11 @@ template <class T> class InstanceCountMixin : public InstanceCountMixinBase { public: InstanceCountMixin() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); ++instance_count_; } ~InstanceCountMixin() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); --instance_count_; } 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); }; diff --git a/chrome_frame/cfproxy.h b/chrome_frame/cfproxy.h index af86341..6386738 100644 --- a/chrome_frame/cfproxy.h +++ b/chrome_frame/cfproxy.h @@ -10,7 +10,7 @@ #include <map> // for proxy factory #include <vector> #include <string> -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "base/time.h" // for base::TimeDelta #include "base/file_path.h" #include "chrome/common/automation_constants.h" @@ -192,7 +192,7 @@ class ChromeProxyFactory { virtual ChromeProxy* CreateProxy(); typedef std::map<std::string, ChromeProxy*> ProxyMap; ProxyMap proxies_; - Lock lock_; + base::Lock lock_; }; #endif // CHROME_FRAME_CFPROXY_H_ diff --git a/chrome_frame/cfproxy_factory.cc b/chrome_frame/cfproxy_factory.cc index 4c9c76d..df5f24c 100644 --- a/chrome_frame/cfproxy_factory.cc +++ b/chrome_frame/cfproxy_factory.cc @@ -30,7 +30,7 @@ ChromeProxyFactory::ChromeProxyFactory() { } ChromeProxyFactory::~ChromeProxyFactory() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); ProxyMap::iterator it = proxies_.begin(); for (; it != proxies_.end(); ++it) { ChromeProxy* proxy = it->second; @@ -41,7 +41,7 @@ ChromeProxyFactory::~ChromeProxyFactory() { void ChromeProxyFactory::GetProxy(ChromeProxyDelegate* delegate, const ProxyParams& params) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); ChromeProxy* proxy = NULL; // TODO(stoyan): consider extra_params/timeout ProxyMap::iterator it = proxies_.find(params.profile); @@ -59,7 +59,7 @@ void ChromeProxyFactory::GetProxy(ChromeProxyDelegate* delegate, bool ChromeProxyFactory::ReleaseProxy(ChromeProxyDelegate* delegate, const std::string& profile) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); ProxyMap::iterator it = proxies_.find(profile); if (it == proxies_.end()) return false; diff --git a/chrome_frame/cfproxy_private.h b/chrome_frame/cfproxy_private.h index 307dcae..3979e0eb 100644 --- a/chrome_frame/cfproxy_private.h +++ b/chrome_frame/cfproxy_private.h @@ -10,6 +10,7 @@ #include <set> #include <string> #include <vector> + #include "chrome_frame/cfproxy.h" #include "base/threading/thread.h" // Since we can't forward declare IPC::Message::Sender or IPC::Channel::Listener @@ -55,7 +56,7 @@ class SyncMsgSender { SingleSentMessage* RemoveMessage(int id); typedef std::map<int, SingleSentMessage*> SentMessages; SentMessages messages_; - Lock messages_lock_; + base::Lock messages_lock_; TabsMap* tab2delegate_; }; diff --git a/chrome_frame/cfproxy_support.cc b/chrome_frame/cfproxy_support.cc index fea331c..1451650 100644 --- a/chrome_frame/cfproxy_support.cc +++ b/chrome_frame/cfproxy_support.cc @@ -220,7 +220,7 @@ void SyncMsgSender::QueueSyncMessage(const IPC::SyncMessage* msg, SyncMessageContext* ctx) { if (delegate) { // We are interested of the result. - AutoLock lock(messages_lock_); + base::AutoLock lock(messages_lock_); int id = IPC::SyncMessage::GetMessageId(*msg); // A message can be sent only once. DCHECK(messages_.end() == messages_.find(id)); @@ -232,7 +232,7 @@ void SyncMsgSender::QueueSyncMessage(const IPC::SyncMessage* msg, void SyncMsgSender::Cancel(ChromeProxyDelegate* delegate) { std::vector<SingleSentMessage*> cancelled; { - AutoLock lock(messages_lock_); + base::AutoLock lock(messages_lock_); SentMessages::iterator it = messages_.begin(); for (; it != messages_.end(); ) { SingleSentMessage* origin = it->second; @@ -254,7 +254,7 @@ void SyncMsgSender::Cancel(ChromeProxyDelegate* delegate) { } SyncMsgSender::SingleSentMessage* SyncMsgSender::RemoveMessage(int id) { - AutoLock lock(messages_lock_); + base::AutoLock lock(messages_lock_); SentMessages::iterator it = messages_.find(id); if (it == messages_.end()) { // Delegate is not interested in this sync message response. @@ -287,7 +287,7 @@ void SyncMsgSender::OnChannelClosed() { SentMessages messages_sent; // Make a copy of the messages queue { - AutoLock lock(messages_lock_); + base::AutoLock lock(messages_lock_); messages_.swap(messages_sent); } diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc index 26b9436..f453c2e 100644 --- a/chrome_frame/chrome_frame_automation.cc +++ b/chrome_frame/chrome_frame_automation.cc @@ -12,11 +12,11 @@ #include "base/file_util.h" #include "base/file_version_info.h" #include "base/lazy_instance.h" -#include "base/lock.h" #include "base/logging.h" #include "base/path_service.h" #include "base/process_util.h" #include "base/string_util.h" +#include "base/synchronization/lock.h" #include "base/synchronization/waitable_event.h" #include "base/sys_info.h" #include "base/utf_string_conversions.h" @@ -45,7 +45,7 @@ static const wchar_t kUmaSendIntervalValue[] = L"UmaSendInterval"; // This lock ensures that histograms created by ChromeFrame are thread safe. // The histograms created in ChromeFrame can be initialized on multiple // threads. -Lock g_ChromeFrameHistogramLock; +base::Lock g_ChromeFrameHistogramLock; class ChromeFrameAutomationProxyImpl::TabProxyNotificationMessageFilter : public IPC::ChannelProxy::MessageFilter { @@ -55,12 +55,12 @@ class ChromeFrameAutomationProxyImpl::TabProxyNotificationMessageFilter } void AddTabProxy(AutomationHandle tab_proxy) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); tabs_list_.push_back(tab_proxy); } void RemoveTabProxy(AutomationHandle tab_proxy) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); tabs_list_.remove(tab_proxy); } @@ -101,7 +101,7 @@ class ChromeFrameAutomationProxyImpl::TabProxyNotificationMessageFilter private: AutomationHandleTracker* tracker_; std::list<AutomationHandle> tabs_list_; - Lock lock_; + base::Lock lock_; }; class ChromeFrameAutomationProxyImpl::CFMsgDispatcher @@ -486,7 +486,7 @@ void ProxyFactory::GetAutomationServer( scoped_refptr<AutomationProxyCacheEntry> entry; // Find already existing launcher thread for given profile - AutoLock lock(lock_); + base::AutoLock lock(lock_); for (size_t i = 0; i < proxies_.container().size(); ++i) { if (proxies_[i]->IsSameProfile(params->profile_name())) { entry = proxies_[i]; diff --git a/chrome_frame/chrome_frame_automation.h b/chrome_frame/chrome_frame_automation.h index f4314ab..81d0967 100644 --- a/chrome_frame/chrome_frame_automation.h +++ b/chrome_frame/chrome_frame_automation.h @@ -11,10 +11,10 @@ #include <map> #include <vector> -#include "base/lock.h" #include "base/ref_counted.h" #include "base/scoped_handle.h" #include "base/stack_container.h" +#include "base/synchronization/lock.h" #include "base/task.h" #include "base/threading/thread.h" #include "base/timer.h" @@ -303,7 +303,7 @@ class ProxyFactory { typedef StackVector<scoped_refptr<AutomationProxyCacheEntry>, 4> Vector; Vector proxies_; // Lock if we are going to call GetAutomationServer from more than one thread. - Lock lock_; + base::Lock lock_; // Gathers histograms to be sent to Chrome. ChromeFrameHistogramSnapshots chrome_frame_histograms_; diff --git a/chrome_frame/chrome_frame_delegate.h b/chrome_frame/chrome_frame_delegate.h index 1954747..f6c1f4c 100644 --- a/chrome_frame/chrome_frame_delegate.h +++ b/chrome_frame/chrome_frame_delegate.h @@ -13,7 +13,7 @@ #include <vector> #include "base/file_path.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "chrome/common/automation_messages.h" #include "ipc/ipc_message.h" @@ -153,7 +153,7 @@ template <class T> class TaskMarshallerThroughWindowsMessages } void DeleteAllPendingTasks() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); DVLOG_IF(1, !pending_tasks_.empty()) << "Destroying " << pending_tasks_.size() << " pending tasks"; @@ -184,7 +184,7 @@ template <class T> class TaskMarshallerThroughWindowsMessages } inline void PushTask(Task* task) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); pending_tasks_.push(task); } @@ -192,7 +192,7 @@ template <class T> class TaskMarshallerThroughWindowsMessages // otherwise we assume this is an already destroyed task (but Window message // had remained in the thread queue). inline bool PopTask(Task* task) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (!pending_tasks_.empty() && task == pending_tasks_.front()) { pending_tasks_.pop(); return true; @@ -201,7 +201,7 @@ template <class T> class TaskMarshallerThroughWindowsMessages return false; } - Lock lock_; + base::Lock lock_; std::queue<Task*> pending_tasks_; }; diff --git a/chrome_frame/chrome_frame_histograms.cc b/chrome_frame/chrome_frame_histograms.cc index a920828..edcc968 100644 --- a/chrome_frame/chrome_frame_histograms.cc +++ b/chrome_frame/chrome_frame_histograms.cc @@ -24,7 +24,7 @@ ChromeFrameHistogramSnapshots::ChromeFrameHistogramSnapshots() { ChromeFrameHistogramSnapshots::HistogramPickledList ChromeFrameHistogramSnapshots::GatherAllHistograms() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); StatisticsRecorder::Histograms histograms; StatisticsRecorder::GetHistograms(&histograms); diff --git a/chrome_frame/chrome_frame_histograms.h b/chrome_frame/chrome_frame_histograms.h index b33efac..35c594c 100644 --- a/chrome_frame/chrome_frame_histograms.h +++ b/chrome_frame/chrome_frame_histograms.h @@ -10,10 +10,10 @@ #include <vector> #include "base/basictypes.h" -#include "base/lock.h" #include "base/metrics/histogram.h" #include "base/process.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "base/task.h" // This class gathers histogram data in the host browser process and @@ -50,7 +50,7 @@ class ChromeFrameHistogramSnapshots { LoggedSampleMap logged_samples_; // Synchronizes the histogram gathering operation. - Lock lock_; + base::Lock lock_; DISALLOW_COPY_AND_ASSIGN(ChromeFrameHistogramSnapshots); }; diff --git a/chrome_frame/chrome_tab.cc b/chrome_frame/chrome_tab.cc index bc4a7d1..183204a 100644 --- a/chrome_frame/chrome_tab.cc +++ b/chrome_frame/chrome_tab.cc @@ -13,7 +13,6 @@ #include "base/command_line.h" #include "base/file_util.h" #include "base/file_version_info.h" -#include "base/lock.h" #include "base/logging.h" #include "base/logging_win.h" #include "base/path_service.h" diff --git a/chrome_frame/com_type_info_holder.cc b/chrome_frame/com_type_info_holder.cc index d95fd41..695d61e 100644 --- a/chrome_frame/com_type_info_holder.cc +++ b/chrome_frame/com_type_info_holder.cc @@ -28,7 +28,7 @@ TypeInfoNameCache* TypeInfoCache::Lookup(const IID* iid) { TypeInfoNameCache* tih = NULL; - AutoLock lock(lock_); + base::AutoLock lock(lock_); CacheMap::iterator it = cache_.find(iid); if (it == cache_.end()) { tih = new TypeInfoNameCache(); @@ -104,7 +104,7 @@ HRESULT TypeInfoNameCache::Invoke(IDispatch* p, DISPID dispid, WORD flags, // NameToDispIdCache bool NameToDispIdCache::Lookup(HashType hash, DISPID* dispid) const { - AutoLock lock(lock_); + base::AutoLock lock(lock_); const DispidMap::const_iterator it = map_.find(hash); bool found = (it != map_.end()); if (found) @@ -113,7 +113,7 @@ bool NameToDispIdCache::Lookup(HashType hash, DISPID* dispid) const { } void NameToDispIdCache::Add(HashType hash, DISPID dispid) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); map_[hash] = dispid; } diff --git a/chrome_frame/com_type_info_holder.h b/chrome_frame/com_type_info_holder.h index 9b0e6cf..3c974e8 100644 --- a/chrome_frame/com_type_info_holder.h +++ b/chrome_frame/com_type_info_holder.h @@ -8,8 +8,8 @@ #include <map> #include <ocidl.h> // IProvideClassInfo2 -#include "base/lock.h" #include "base/scoped_comptr_win.h" +#include "base/synchronization/lock.h" #define NO_VTABLE __declspec(novtable) @@ -32,7 +32,7 @@ class NameToDispIdCache { protected: typedef std::map<HashType, DISPID> DispidMap; DispidMap map_; - mutable Lock lock_; + mutable base::Lock lock_; }; // Wraps an instance of ITypeInfo and builds+maintains a cache of names diff --git a/chrome_frame/crash_reporting/crash_report.cc b/chrome_frame/crash_reporting/crash_report.cc index e71bd66..32c8131 100644 --- a/chrome_frame/crash_reporting/crash_report.cc +++ b/chrome_frame/crash_reporting/crash_report.cc @@ -1,5 +1,4 @@ - -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,7 +6,7 @@ #include "chrome_frame/crash_reporting/crash_report.h" #include "base/basictypes.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "breakpad/src/client/windows/handler/exception_handler.h" #include "chrome_frame/crash_reporting/crash_metrics.h" @@ -15,7 +14,7 @@ const wchar_t kGoogleUpdatePipeName[] = L"\\\\.\\pipe\\GoogleCrashServices\\"; // This lock protects against concurrent access to g_breakpad. -static Lock g_breakpad_lock; +static base::Lock g_breakpad_lock; static google_breakpad::ExceptionHandler* g_breakpad = NULL; // These minidump flag combinations have been tested safe against the @@ -54,7 +53,8 @@ class CrashHandler { // Note that breakpad_lock is used to protect accesses to breakpad and must // be held when Init() is called. - bool Init(google_breakpad::ExceptionHandler* breakpad, Lock* breakpad_lock); + bool Init(google_breakpad::ExceptionHandler* breakpad, + base::Lock* breakpad_lock); void Shutdown(); private: @@ -78,7 +78,7 @@ LONG WINAPI CrashHandler::VectoredHandlerEntryPoint( #pragma code_seg(pop) bool CrashHandler::Init(google_breakpad::ExceptionHandler* breakpad, - Lock* breakpad_lock) { + base::Lock* breakpad_lock) { DCHECK(breakpad); DCHECK(breakpad_lock); breakpad_lock->AssertAcquired(); @@ -119,7 +119,7 @@ bool InitializeVectoredCrashReportingWithPipeName( const wchar_t* pipe_name, const std::wstring& dump_path, google_breakpad::CustomClientInfo* client_info) { - AutoLock lock(g_breakpad_lock); + base::AutoLock lock(g_breakpad_lock); if (g_breakpad) return true; @@ -165,14 +165,14 @@ bool InitializeVectoredCrashReporting( bool ShutdownVectoredCrashReporting() { g_crash_handler.Shutdown(); - AutoLock lock(g_breakpad_lock); + base::AutoLock lock(g_breakpad_lock); delete g_breakpad; g_breakpad = NULL; return true; } bool WriteMinidumpForException(EXCEPTION_POINTERS* p) { - AutoLock lock(g_breakpad_lock); + base::AutoLock lock(g_breakpad_lock); CrashMetricsReporter::GetInstance()->IncrementMetric( CrashMetricsReporter::CRASH_COUNT); bool success = false; diff --git a/chrome_frame/function_stub.cc b/chrome_frame/function_stub.cc index 59a4029..2b04148 100644 --- a/chrome_frame/function_stub.cc +++ b/chrome_frame/function_stub.cc @@ -1,10 +1,12 @@ // Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. + #include "chrome_frame/function_stub.h" #include <new> -#include "base/lock.h" + +#include "base/synchronization/lock.h" #include "base/logging.h" #ifndef _M_IX86 @@ -48,14 +50,14 @@ class ExecutableHeap { } void CreateHeap() { - AutoLock lock(init_lock_); + base::AutoLock lock(init_lock_); if (heap_ == NULL) heap_ = ::HeapCreate(HEAP_CREATE_ENABLE_EXECUTE, 0, 0); } private: - Lock init_lock_; + base::Lock init_lock_; HANDLE heap_; }; diff --git a/chrome_frame/metrics_service.cc b/chrome_frame/metrics_service.cc index d9aea10..3f22ae5 100644 --- a/chrome_frame/metrics_service.cc +++ b/chrome_frame/metrics_service.cc @@ -53,12 +53,12 @@ #endif #include "base/file_version_info.h" -#include "base/lock.h" #include "base/string_split.h" #include "base/string_util.h" #include "base/stringprintf.h" -#include "base/threading/thread.h" +#include "base/synchronization/lock.h" #include "base/string_number_conversions.h" +#include "base/threading/thread.h" #include "base/utf_string_conversions.h" #include "chrome/common/chrome_version_info.h" #include "chrome/common/net/url_fetcher.h" @@ -97,7 +97,7 @@ static const int kMinMilliSecondsPerUMAUpload = 600000; base::LazyInstance<MetricsService> g_metrics_instance_(base::LINKER_INITIALIZED); -Lock MetricsService::metrics_service_lock_; +base::Lock MetricsService::metrics_service_lock_; // Traits to create an instance of the ChromeFrame upload thread. struct UploadThreadInstanceTraits @@ -127,7 +127,7 @@ struct UploadThreadInstanceTraits base::LazyInstance<base::Thread, UploadThreadInstanceTraits> g_metrics_upload_thread_(base::LINKER_INITIALIZED); -Lock g_metrics_service_lock; +base::Lock g_metrics_service_lock; extern base::LazyInstance<base::StatisticsRecorder> g_statistics_recorder_; @@ -354,7 +354,7 @@ class ChromeFrameMetricsDataUploader }; MetricsService* MetricsService::GetInstance() { - AutoLock lock(g_metrics_service_lock); + base::AutoLock lock(g_metrics_service_lock); return &g_metrics_instance_.Get(); } @@ -403,7 +403,7 @@ void MetricsService::InitializeMetricsState() { // static void MetricsService::Start() { - AutoLock lock(metrics_service_lock_); + base::AutoLock lock(metrics_service_lock_); if (GetInstance()->state_ == ACTIVE) return; @@ -416,7 +416,7 @@ void MetricsService::Start() { // static void MetricsService::Stop() { { - AutoLock lock(metrics_service_lock_); + base::AutoLock lock(metrics_service_lock_); GetInstance()->SetReporting(false); GetInstance()->SetRecording(false); diff --git a/chrome_frame/metrics_service.h b/chrome_frame/metrics_service.h index 46f39ed..5c19ba6 100644 --- a/chrome_frame/metrics_service.h +++ b/chrome_frame/metrics_service.h @@ -13,9 +13,9 @@ #include "base/basictypes.h" #include "base/lazy_instance.h" -#include "base/lock.h" #include "base/metrics/histogram.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "base/threading/platform_thread.h" #include "base/threading/thread_local.h" #include "chrome/common/metrics_helpers.h" @@ -148,7 +148,7 @@ class MetricsService : public MetricsServiceBase { int transmission_timer_id_; // Used to serialize the Start and Stop operations on the metrics service. - static Lock metrics_service_lock_; + static base::Lock metrics_service_lock_; DISALLOW_COPY_AND_ASSIGN(MetricsService); }; diff --git a/chrome_frame/protocol_sink_wrap.cc b/chrome_frame/protocol_sink_wrap.cc index 7f2e333..2a94b25 100644 --- a/chrome_frame/protocol_sink_wrap.cc +++ b/chrome_frame/protocol_sink_wrap.cc @@ -331,7 +331,7 @@ ProtData::ProtData(IInternetProtocol* protocol, DVLOG(1) << __FUNCTION__ << " " << this; // Add to map. - AutoLock lock(datamap_lock_); + base::AutoLock lock(datamap_lock_); DCHECK(datamap_.end() == datamap_.find(protocol_)); datamap_[protocol] = this; } @@ -571,7 +571,7 @@ void ProtData::SaveReferrer(IInternetProtocolSink* delegate) { scoped_refptr<ProtData> ProtData::DataFromProtocol( IInternetProtocol* protocol) { scoped_refptr<ProtData> instance; - AutoLock lock(datamap_lock_); + base::AutoLock lock(datamap_lock_); ProtocolDataMap::iterator it = datamap_.find(protocol); if (datamap_.end() != it) instance = it->second; @@ -581,7 +581,7 @@ scoped_refptr<ProtData> ProtData::DataFromProtocol( void ProtData::Invalidate() { if (protocol_) { // Remove from map. - AutoLock lock(datamap_lock_); + base::AutoLock lock(datamap_lock_); DCHECK(datamap_.end() != datamap_.find(protocol_)); datamap_.erase(protocol_); protocol_ = NULL; diff --git a/chrome_frame/sync_msg_reply_dispatcher.cc b/chrome_frame/sync_msg_reply_dispatcher.cc index a59ba68..e2f1974 100644 --- a/chrome_frame/sync_msg_reply_dispatcher.cc +++ b/chrome_frame/sync_msg_reply_dispatcher.cc @@ -14,7 +14,7 @@ void SyncMessageReplyDispatcher::Push(IPC::SyncMessage* msg, context->id_ = IPC::SyncMessage::GetMessageId(*msg); context->key_ = key; - AutoLock lock(message_queue_lock_); + base::AutoLock lock(message_queue_lock_); message_queue_.push_back(context); } } @@ -36,7 +36,7 @@ bool SyncMessageReplyDispatcher::OnMessageReceived(const IPC::Message& msg) { void SyncMessageReplyDispatcher::Cancel(void* key) { DCHECK(key != NULL); - AutoLock lock(message_queue_lock_); + base::AutoLock lock(message_queue_lock_); PendingSyncMessageQueue::iterator it = message_queue_.begin(); while (it != message_queue_.end()) { SyncMessageCallContext* context = *it; @@ -55,7 +55,7 @@ SyncMessageReplyDispatcher::SyncMessageCallContext* return NULL; int id = IPC::SyncMessage::GetMessageId(msg); - AutoLock lock(message_queue_lock_); + base::AutoLock lock(message_queue_lock_); PendingSyncMessageQueue::iterator it; for (it = message_queue_.begin(); it != message_queue_.end(); ++it) { SyncMessageCallContext* context = *it; diff --git a/chrome_frame/sync_msg_reply_dispatcher.h b/chrome_frame/sync_msg_reply_dispatcher.h index 7d47bd1..a168788 100644 --- a/chrome_frame/sync_msg_reply_dispatcher.h +++ b/chrome_frame/sync_msg_reply_dispatcher.h @@ -8,7 +8,7 @@ #include <deque> #include "base/callback.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "ipc/ipc_channel_proxy.h" // Base class used to allow synchronous IPC messages to be sent and @@ -113,7 +113,7 @@ class SyncMessageReplyDispatcher : public IPC::ChannelProxy::MessageFilter { } PendingSyncMessageQueue message_queue_; - Lock message_queue_lock_; + base::Lock message_queue_lock_; }; #endif // CHROME_FRAME_SYNC_MSG_REPLY_DISPATCHER_H_ diff --git a/chrome_frame/task_marshaller.cc b/chrome_frame/task_marshaller.cc index 9b6ba20..4b257a6 100644 --- a/chrome_frame/task_marshaller.cc +++ b/chrome_frame/task_marshaller.cc @@ -38,7 +38,7 @@ void TaskMarshallerThroughMessageQueue::PostDelayedTask( Task* task, base::TimeDelta& delay) { DCHECK(wnd_ != NULL); - AutoLock lock(lock_); + base::AutoLock lock(lock_); DelayedTask delayed_task(task, base::Time::Now() + delay); delayed_tasks_.push(delayed_task); // If we become the 'top' task - reschedule the timer. @@ -70,7 +70,7 @@ BOOL TaskMarshallerThroughMessageQueue::ProcessWindowMessage(HWND hWnd, } Task* TaskMarshallerThroughMessageQueue::PopTask() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); Task* task = NULL; if (!pending_tasks_.empty()) { task = pending_tasks_.front(); @@ -118,7 +118,7 @@ void TaskMarshallerThroughMessageQueue::ExecuteDelayedTasks() { } void TaskMarshallerThroughMessageQueue::DeleteAll() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); DVLOG_IF(1, !pending_tasks_.empty()) << "Destroying " << pending_tasks_.size() << " pending tasks."; diff --git a/chrome_frame/task_marshaller.h b/chrome_frame/task_marshaller.h index 9fd3701..75d945e 100644 --- a/chrome_frame/task_marshaller.h +++ b/chrome_frame/task_marshaller.h @@ -9,7 +9,8 @@ #include <windows.h> #include <deque> #include <queue> -#include "base/lock.h" + +#include "base/synchronization/lock.h" #include "base/threading/non_thread_safe.h" #include "base/time.h" @@ -58,7 +59,7 @@ class TaskMarshallerThroughMessageQueue : public base::NonThreadSafe { std::priority_queue<DelayedTask> delayed_tasks_; std::queue<Task*> pending_tasks_; - Lock lock_; + base::Lock lock_; HWND wnd_; UINT msg_; int invoke_task_; diff --git a/chrome_frame/urlmon_url_request.h b/chrome_frame/urlmon_url_request.h index 4c60dcb..c16ce24 100644 --- a/chrome_frame/urlmon_url_request.h +++ b/chrome_frame/urlmon_url_request.h @@ -11,7 +11,6 @@ #include <map> #include <string> -#include "base/lock.h" #include "base/threading/thread.h" #include "chrome_frame/plugin_url_request.h" #include "chrome_frame/urlmon_moniker.h" diff --git a/chrome_frame/utils.cc b/chrome_frame/utils.cc index 1445ccb..210d6488 100644 --- a/chrome_frame/utils.cc +++ b/chrome_frame/utils.cc @@ -13,7 +13,6 @@ #include "base/file_util.h" #include "base/file_version_info.h" #include "base/lazy_instance.h" -#include "base/lock.h" #include "base/logging.h" #include "base/path_service.h" #include "base/string_number_conversions.h" diff --git a/chrome_frame/utils.h b/chrome_frame/utils.h index 97f9284..fc9928b 100644 --- a/chrome_frame/utils.h +++ b/chrome_frame/utils.h @@ -13,9 +13,9 @@ #include <vector> #include "base/basictypes.h" -#include "base/lock.h" #include "base/logging.h" #include "base/metrics/histogram.h" +#include "base/synchronization/lock.h" #include "base/threading/thread.h" #include "base/win/scoped_comptr.h" #include "gfx/rect.h" @@ -425,7 +425,7 @@ bool IsTopLevelWindow(HWND window); // Seeks a stream back to position 0. HRESULT RewindStream(IStream* stream); -extern Lock g_ChromeFrameHistogramLock; +extern base::Lock g_ChromeFrameHistogramLock; // Thread safe versions of the UMA histogram macros we use for ChromeFrame. // These should be used for histograms in ChromeFrame. If other histogram @@ -433,17 +433,17 @@ extern Lock g_ChromeFrameHistogramLock; // those should be defined and used. #define THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, \ bucket_count) { \ - AutoLock lock(g_ChromeFrameHistogramLock); \ + base::AutoLock lock(g_ChromeFrameHistogramLock); \ UMA_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count); \ } #define THREAD_SAFE_UMA_HISTOGRAM_TIMES(name, sample) { \ - AutoLock lock(g_ChromeFrameHistogramLock); \ + base::AutoLock lock(g_ChromeFrameHistogramLock); \ UMA_HISTOGRAM_TIMES(name, sample); \ } #define THREAD_SAFE_UMA_HISTOGRAM_COUNTS(name, sample) { \ - AutoLock lock(g_ChromeFrameHistogramLock); \ + base::AutoLock lock(g_ChromeFrameHistogramLock); \ UMA_HISTOGRAM_COUNTS(name, sample); \ } diff --git a/chrome_frame/vtable_patch_manager.cc b/chrome_frame/vtable_patch_manager.cc index 9f60d3a..21c4f2f 100644 --- a/chrome_frame/vtable_patch_manager.cc +++ b/chrome_frame/vtable_patch_manager.cc @@ -9,10 +9,9 @@ #include <algorithm> #include "base/atomicops.h" -#include "base/lock.h" #include "base/logging.h" #include "base/scoped_ptr.h" - +#include "base/synchronization/lock.h" #include "chrome_frame/function_stub.h" #include "chrome_frame/utils.h" @@ -25,7 +24,7 @@ const int kMaxRetries = 3; // We hold a lock over all patching operations to make sure that we don't // e.g. race on VM operations to the same patches, or to physical pages // shared across different VTABLEs. -Lock patch_lock_; +base::Lock patch_lock_; namespace internal { // Because other parties in our process might be attempting to patch the same @@ -75,7 +74,7 @@ HRESULT PatchInterfaceMethods(void* unknown, MethodPatchInfo* patches) { // is done under a global lock, to ensure multiple threads don't // race, whether on an individual patch, or on VM operations to // the same physical pages. - AutoLock lock(patch_lock_); + base::AutoLock lock(patch_lock_); for (MethodPatchInfo* it = patches; it->index_ != -1; ++it) { if (it->stub_ != NULL) { @@ -153,7 +152,7 @@ HRESULT PatchInterfaceMethods(void* unknown, MethodPatchInfo* patches) { } HRESULT UnpatchInterfaceMethods(MethodPatchInfo* patches) { - AutoLock lock(patch_lock_); + base::AutoLock lock(patch_lock_); for (MethodPatchInfo* it = patches; it->index_ != -1; ++it) { if (it->stub_) { diff --git a/chrome_frame/vtable_patch_manager.h b/chrome_frame/vtable_patch_manager.h index acf3cdb..3e9e65b 100644 --- a/chrome_frame/vtable_patch_manager.h +++ b/chrome_frame/vtable_patch_manager.h @@ -9,7 +9,7 @@ #include <list> -#include "base/lock.h" +#include "base/synchronization/lock.h" struct FunctionStub; @@ -83,7 +83,7 @@ class DynamicPatchManager { typedef std::list<PatchedObject*> PatchList; const MethodPatchInfo* patch_prototype_; - mutable Lock patch_list_lock_; + mutable base::Lock patch_list_lock_; PatchList patch_list_; }; #endif // disable DynamicPatchManager diff --git a/gfx/gtk_native_view_id_manager.cc b/gfx/gtk_native_view_id_manager.cc index 904f46b..e9e72f2 100644 --- a/gfx/gtk_native_view_id_manager.cc +++ b/gfx/gtk_native_view_id_manager.cc @@ -51,7 +51,7 @@ gfx::NativeViewId GtkNativeViewManager::GetIdForWidget(gfx::NativeView widget) { if (!widget) return 0; - AutoLock locked(lock_); + base::AutoLock locked(lock_); std::map<gfx::NativeView, gfx::NativeViewId>::const_iterator i = native_view_to_id_.find(widget); @@ -83,7 +83,7 @@ gfx::NativeViewId GtkNativeViewManager::GetIdForWidget(gfx::NativeView widget) { } bool GtkNativeViewManager::GetXIDForId(XID* output, gfx::NativeViewId id) { - AutoLock locked(lock_); + base::AutoLock locked(lock_); std::map<gfx::NativeViewId, NativeViewInfo>::const_iterator i = id_to_info_.find(id); @@ -97,7 +97,7 @@ bool GtkNativeViewManager::GetXIDForId(XID* output, gfx::NativeViewId id) { bool GtkNativeViewManager::GetPermanentXIDForId(XID* output, gfx::NativeViewId id) { - AutoLock locked(lock_); + base::AutoLock locked(lock_); std::map<gfx::NativeViewId, NativeViewInfo>::iterator i = id_to_info_.find(id); @@ -130,7 +130,7 @@ bool GtkNativeViewManager::GetPermanentXIDForId(XID* output, } void GtkNativeViewManager::ReleasePermanentXID(XID xid) { - AutoLock locked(lock_); + base::AutoLock locked(lock_); std::map<XID, PermanentXIDInfo>::iterator i = perm_xid_to_info_.find(xid); @@ -170,7 +170,7 @@ gfx::NativeViewId GtkNativeViewManager::GetWidgetId(gfx::NativeView widget) { } void GtkNativeViewManager::OnRealize(gfx::NativeView widget) { - AutoLock locked(lock_); + base::AutoLock locked(lock_); const gfx::NativeViewId id = GetWidgetId(widget); std::map<gfx::NativeViewId, NativeViewInfo>::iterator i = @@ -183,8 +183,8 @@ void GtkNativeViewManager::OnRealize(gfx::NativeView widget) { } void GtkNativeViewManager::OnUnrealize(gfx::NativeView widget) { - AutoLock unrealize_locked(unrealize_lock_); - AutoLock locked(lock_); + base::AutoLock unrealize_locked(unrealize_lock_); + base::AutoLock locked(lock_); const gfx::NativeViewId id = GetWidgetId(widget); std::map<gfx::NativeViewId, NativeViewInfo>::iterator i = @@ -194,7 +194,7 @@ void GtkNativeViewManager::OnUnrealize(gfx::NativeView widget) { } void GtkNativeViewManager::OnDestroy(gfx::NativeView widget) { - AutoLock locked(lock_); + base::AutoLock locked(lock_); std::map<gfx::NativeView, gfx::NativeViewId>::iterator i = native_view_to_id_.find(widget); diff --git a/gfx/gtk_native_view_id_manager.h b/gfx/gtk_native_view_id_manager.h index e97a852..8772bc8 100644 --- a/gfx/gtk_native_view_id_manager.h +++ b/gfx/gtk_native_view_id_manager.h @@ -9,6 +9,7 @@ #include <map> #include "base/singleton.h" +#include "base/synchronization/lock.h" #include "gfx/native_widget_types.h" typedef unsigned long XID; @@ -84,7 +85,7 @@ class GtkNativeViewManager { void OnUnrealize(gfx::NativeView widget); void OnDestroy(gfx::NativeView widget); - Lock& unrealize_lock() { return unrealize_lock_; } + base::Lock& unrealize_lock() { return unrealize_lock_; } private: // This object is a singleton: @@ -104,10 +105,10 @@ class GtkNativeViewManager { // This lock can be used to block GTK from unrealizing windows. This is needed // when the BACKGROUND_X11 thread is using a window obtained via GetXIDForId, // and can't allow the X11 resource to be deleted. - Lock unrealize_lock_; + base::Lock unrealize_lock_; // protects native_view_to_id_ and id_to_info_ - Lock lock_; + base::Lock lock_; // If asked for an id for the same widget twice, we want to return the same // id. So this records the current mapping. diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc index 34fbca9..f1aa048 100644 --- a/ipc/ipc_channel_posix.cc +++ b/ipc/ipc_channel_posix.cc @@ -20,12 +20,12 @@ #include "base/file_path.h" #include "base/file_util.h" #include "base/global_descriptors_posix.h" -#include "base/lock.h" #include "base/logging.h" #include "base/process_util.h" #include "base/scoped_ptr.h" #include "base/singleton.h" #include "base/string_util.h" +#include "base/synchronization/lock.h" #include "ipc/ipc_descriptors.h" #include "ipc/ipc_switches.h" #include "ipc/file_descriptor_set_posix.h" @@ -91,7 +91,7 @@ class PipeMap { // Lookup a given channel id. Return -1 if not found. int Lookup(const std::string& channel_id) { - AutoLock locked(lock_); + base::AutoLock locked(lock_); ChannelToFDMap::const_iterator i = map_.find(channel_id); if (i == map_.end()) @@ -102,7 +102,7 @@ class PipeMap { // Remove the mapping for the given channel id. No error is signaled if the // channel_id doesn't exist void RemoveAndClose(const std::string& channel_id) { - AutoLock locked(lock_); + base::AutoLock locked(lock_); ChannelToFDMap::iterator i = map_.find(channel_id); if (i != map_.end()) { @@ -115,7 +115,7 @@ class PipeMap { // Insert a mapping from @channel_id to @fd. It's a fatal error to insert a // mapping if one already exists for the given channel_id void Insert(const std::string& channel_id, int fd) { - AutoLock locked(lock_); + base::AutoLock locked(lock_); DCHECK(fd != -1); ChannelToFDMap::const_iterator i = map_.find(channel_id); @@ -126,7 +126,7 @@ class PipeMap { } private: - Lock lock_; + base::Lock lock_; typedef std::map<std::string, int> ChannelToFDMap; ChannelToFDMap map_; diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc index 6d3fdeb..5d23e7a 100644 --- a/ipc/ipc_channel_proxy.cc +++ b/ipc/ipc_channel_proxy.cc @@ -195,7 +195,7 @@ void ChannelProxy::Context::OnSendMessage(Message* message) { void ChannelProxy::Context::OnAddFilter() { std::vector<scoped_refptr<MessageFilter> > filters; { - AutoLock auto_lock(pending_filters_lock_); + base::AutoLock auto_lock(pending_filters_lock_); filters.swap(pending_filters_); } @@ -227,7 +227,7 @@ void ChannelProxy::Context::OnRemoveFilter(MessageFilter* filter) { // Called on the listener's thread void ChannelProxy::Context::AddFilter(MessageFilter* filter) { - AutoLock auto_lock(pending_filters_lock_); + base::AutoLock auto_lock(pending_filters_lock_); pending_filters_.push_back(make_scoped_refptr(filter)); ipc_message_loop_->PostTask( FROM_HERE, diff --git a/ipc/ipc_channel_proxy.h b/ipc/ipc_channel_proxy.h index 82a243b..8683891 100644 --- a/ipc/ipc_channel_proxy.h +++ b/ipc/ipc_channel_proxy.h @@ -8,9 +8,9 @@ #include <vector> -#include "base/lock.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "ipc/ipc_channel.h" #include "ipc/ipc_channel_handle.h" @@ -229,7 +229,7 @@ class ChannelProxy : public Message::Sender { // IPC thread when they're added to filters_. std::vector<scoped_refptr<MessageFilter> > pending_filters_; // Lock for pending_filters_. - Lock pending_filters_lock_; + base::Lock pending_filters_lock_; }; Context* context() { return context_; } diff --git a/ipc/ipc_sync_channel.cc b/ipc/ipc_sync_channel.cc index fbad0f6..1c7edfa 100644 --- a/ipc/ipc_sync_channel.cc +++ b/ipc/ipc_sync_channel.cc @@ -55,7 +55,7 @@ class SyncChannel::ReceivedSyncMsgQueue : void QueueMessage(const Message& msg, SyncChannel::SyncContext* context) { bool was_task_pending; { - AutoLock auto_lock(message_lock_); + base::AutoLock auto_lock(message_lock_); was_task_pending = task_pending_; task_pending_ = true; @@ -80,7 +80,7 @@ class SyncChannel::ReceivedSyncMsgQueue : // messages. void DispatchMessagesTask() { { - AutoLock auto_lock(message_lock_); + base::AutoLock auto_lock(message_lock_); task_pending_ = false; } DispatchMessages(); @@ -91,7 +91,7 @@ class SyncChannel::ReceivedSyncMsgQueue : Message* message; scoped_refptr<SyncChannel::SyncContext> context; { - AutoLock auto_lock(message_lock_); + base::AutoLock auto_lock(message_lock_); if (message_queue_.empty()) break; @@ -107,7 +107,7 @@ class SyncChannel::ReceivedSyncMsgQueue : // SyncChannel calls this in its destructor. void RemoveContext(SyncContext* context) { - AutoLock auto_lock(message_lock_); + base::AutoLock auto_lock(message_lock_); SyncMessageQueue::iterator iter = message_queue_.begin(); while (iter != message_queue_.end()) { @@ -185,7 +185,7 @@ class SyncChannel::ReceivedSyncMsgQueue : // message. WaitableEvent dispatch_event_; MessageLoop* listener_message_loop_; - Lock message_lock_; + base::Lock message_lock_; bool task_pending_; int listener_count_; @@ -223,14 +223,14 @@ void SyncChannel::SyncContext::Push(SyncMessage* sync_msg) { PendingSyncMsg pending(SyncMessage::GetMessageId(*sync_msg), sync_msg->GetReplyDeserializer(), new WaitableEvent(true, false)); - AutoLock auto_lock(deserializers_lock_); + base::AutoLock auto_lock(deserializers_lock_); deserializers_.push_back(pending); } bool SyncChannel::SyncContext::Pop() { bool result; { - AutoLock auto_lock(deserializers_lock_); + base::AutoLock auto_lock(deserializers_lock_); PendingSyncMsg msg = deserializers_.back(); delete msg.deserializer; delete msg.done_event; @@ -251,7 +251,7 @@ bool SyncChannel::SyncContext::Pop() { } WaitableEvent* SyncChannel::SyncContext::GetSendDoneEvent() { - AutoLock auto_lock(deserializers_lock_); + base::AutoLock auto_lock(deserializers_lock_); return deserializers_.back().done_event; } @@ -264,7 +264,7 @@ void SyncChannel::SyncContext::DispatchMessages() { } bool SyncChannel::SyncContext::TryToUnblockListener(const Message* msg) { - AutoLock auto_lock(deserializers_lock_); + base::AutoLock auto_lock(deserializers_lock_); if (deserializers_.empty() || !SyncMessage::IsMessageReplyTo(*msg, deserializers_.back().id)) { return false; @@ -324,7 +324,7 @@ void SyncChannel::SyncContext::OnChannelClosed() { } void SyncChannel::SyncContext::OnSendTimeout(int message_id) { - AutoLock auto_lock(deserializers_lock_); + base::AutoLock auto_lock(deserializers_lock_); PendingSyncMessageQueue::iterator iter; for (iter = deserializers_.begin(); iter != deserializers_.end(); iter++) { if (iter->id == message_id) { @@ -335,7 +335,7 @@ void SyncChannel::SyncContext::OnSendTimeout(int message_id) { } void SyncChannel::SyncContext::CancelPendingSends() { - AutoLock auto_lock(deserializers_lock_); + base::AutoLock auto_lock(deserializers_lock_); PendingSyncMessageQueue::iterator iter; for (iter = deserializers_.begin(); iter != deserializers_.end(); iter++) iter->done_event->Signal(); diff --git a/ipc/ipc_sync_channel.h b/ipc/ipc_sync_channel.h index 7f2f7f4..e2d571a 100644 --- a/ipc/ipc_sync_channel.h +++ b/ipc/ipc_sync_channel.h @@ -10,8 +10,8 @@ #include <deque> #include "base/basictypes.h" -#include "base/lock.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #include "base/synchronization/waitable_event_watcher.h" #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_channel_proxy.h" @@ -119,7 +119,7 @@ class SyncChannel : public ChannelProxy, typedef std::deque<PendingSyncMsg> PendingSyncMessageQueue; PendingSyncMessageQueue deserializers_; - Lock deserializers_lock_; + base::Lock deserializers_lock_; scoped_refptr<ReceivedSyncMsgQueue> received_sync_msgs_; diff --git a/ipc/ipc_sync_message_filter.cc b/ipc/ipc_sync_message_filter.cc index 17a4093..cffbaa6 100644 --- a/ipc/ipc_sync_message_filter.cc +++ b/ipc/ipc_sync_message_filter.cc @@ -23,7 +23,7 @@ SyncMessageFilter::~SyncMessageFilter() { bool SyncMessageFilter::Send(Message* message) { { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (!io_loop_) { delete message; return false; @@ -44,7 +44,7 @@ bool SyncMessageFilter::Send(Message* message) { &done_event); { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // Can't use this class on the main thread or else it can lead to deadlocks. // Also by definition, can't use this on IO thread since we're blocking it. DCHECK(MessageLoop::current() != listener_loop_); @@ -60,7 +60,7 @@ bool SyncMessageFilter::Send(Message* message) { base::WaitableEvent::WaitMany(events, 2); { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); delete pending_message.deserializer; pending_sync_messages_.erase(&pending_message); } @@ -84,7 +84,7 @@ void SyncMessageFilter::SendOnIOThread(Message* message) { } void SyncMessageFilter::SignalAllEvents() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); for (PendingSyncMessages::iterator iter = pending_sync_messages_.begin(); iter != pending_sync_messages_.end(); ++iter) { (*iter)->done_event->Signal(); @@ -93,7 +93,7 @@ void SyncMessageFilter::SignalAllEvents() { void SyncMessageFilter::OnFilterAdded(Channel* channel) { channel_ = channel; - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); io_loop_ = MessageLoop::current(); } @@ -108,7 +108,7 @@ void SyncMessageFilter::OnChannelClosing() { } bool SyncMessageFilter::OnMessageReceived(const Message& message) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); for (PendingSyncMessages::iterator iter = pending_sync_messages_.begin(); iter != pending_sync_messages_.end(); ++iter) { if (SyncMessage::IsMessageReplyTo(message, (*iter)->id)) { diff --git a/ipc/ipc_sync_message_filter.h b/ipc/ipc_sync_message_filter.h index 96e2435..5215be6 100644 --- a/ipc/ipc_sync_message_filter.h +++ b/ipc/ipc_sync_message_filter.h @@ -7,8 +7,8 @@ #pragma once #include "base/basictypes.h" -#include "base/lock.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #include "ipc/ipc_channel_proxy.h" #include "ipc/ipc_sync_message.h" #include <set> @@ -58,7 +58,7 @@ class SyncMessageFilter : public ChannelProxy::MessageFilter, PendingSyncMessages pending_sync_messages_; // Locks data members above. - Lock lock_; + base::Lock lock_; base::WaitableEvent* shutdown_event_; diff --git a/media/audio/audio_input_controller.cc b/media/audio/audio_input_controller.cc index 4f08c46..1e23f53 100644 --- a/media/audio/audio_input_controller.cc +++ b/media/audio/audio_input_controller.cc @@ -110,7 +110,7 @@ void AudioInputController::DoRecord() { return; { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); state_ = kRecording; } @@ -143,7 +143,7 @@ void AudioInputController::DoReportError(int code) { void AudioInputController::OnData(AudioInputStream* stream, const uint8* data, uint32 size) { { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (state_ != kRecording) return; } diff --git a/media/audio/audio_input_controller.h b/media/audio/audio_input_controller.h index 8afb3bd..581a90d 100644 --- a/media/audio/audio_input_controller.h +++ b/media/audio/audio_input_controller.h @@ -5,9 +5,9 @@ #ifndef MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ #define MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ -#include "base/lock.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "base/threading/thread.h" #include "media/audio/audio_io.h" #include "media/audio/audio_manager.h" @@ -121,7 +121,7 @@ class AudioInputController : // is not required for reading on the audio input controller thread. State state_; - Lock lock_; + base::Lock lock_; // The audio input controller thread that this object runs on. base::Thread thread_; diff --git a/media/audio/audio_output_controller.cc b/media/audio/audio_output_controller.cc index 6ab8f3f..5347c50 100644 --- a/media/audio/audio_output_controller.cc +++ b/media/audio/audio_output_controller.cc @@ -129,7 +129,7 @@ void AudioOutputController::SetVolume(double volume) { void AudioOutputController::EnqueueData(const uint8* data, uint32 size) { // Write data to the push source and ask for more data if needed. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); pending_request_ = false; // If |size| is set to 0, it indicates that the audio source doesn't have // more data right now, and so it doesn't make sense to send additional @@ -178,7 +178,7 @@ void AudioOutputController::DoCreate(AudioParameters params) { // If in normal latency mode then start buffering. if (!LowLatencyMode()) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); SubmitOnMoreData_Locked(); } } @@ -228,7 +228,7 @@ void AudioOutputController::DoFlush() { if (!sync_reader_) { if (state_ != kPaused) return; - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); buffer_.Clear(); } } @@ -281,7 +281,7 @@ uint32 AudioOutputController::OnMoreData( uint32 max_size, AudioBuffersState buffers_state) { // If regular latency mode is used. if (!sync_reader_) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // Save current buffers state. buffers_state_ = buffers_state; @@ -326,7 +326,7 @@ void AudioOutputController::SubmitOnMoreData_Locked() { // If we need more data then call the event handler to ask for more data. // It is okay that we don't lock in this block because the parameters are // correct and in the worst case we are just asking more data than needed. - AutoUnlock auto_unlock(lock_); + base::AutoUnlock auto_unlock(lock_); handler_->OnMoreData(this, buffers_state); } diff --git a/media/audio/audio_output_controller.h b/media/audio/audio_output_controller.h index 0a191e3..3778171 100644 --- a/media/audio/audio_output_controller.h +++ b/media/audio/audio_output_controller.h @@ -5,9 +5,9 @@ #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ #define MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_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 "media/audio/audio_buffers_state.h" #include "media/audio/audio_io.h" @@ -187,7 +187,7 @@ class AudioOutputController AudioBuffersState buffers_state_; // The |lock_| must be acquired whenever we access |buffer_|. - Lock lock_; + base::Lock lock_; media::SeekableBuffer buffer_; diff --git a/media/audio/linux/alsa_output.cc b/media/audio/linux/alsa_output.cc index 6df30b4..338ff08 100644 --- a/media/audio/linux/alsa_output.cc +++ b/media/audio/linux/alsa_output.cc @@ -837,7 +837,7 @@ AlsaPcmOutputStream::SharedData::SharedData( } bool AlsaPcmOutputStream::SharedData::CanTransitionTo(InternalState to) { - AutoLock l(lock_); + base::AutoLock l(lock_); return CanTransitionTo_Locked(to); } @@ -874,7 +874,7 @@ AlsaPcmOutputStream::InternalState AlsaPcmOutputStream::SharedData::TransitionTo(InternalState to) { DCHECK_EQ(MessageLoop::current(), state_transition_loop_); - AutoLock l(lock_); + base::AutoLock l(lock_); if (!CanTransitionTo_Locked(to)) { NOTREACHED() << "Cannot transition from: " << state_ << " to: " << to; state_ = kInError; @@ -885,24 +885,24 @@ AlsaPcmOutputStream::SharedData::TransitionTo(InternalState to) { } AlsaPcmOutputStream::InternalState AlsaPcmOutputStream::SharedData::state() { - AutoLock l(lock_); + base::AutoLock l(lock_); return state_; } float AlsaPcmOutputStream::SharedData::volume() { - AutoLock l(lock_); + base::AutoLock l(lock_); return volume_; } void AlsaPcmOutputStream::SharedData::set_volume(float v) { - AutoLock l(lock_); + base::AutoLock l(lock_); volume_ = v; } uint32 AlsaPcmOutputStream::SharedData::OnMoreData( AudioOutputStream* stream, uint8* dest, uint32 max_size, AudioBuffersState buffers_state) { - AutoLock l(lock_); + base::AutoLock l(lock_); if (source_callback_) { return source_callback_->OnMoreData(stream, dest, max_size, buffers_state); } @@ -912,7 +912,7 @@ uint32 AlsaPcmOutputStream::SharedData::OnMoreData( void AlsaPcmOutputStream::SharedData::OnError(AudioOutputStream* stream, int code) { - AutoLock l(lock_); + base::AutoLock l(lock_); if (source_callback_) { source_callback_->OnError(stream, code); } @@ -923,6 +923,6 @@ void AlsaPcmOutputStream::SharedData::OnError(AudioOutputStream* stream, void AlsaPcmOutputStream::SharedData::set_source_callback( AudioSourceCallback* callback) { DCHECK_EQ(MessageLoop::current(), state_transition_loop_); - AutoLock l(lock_); + base::AutoLock l(lock_); source_callback_ = callback; } diff --git a/media/audio/linux/alsa_output.h b/media/audio/linux/alsa_output.h index 25ff055..f2999c1 100644 --- a/media/audio/linux/alsa_output.h +++ b/media/audio/linux/alsa_output.h @@ -40,9 +40,9 @@ #include <string> #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 "media/audio/audio_io.h" #include "media/audio/audio_parameters.h" @@ -193,7 +193,7 @@ class AlsaPcmOutputStream : void set_source_callback(AudioSourceCallback* callback); private: - Lock lock_; + base::Lock lock_; InternalState state_; float volume_; // Volume level from 0.0 to 1.0. diff --git a/media/audio/linux/audio_manager_linux.cc b/media/audio/linux/audio_manager_linux.cc index c875c08..4c92a6f 100644 --- a/media/audio/linux/audio_manager_linux.cc +++ b/media/audio/linux/audio_manager_linux.cc @@ -62,7 +62,7 @@ AudioOutputStream* AudioManagerLinux::MakeAudioOutputStream( new AlsaPcmOutputStream(device_name, params, wrapper_.get(), this, GetMessageLoop()); - AutoLock l(lock_); + base::AutoLock l(lock_); active_streams_[stream] = scoped_refptr<AlsaPcmOutputStream>(stream); return stream; } @@ -125,7 +125,7 @@ void AudioManagerLinux::UnMuteAll() { void AudioManagerLinux::ReleaseOutputStream(AlsaPcmOutputStream* stream) { if (stream) { - AutoLock l(lock_); + base::AutoLock l(lock_); active_streams_.erase(stream); } } diff --git a/media/audio/linux/audio_manager_linux.h b/media/audio/linux/audio_manager_linux.h index 4ae3b64..b657966 100644 --- a/media/audio/linux/audio_manager_linux.h +++ b/media/audio/linux/audio_manager_linux.h @@ -7,9 +7,9 @@ #include <map> -#include "base/lock.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "base/threading/thread.h" #include "media/audio/audio_manager_base.h" @@ -40,7 +40,7 @@ class AudioManagerLinux : public AudioManagerBase { private: scoped_ptr<AlsaWrapper> wrapper_; - Lock lock_; + base::Lock lock_; std::map<AlsaPcmOutputStream*, scoped_refptr<AlsaPcmOutputStream> > active_streams_; diff --git a/media/base/message_loop_factory_impl.cc b/media/base/message_loop_factory_impl.cc index bcf3bf8..ebe64a4 100644 --- a/media/base/message_loop_factory_impl.cc +++ b/media/base/message_loop_factory_impl.cc @@ -9,7 +9,7 @@ namespace media { MessageLoopFactoryImpl::MessageLoopFactoryImpl() {} MessageLoopFactoryImpl::~MessageLoopFactoryImpl() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); for (ThreadMap::iterator iter = thread_map_.begin(); iter != thread_map_.end(); @@ -30,7 +30,7 @@ MessageLoop* MessageLoopFactoryImpl::GetMessageLoop(const std::string& name) { return NULL; } - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); ThreadMap::iterator it = thread_map_.find(name); if (it != thread_map_.end()) diff --git a/media/base/message_loop_factory_impl.h b/media/base/message_loop_factory_impl.h index 1c8a61a..e7576ba 100644 --- a/media/base/message_loop_factory_impl.h +++ b/media/base/message_loop_factory_impl.h @@ -25,7 +25,7 @@ class MessageLoopFactoryImpl : public MessageLoopFactory { private: // Lock used to serialize access for the following data members. - Lock lock_; + base::Lock lock_; typedef std::map<std::string, base::Thread*> ThreadMap; ThreadMap thread_map_; diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc index 022198c..d039664 100644 --- a/media/base/pipeline_impl.cc +++ b/media/base/pipeline_impl.cc @@ -35,7 +35,7 @@ PipelineImpl::PipelineImpl(MessageLoop* message_loop) } PipelineImpl::~PipelineImpl() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK(!running_) << "Stop() must complete before destroying object"; DCHECK(!stop_pending_); DCHECK(!seek_pending_); @@ -55,7 +55,7 @@ void PipelineImpl::Init(PipelineCallback* ended_callback, bool PipelineImpl::Start(FilterCollection* collection, const std::string& url, PipelineCallback* start_callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); scoped_ptr<PipelineCallback> callback(start_callback); scoped_ptr<FilterCollection> filter_collection(collection); @@ -81,7 +81,7 @@ bool PipelineImpl::Start(FilterCollection* collection, } void PipelineImpl::Stop(PipelineCallback* stop_callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); scoped_ptr<PipelineCallback> callback(stop_callback); if (!running_) { VLOG(1) << "Media pipeline has already stopped"; @@ -95,7 +95,7 @@ void PipelineImpl::Stop(PipelineCallback* stop_callback) { void PipelineImpl::Seek(base::TimeDelta time, PipelineCallback* seek_callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); scoped_ptr<PipelineCallback> callback(seek_callback); if (!running_) { VLOG(1) << "Media pipeline must be running"; @@ -108,7 +108,7 @@ void PipelineImpl::Seek(base::TimeDelta time, } bool PipelineImpl::IsRunning() const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return running_; } @@ -116,7 +116,7 @@ bool PipelineImpl::IsInitialized() const { // TODO(scherkus): perhaps replace this with a bool that is set/get under the // lock, because this is breaching the contract that |state_| is only accessed // on |message_loop_|. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); switch (state_) { case kPausing: case kFlushing: @@ -131,19 +131,19 @@ bool PipelineImpl::IsInitialized() const { } bool PipelineImpl::IsNetworkActive() const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return network_activity_; } bool PipelineImpl::IsRendered(const std::string& major_mime_type) const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); bool is_rendered = (rendered_mime_types_.find(major_mime_type) != rendered_mime_types_.end()); return is_rendered; } float PipelineImpl::GetPlaybackRate() const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return playback_rate_; } @@ -152,7 +152,7 @@ void PipelineImpl::SetPlaybackRate(float playback_rate) { return; } - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); playback_rate_ = playback_rate; if (running_) { message_loop_->PostTask(FROM_HERE, @@ -162,7 +162,7 @@ void PipelineImpl::SetPlaybackRate(float playback_rate) { } float PipelineImpl::GetVolume() const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return volume_; } @@ -171,7 +171,7 @@ void PipelineImpl::SetVolume(float volume) { return; } - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); volume_ = volume; if (running_) { message_loop_->PostTask(FROM_HERE, @@ -184,7 +184,7 @@ base::TimeDelta PipelineImpl::GetCurrentTime() const { // TODO(scherkus): perhaps replace checking state_ == kEnded with a bool that // is set/get under the lock, because this is breaching the contract that // |state_| is only accessed on |message_loop_|. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return GetCurrentTime_Locked(); } @@ -197,7 +197,7 @@ base::TimeDelta PipelineImpl::GetCurrentTime_Locked() const { } base::TimeDelta PipelineImpl::GetBufferedTime() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // If media is fully loaded, then return duration. if (loaded_ || total_bytes_ == buffered_bytes_) { @@ -237,45 +237,45 @@ base::TimeDelta PipelineImpl::GetBufferedTime() { } base::TimeDelta PipelineImpl::GetMediaDuration() const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return duration_; } int64 PipelineImpl::GetBufferedBytes() const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return buffered_bytes_; } int64 PipelineImpl::GetTotalBytes() const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return total_bytes_; } void PipelineImpl::GetVideoSize(size_t* width_out, size_t* height_out) const { CHECK(width_out); CHECK(height_out); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); *width_out = video_width_; *height_out = video_height_; } bool PipelineImpl::IsStreaming() const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return streaming_; } bool PipelineImpl::IsLoaded() const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return loaded_; } PipelineError PipelineImpl::GetError() const { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return error_; } void PipelineImpl::SetCurrentReadPosition(int64 offset) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // The current read position should never be ahead of the buffered byte // position but threading issues between BufferedDataSource::DoneRead_Locked() @@ -289,12 +289,12 @@ void PipelineImpl::SetCurrentReadPosition(int64 offset) { } int64 PipelineImpl::GetCurrentReadPosition() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return current_bytes_; } void PipelineImpl::ResetState() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); const base::TimeDelta kZero; running_ = false; stop_pending_ = false; @@ -411,7 +411,7 @@ base::TimeDelta PipelineImpl::GetDuration() const { void PipelineImpl::SetTime(base::TimeDelta time) { DCHECK(IsRunning()); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // If we were waiting for a valid timestamp and such timestamp arrives, we // need to clear the flag for waiting and start the clock. @@ -428,25 +428,25 @@ void PipelineImpl::SetTime(base::TimeDelta time) { void PipelineImpl::SetDuration(base::TimeDelta duration) { DCHECK(IsRunning()); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); duration_ = duration; } void PipelineImpl::SetBufferedTime(base::TimeDelta buffered_time) { DCHECK(IsRunning()); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); buffered_time_ = buffered_time; } void PipelineImpl::SetTotalBytes(int64 total_bytes) { DCHECK(IsRunning()); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); total_bytes_ = total_bytes; } void PipelineImpl::SetBufferedBytes(int64 buffered_bytes) { DCHECK(IsRunning()); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // See comments in SetCurrentReadPosition() about capping. if (buffered_bytes < current_bytes_) @@ -456,14 +456,14 @@ void PipelineImpl::SetBufferedBytes(int64 buffered_bytes) { void PipelineImpl::SetVideoSize(size_t width, size_t height) { DCHECK(IsRunning()); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); video_width_ = width; video_height_ = height; } void PipelineImpl::SetStreaming(bool streaming) { DCHECK(IsRunning()); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); streaming_ = streaming; } @@ -475,14 +475,14 @@ void PipelineImpl::NotifyEnded() { void PipelineImpl::SetLoaded(bool loaded) { DCHECK(IsRunning()); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); loaded_ = loaded; } void PipelineImpl::SetNetworkActivity(bool network_activity) { DCHECK(IsRunning()); { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); network_activity_ = network_activity; } message_loop_->PostTask(FROM_HERE, @@ -499,13 +499,13 @@ void PipelineImpl::DisableAudioRenderer() { void PipelineImpl::InsertRenderedMimeType(const std::string& major_mime_type) { DCHECK(IsRunning()); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); rendered_mime_types_.insert(major_mime_type); } bool PipelineImpl::HasRenderedMimeTypes() const { DCHECK(IsRunning()); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return !rendered_mime_types_.empty(); } @@ -682,7 +682,7 @@ void PipelineImpl::StopTask(PipelineCallback* stop_callback) { // going to error state and calling |error_callback_|. This converts // the teardown in progress from an error teardown into one that acts // like the error never occurred. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); error_ = PIPELINE_OK; error_caused_teardown_ = false; } @@ -709,7 +709,7 @@ void PipelineImpl::ErrorChangedTask(PipelineError error) { return; } - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); error_ = error; error_caused_teardown_ = true; @@ -719,7 +719,7 @@ void PipelineImpl::ErrorChangedTask(PipelineError error) { void PipelineImpl::PlaybackRateChangedTask(float playback_rate) { DCHECK_EQ(MessageLoop::current(), message_loop_); { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); clock_->SetPlaybackRate(playback_rate); } @@ -770,7 +770,7 @@ void PipelineImpl::SeekTask(base::TimeDelta time, // Kick off seeking! { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // If we are waiting for a clock update, the clock hasn't been played yet. if (!waiting_for_clock_update_) clock_->Pause(); @@ -826,7 +826,7 @@ void PipelineImpl::DisableAudioRendererTask() { // |rendered_mime_types_| is read through public methods so we need to lock // this variable. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); rendered_mime_types_.erase(mime_type::kMajorTypeAudio); audio_disabled_ = true; @@ -857,7 +857,7 @@ void PipelineImpl::FilterStateTransitionTask() { // to the next state if needed. set_state(FindNextState(state_)); if (state_ == kSeeking) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); clock_->SetTime(seek_timestamp_); } @@ -888,7 +888,7 @@ void PipelineImpl::FilterStateTransitionTask() { seek_timestamp_ = base::TimeDelta(); seek_pending_ = false; - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // We use audio stream to update the clock. So if there is such a stream, // we pause the clock until we receive a valid timestamp. waiting_for_clock_update_ = diff --git a/media/base/pipeline_impl.h b/media/base/pipeline_impl.h index 09d4950..addd1ce 100644 --- a/media/base/pipeline_impl.h +++ b/media/base/pipeline_impl.h @@ -277,7 +277,7 @@ class PipelineImpl : public Pipeline, public FilterHost { MessageLoop* message_loop_; // Lock used to serialize access for the following data members. - mutable Lock lock_; + mutable base::Lock lock_; // Whether or not the pipeline is running. bool running_; diff --git a/media/filters/audio_renderer_base.cc b/media/filters/audio_renderer_base.cc index d330521..9d7783f 100644 --- a/media/filters/audio_renderer_base.cc +++ b/media/filters/audio_renderer_base.cc @@ -28,7 +28,7 @@ AudioRendererBase::~AudioRendererBase() { } void AudioRendererBase::Play(FilterCallback* callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK_EQ(kPaused, state_); scoped_ptr<FilterCallback> c(callback); state_ = kPlaying; @@ -36,7 +36,7 @@ void AudioRendererBase::Play(FilterCallback* callback) { } void AudioRendererBase::Pause(FilterCallback* callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK_EQ(kPlaying, state_); pause_callback_.reset(callback); state_ = kPaused; @@ -53,7 +53,7 @@ void AudioRendererBase::Pause(FilterCallback* callback) { void AudioRendererBase::Stop(FilterCallback* callback) { OnStop(); { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); state_ = kStopped; algorithm_.reset(NULL); } @@ -64,7 +64,7 @@ void AudioRendererBase::Stop(FilterCallback* callback) { } void AudioRendererBase::Seek(base::TimeDelta time, FilterCallback* callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK_EQ(kPaused, state_); DCHECK_EQ(0u, pending_reads_) << "Pending reads should have completed"; state_ = kSeeking; @@ -129,7 +129,7 @@ void AudioRendererBase::Initialize(AudioDecoder* decoder, } bool AudioRendererBase::HasEnded() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (rendered_end_of_stream_) { DCHECK(algorithm_->IsQueueEmpty()) << "Audio queue should be empty if we have rendered end of stream"; @@ -138,7 +138,7 @@ bool AudioRendererBase::HasEnded() { } void AudioRendererBase::ConsumeAudioSamples(scoped_refptr<Buffer> buffer_in) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK(state_ == kPaused || state_ == kSeeking || state_ == kPlaying); DCHECK_GT(pending_reads_, 0u); --pending_reads_; @@ -191,7 +191,7 @@ uint32 AudioRendererBase::FillBuffer(uint8* dest, base::TimeDelta last_fill_buffer_time; size_t dest_written = 0; { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // Mute audio by returning 0 when not playing. if (state_ != kPlaying) { diff --git a/media/filters/audio_renderer_base.h b/media/filters/audio_renderer_base.h index c0af81a..6c77acb 100644 --- a/media/filters/audio_renderer_base.h +++ b/media/filters/audio_renderer_base.h @@ -20,7 +20,7 @@ #include <deque> -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "media/base/buffers.h" #include "media/base/filters.h" #include "media/filters/audio_renderer_algorithm_base.h" @@ -102,7 +102,7 @@ class AudioRendererBase : public AudioRenderer { // Algorithm for scaling audio. scoped_ptr<AudioRendererAlgorithmBase> algorithm_; - Lock lock_; + base::Lock lock_; // Simple state tracking variable. enum State { diff --git a/media/filters/ffmpeg_glue.cc b/media/filters/ffmpeg_glue.cc index 663fff7..fede662 100644 --- a/media/filters/ffmpeg_glue.cc +++ b/media/filters/ffmpeg_glue.cc @@ -88,21 +88,21 @@ int CloseContext(URLContext* h) { int LockManagerOperation(void** lock, enum AVLockOp op) { switch (op) { case AV_LOCK_CREATE: - *lock = new Lock(); + *lock = new base::Lock(); if (!*lock) return 1; return 0; case AV_LOCK_OBTAIN: - static_cast<Lock*>(*lock)->Acquire(); + static_cast<base::Lock*>(*lock)->Acquire(); return 0; case AV_LOCK_RELEASE: - static_cast<Lock*>(*lock)->Release(); + static_cast<base::Lock*>(*lock)->Release(); return 0; case AV_LOCK_DESTROY: - delete static_cast<Lock*>(*lock); + delete static_cast<base::Lock*>(*lock); *lock = NULL; return 0; } @@ -151,7 +151,7 @@ FFmpegGlue* FFmpegGlue::GetInstance() { } std::string FFmpegGlue::AddProtocol(FFmpegURLProtocol* protocol) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); std::string key = GetProtocolKey(protocol); if (protocols_.find(key) == protocols_.end()) { protocols_[key] = protocol; @@ -160,7 +160,7 @@ std::string FFmpegGlue::AddProtocol(FFmpegURLProtocol* protocol) { } void FFmpegGlue::RemoveProtocol(FFmpegURLProtocol* protocol) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); for (ProtocolMap::iterator cur, iter = protocols_.begin(); iter != protocols_.end();) { cur = iter; @@ -173,7 +173,7 @@ void FFmpegGlue::RemoveProtocol(FFmpegURLProtocol* protocol) { void FFmpegGlue::GetProtocol(const std::string& key, FFmpegURLProtocol** protocol) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); ProtocolMap::iterator iter = protocols_.find(key); if (iter == protocols_.end()) { *protocol = NULL; diff --git a/media/filters/ffmpeg_glue.h b/media/filters/ffmpeg_glue.h index 4f991d1..aa12670 100644 --- a/media/filters/ffmpeg_glue.h +++ b/media/filters/ffmpeg_glue.h @@ -29,8 +29,8 @@ #include <map> #include <string> -#include "base/lock.h" #include "base/singleton.h" +#include "base/synchronization/lock.h" namespace media { @@ -93,7 +93,7 @@ class FFmpegGlue { std::string GetProtocolKey(FFmpegURLProtocol* protocol); // Mutual exclusion while adding/removing items from the map. - Lock lock_; + base::Lock lock_; // Map between keys and FFmpegProtocol references. typedef std::map<std::string, FFmpegURLProtocol*> ProtocolMap; diff --git a/media/filters/file_data_source.cc b/media/filters/file_data_source.cc index 3fd1a04..64c61fb 100644 --- a/media/filters/file_data_source.cc +++ b/media/filters/file_data_source.cc @@ -50,7 +50,7 @@ void FileDataSource::Initialize(const std::string& url, } void FileDataSource::Stop(FilterCallback* callback) { - AutoLock l(lock_); + base::AutoLock l(lock_); if (file_) { file_util::CloseFile(file_); file_ = NULL; @@ -69,7 +69,7 @@ const MediaFormat& FileDataSource::media_format() { void FileDataSource::Read(int64 position, size_t size, uint8* data, ReadCallback* read_callback) { DCHECK(file_); - AutoLock l(lock_); + base::AutoLock l(lock_); scoped_ptr<ReadCallback> callback(read_callback); if (file_) { #if defined(OS_WIN) @@ -101,7 +101,7 @@ void FileDataSource::Read(int64 position, size_t size, uint8* data, bool FileDataSource::GetSize(int64* size_out) { DCHECK(size_out); DCHECK(file_); - AutoLock l(lock_); + base::AutoLock l(lock_); *size_out = file_size_; return (NULL != file_); } diff --git a/media/filters/file_data_source.h b/media/filters/file_data_source.h index f6aed76..7be9a5a 100644 --- a/media/filters/file_data_source.h +++ b/media/filters/file_data_source.h @@ -8,7 +8,7 @@ #include <string> #include "base/gtest_prod_util.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "media/base/filters.h" namespace media { @@ -54,7 +54,7 @@ class FileDataSource : public DataSource { // TODO(ralphl): Ideally this would use asynchronous I/O or we will know // that we will block for a short period of time in reads. Otherwise, we can // hang the pipeline Stop. - Lock lock_; + base::Lock lock_; DISALLOW_COPY_AND_ASSIGN(FileDataSource); }; diff --git a/media/filters/video_renderer_base.cc b/media/filters/video_renderer_base.cc index c870df5..410e18f 100644 --- a/media/filters/video_renderer_base.cc +++ b/media/filters/video_renderer_base.cc @@ -39,7 +39,7 @@ VideoRendererBase::VideoRendererBase() } VideoRendererBase::~VideoRendererBase() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK(state_ == kUninitialized || state_ == kStopped); } @@ -78,7 +78,7 @@ bool VideoRendererBase::ParseMediaFormat( } void VideoRendererBase::Play(FilterCallback* callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK_EQ(kPrerolled, state_); scoped_ptr<FilterCallback> c(callback); state_ = kPlaying; @@ -86,7 +86,7 @@ void VideoRendererBase::Play(FilterCallback* callback) { } void VideoRendererBase::Pause(FilterCallback* callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK(state_ != kUninitialized || state_ == kError); AutoCallbackRunner done_runner(callback); state_ = kPaused; @@ -95,7 +95,7 @@ void VideoRendererBase::Pause(FilterCallback* callback) { void VideoRendererBase::Flush(FilterCallback* callback) { DCHECK_EQ(state_, kPaused); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); flush_callback_.reset(callback); state_ = kFlushing; @@ -107,7 +107,7 @@ void VideoRendererBase::Stop(FilterCallback* callback) { DCHECK_EQ(pending_reads_, 0); { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); state_ = kStopped; // Clean up our thread if present. @@ -116,7 +116,7 @@ void VideoRendererBase::Stop(FilterCallback* callback) { // thread waiting for a read to complete. frame_available_.Signal(); { - AutoUnlock auto_unlock(lock_); + base::AutoUnlock auto_unlock(lock_); base::PlatformThread::Join(thread_); } thread_ = base::kNullThreadHandle; @@ -128,12 +128,12 @@ void VideoRendererBase::Stop(FilterCallback* callback) { } void VideoRendererBase::SetPlaybackRate(float playback_rate) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); playback_rate_ = playback_rate; } void VideoRendererBase::Seek(base::TimeDelta time, FilterCallback* callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // There is a race condition between filters to receive SeekTask(). // It turns out we could receive buffer from decoder before seek() // is called on us. so we do the following: @@ -158,7 +158,7 @@ void VideoRendererBase::Seek(base::TimeDelta time, FilterCallback* callback) { void VideoRendererBase::Initialize(VideoDecoder* decoder, FilterCallback* callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK(decoder); DCHECK(callback); DCHECK_EQ(kUninitialized, state_); @@ -210,7 +210,7 @@ void VideoRendererBase::Initialize(VideoDecoder* decoder, } bool VideoRendererBase::HasEnded() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return state_ == kEnded; } @@ -220,7 +220,7 @@ void VideoRendererBase::ThreadMain() { base::TimeDelta remaining_time; for (;;) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); const base::TimeDelta kIdleTimeDelta = base::TimeDelta::FromMilliseconds(kIdleMilliseconds); @@ -317,7 +317,7 @@ void VideoRendererBase::ThreadMain() { ScheduleRead_Locked(); } if (new_frame_available) { - AutoUnlock auto_unlock(lock_); + base::AutoUnlock auto_unlock(lock_); // Notify subclass that |current_frame_| has been updated. OnFrameAvailable(); } @@ -326,7 +326,7 @@ void VideoRendererBase::ThreadMain() { } void VideoRendererBase::GetCurrentFrame(scoped_refptr<VideoFrame>* frame_out) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK(!pending_paint_ && !pending_paint_with_last_available_); if (!current_frame_.get() || current_frame_->IsEndOfStream()) { @@ -352,7 +352,7 @@ void VideoRendererBase::GetCurrentFrame(scoped_refptr<VideoFrame>* frame_out) { } void VideoRendererBase::PutCurrentFrame(scoped_refptr<VideoFrame> frame) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // Note that we do not claim |pending_paint_| when we return NULL frame, in // that case, |current_frame_| could be changed before PutCurrentFrame. @@ -376,7 +376,7 @@ void VideoRendererBase::PutCurrentFrame(scoped_refptr<VideoFrame> frame) { } void VideoRendererBase::ConsumeVideoFrame(scoped_refptr<VideoFrame> frame) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // Decoder could reach seek state before our Seek() get called. // We will enter kSeeking diff --git a/net/base/capturing_net_log.cc b/net/base/capturing_net_log.cc index 568d4c3..2daa73a 100644 --- a/net/base/capturing_net_log.cc +++ b/net/base/capturing_net_log.cc @@ -26,17 +26,17 @@ CapturingNetLog::CapturingNetLog(size_t max_num_entries) CapturingNetLog::~CapturingNetLog() {} void CapturingNetLog::GetEntries(EntryList* entry_list) const { - AutoLock lock(lock_); + base::AutoLock lock(lock_); *entry_list = entries_; } void CapturingNetLog::Clear() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); entries_.clear(); } void CapturingNetLog::SetLogLevel(NetLog::LogLevel log_level) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); log_level_ = log_level; } @@ -45,7 +45,7 @@ void CapturingNetLog::AddEntry(EventType type, const Source& source, EventPhase phase, EventParameters* extra_parameters) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); Entry entry(type, time, source, phase, extra_parameters); if (entries_.size() + 1 < max_num_entries_) entries_.push_back(entry); @@ -56,7 +56,7 @@ uint32 CapturingNetLog::NextID() { } NetLog::LogLevel CapturingNetLog::GetLogLevel() const { - AutoLock lock(lock_); + base::AutoLock lock(lock_); return log_level_; } diff --git a/net/base/capturing_net_log.h b/net/base/capturing_net_log.h index 0678d9a..a7406af 100644 --- a/net/base/capturing_net_log.h +++ b/net/base/capturing_net_log.h @@ -10,9 +10,9 @@ #include "base/atomicops.h" #include "base/basictypes.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 "net/base/net_log.h" @@ -65,7 +65,7 @@ class CapturingNetLog : public NetLog { private: // Needs to be "mutable" so can use it in GetEntries(). - mutable Lock lock_; + mutable base::Lock lock_; // Last assigned source ID. Incremented to get the next one. base::subtle::Atomic32 last_id_; diff --git a/net/base/cert_database_mac.cc b/net/base/cert_database_mac.cc index b0afd50..e90a712 100644 --- a/net/base/cert_database_mac.cc +++ b/net/base/cert_database_mac.cc @@ -7,8 +7,8 @@ #include <Security/Security.h> #include "base/crypto/cssm_init.h" -#include "base/lock.h" #include "base/logging.h" +#include "base/synchronization/lock.h" #include "net/base/net_errors.h" #include "net/base/x509_certificate.h" @@ -43,7 +43,7 @@ int CertDatabase::CheckUserCert(X509Certificate* cert) { int CertDatabase::AddUserCert(X509Certificate* cert) { OSStatus err; { - AutoLock locked(base::GetMacSecurityServicesLock()); + base::AutoLock locked(base::GetMacSecurityServicesLock()); err = SecCertificateAddToKeychain(cert->os_cert_handle(), NULL); } switch (err) { diff --git a/net/base/cert_verifier.cc b/net/base/cert_verifier.cc index 3d22dec..044524f 100644 --- a/net/base/cert_verifier.cc +++ b/net/base/cert_verifier.cc @@ -5,9 +5,9 @@ #include "net/base/cert_verifier.h" #include "base/compiler_specific.h" -#include "base/lock.h" #include "base/message_loop.h" #include "base/stl_util-inl.h" +#include "base/synchronization/lock.h" #include "base/threading/worker_pool.h" #include "net/base/net_errors.h" #include "net/base/x509_certificate.h" @@ -145,7 +145,7 @@ class CertVerifierWorker { // deleted. void Cancel() { DCHECK_EQ(MessageLoop::current(), origin_loop_); - AutoLock locked(lock_); + base::AutoLock locked(lock_); canceled_ = true; } @@ -174,7 +174,7 @@ class CertVerifierWorker { // after the PostTask, but before unlocking |lock_|. If we do not lock in // this case, we will end up deleting a locked Lock, which can lead to // memory leaks or worse errors. - AutoLock locked(lock_); + base::AutoLock locked(lock_); if (!canceled_) { cert_verifier_->HandleResult(cert_, hostname_, flags_, error_, verify_result_); @@ -196,7 +196,7 @@ class CertVerifierWorker { bool canceled; { - AutoLock locked(lock_); + base::AutoLock locked(lock_); canceled = canceled_; if (!canceled) { origin_loop_->PostTask( @@ -215,7 +215,7 @@ class CertVerifierWorker { CertVerifier* const cert_verifier_; // lock_ protects canceled_. - Lock lock_; + base::Lock lock_; // If canceled_ is true, // * origin_loop_ cannot be accessed by the worker thread, diff --git a/net/base/cookie_monster.cc b/net/base/cookie_monster.cc index cc96d44..e24b6be 100644 --- a/net/base/cookie_monster.cc +++ b/net/base/cookie_monster.cc @@ -503,7 +503,7 @@ bool CookieMonster::SetCookieWithDetails( const GURL& url, const std::string& name, const std::string& value, const std::string& domain, const std::string& path, const base::Time& expiration_time, bool secure, bool http_only) { - AutoLock autolock(lock_); + base::AutoLock autolock(lock_); if (!HasCookieableScheme(url)) return false; @@ -529,7 +529,7 @@ bool CookieMonster::SetCookieWithDetails( CookieList CookieMonster::GetAllCookies() { - AutoLock autolock(lock_); + base::AutoLock autolock(lock_); InitIfNecessary(); // This function is being called to scrape the cookie list for management UI @@ -564,7 +564,7 @@ CookieList CookieMonster::GetAllCookies() { CookieList CookieMonster::GetAllCookiesForURLWithOptions( const GURL& url, const CookieOptions& options) { - AutoLock autolock(lock_); + base::AutoLock autolock(lock_); InitIfNecessary(); std::vector<CanonicalCookie*> cookie_ptrs; @@ -587,7 +587,7 @@ CookieList CookieMonster::GetAllCookiesForURL(const GURL& url) { } int CookieMonster::DeleteAll(bool sync_to_store) { - AutoLock autolock(lock_); + base::AutoLock autolock(lock_); if (sync_to_store) InitIfNecessary(); @@ -607,7 +607,7 @@ int CookieMonster::DeleteAll(bool sync_to_store) { int CookieMonster::DeleteAllCreatedBetween(const Time& delete_begin, const Time& delete_end, bool sync_to_store) { - AutoLock autolock(lock_); + base::AutoLock autolock(lock_); InitIfNecessary(); int num_deleted = 0; @@ -632,7 +632,7 @@ int CookieMonster::DeleteAllCreatedAfter(const Time& delete_begin, } int CookieMonster::DeleteAllForHost(const GURL& url) { - AutoLock autolock(lock_); + base::AutoLock autolock(lock_); InitIfNecessary(); if (!HasCookieableScheme(url)) @@ -663,7 +663,7 @@ int CookieMonster::DeleteAllForHost(const GURL& url) { } bool CookieMonster::DeleteCanonicalCookie(const CanonicalCookie& cookie) { - AutoLock autolock(lock_); + base::AutoLock autolock(lock_); InitIfNecessary(); for (CookieMapItPair its = cookies_.equal_range(GetKey(cookie.Domain())); @@ -679,7 +679,7 @@ bool CookieMonster::DeleteCanonicalCookie(const CanonicalCookie& cookie) { void CookieMonster::SetCookieableSchemes( const char* schemes[], size_t num_schemes) { - AutoLock autolock(lock_); + base::AutoLock autolock(lock_); // Cookieable Schemes must be set before first use of function. DCHECK(!initialized_); @@ -705,7 +705,7 @@ void CookieMonster::EnableFileScheme() { } void CookieMonster::FlushStore(Task* completion_task) { - AutoLock autolock(lock_); + base::AutoLock autolock(lock_); if (initialized_ && store_) store_->Flush(completion_task); else if (completion_task) @@ -715,7 +715,7 @@ void CookieMonster::FlushStore(Task* completion_task) { bool CookieMonster::SetCookieWithOptions(const GURL& url, const std::string& cookie_line, const CookieOptions& options) { - AutoLock autolock(lock_); + base::AutoLock autolock(lock_); if (!HasCookieableScheme(url)) { return false; @@ -728,7 +728,7 @@ bool CookieMonster::SetCookieWithOptions(const GURL& url, std::string CookieMonster::GetCookiesWithOptions(const GURL& url, const CookieOptions& options) { - AutoLock autolock(lock_); + base::AutoLock autolock(lock_); InitIfNecessary(); if (!HasCookieableScheme(url)) { @@ -764,7 +764,7 @@ std::string CookieMonster::GetCookiesWithOptions(const GURL& url, void CookieMonster::DeleteCookie(const GURL& url, const std::string& cookie_name) { - AutoLock autolock(lock_); + base::AutoLock autolock(lock_); InitIfNecessary(); if (!HasCookieableScheme(url)) @@ -806,7 +806,7 @@ CookieMonster::~CookieMonster() { bool CookieMonster::SetCookieWithCreationTime(const GURL& url, const std::string& cookie_line, const base::Time& creation_time) { - AutoLock autolock(lock_); + base::AutoLock autolock(lock_); if (!HasCookieableScheme(url)) { return false; diff --git a/net/base/cookie_monster.h b/net/base/cookie_monster.h index 6a17d38..b2e3d2b 100644 --- a/net/base/cookie_monster.h +++ b/net/base/cookie_monster.h @@ -15,9 +15,9 @@ #include "base/basictypes.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/task.h" #include "base/time.h" #include "net/base/cookie_store.h" @@ -485,7 +485,7 @@ class CookieMonster : public CookieStore { scoped_refptr<Delegate> delegate_; // Lock for thread-safety - Lock lock_; + base::Lock lock_; base::Time last_statistic_record_time_; diff --git a/net/base/dnsrr_resolver.cc b/net/base/dnsrr_resolver.cc index 203ae52..5d9c132 100644 --- a/net/base/dnsrr_resolver.cc +++ b/net/base/dnsrr_resolver.cc @@ -12,12 +12,12 @@ #include <windns.h> #endif -#include "base/lock.h" #include "base/message_loop.h" #include "base/scoped_ptr.h" #include "base/singleton.h" #include "base/stl_util-inl.h" #include "base/string_piece.h" +#include "base/synchronization/lock.h" #include "base/task.h" #include "base/threading/worker_pool.h" #include "net/base/dns_reload_timer.h" @@ -168,7 +168,7 @@ class RRResolverWorker { // deleted. void Cancel() { DCHECK_EQ(MessageLoop::current(), origin_loop_); - AutoLock locked(lock_); + base::AutoLock locked(lock_); canceled_ = true; } @@ -353,7 +353,7 @@ class RRResolverWorker { // after the PostTask, but before unlocking |lock_|. If we do not lock in // this case, we will end up deleting a locked Lock, which can lead to // memory leaks or worse errors. - AutoLock locked(lock_); + base::AutoLock locked(lock_); if (!canceled_) dnsrr_resolver_->HandleResult(name_, rrtype_, result_, response_); } @@ -373,7 +373,7 @@ class RRResolverWorker { bool canceled; { - AutoLock locked(lock_); + base::AutoLock locked(lock_); canceled = canceled_; if (!canceled) { origin_loop_->PostTask( @@ -391,7 +391,7 @@ class RRResolverWorker { MessageLoop* const origin_loop_; DnsRRResolver* const dnsrr_resolver_; - Lock lock_; + base::Lock lock_; bool canceled_; int result_; diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc index b4c8bfa..5c61b4f 100644 --- a/net/base/host_resolver_impl.cc +++ b/net/base/host_resolver_impl.cc @@ -18,12 +18,12 @@ #include "base/compiler_specific.h" #include "base/debug/debugger.h" #include "base/debug/stack_trace.h" -#include "base/lock.h" #include "base/message_loop.h" #include "base/metrics/field_trial.h" #include "base/metrics/histogram.h" #include "base/stl_util-inl.h" #include "base/string_util.h" +#include "base/synchronization/lock.h" #include "base/threading/worker_pool.h" #include "base/time.h" #include "base/utf_string_conversions.h" @@ -405,7 +405,7 @@ class HostResolverImpl::Job // Mark the job as cancelled, so when worker thread completes it will // not try to post completion to origin loop. { - AutoLock locked(origin_loop_lock_); + base::AutoLock locked(origin_loop_lock_); origin_loop_ = NULL; } @@ -482,7 +482,7 @@ class HostResolverImpl::Job // The origin loop could go away while we are trying to post to it, so we // need to call its PostTask method inside a lock. See ~HostResolver. { - AutoLock locked(origin_loop_lock_); + base::AutoLock locked(origin_loop_lock_); if (origin_loop_) { origin_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, &Job::OnLookupComplete)); @@ -603,7 +603,7 @@ class HostResolverImpl::Job RequestsList requests_; // The requests waiting on this job. // Used to post ourselves onto the origin thread. - Lock origin_loop_lock_; + base::Lock origin_loop_lock_; MessageLoop* origin_loop_; // Hold an owning reference to the HostResolverProc that we are going to use. @@ -661,7 +661,7 @@ class HostResolverImpl::IPv6ProbeJob DCHECK(IsOnOriginThread()); resolver_ = NULL; // Read/write ONLY on origin thread. { - AutoLock locked(origin_loop_lock_); + base::AutoLock locked(origin_loop_lock_); // Origin loop may be destroyed before we can use it! origin_loop_ = NULL; // Write ONLY on origin thread. } @@ -695,7 +695,7 @@ class HostResolverImpl::IPv6ProbeJob // The origin loop could go away while we are trying to post to it, so we // need to call its PostTask method inside a lock. See ~HostResolver. { - AutoLock locked(origin_loop_lock_); + base::AutoLock locked(origin_loop_lock_); if (origin_loop_) { origin_loop_->PostTask(FROM_HERE, reply); return; @@ -722,7 +722,7 @@ class HostResolverImpl::IPv6ProbeJob HostResolverImpl* resolver_; // Used to post ourselves onto the origin thread. - Lock origin_loop_lock_; + base::Lock origin_loop_lock_; MessageLoop* origin_loop_; DISALLOW_COPY_AND_ASSIGN(IPv6ProbeJob); diff --git a/net/base/host_resolver_impl_unittest.cc b/net/base/host_resolver_impl_unittest.cc index 4d26ab9..8d418e9 100644 --- a/net/base/host_resolver_impl_unittest.cc +++ b/net/base/host_resolver_impl_unittest.cc @@ -92,7 +92,7 @@ class CapturingHostResolverProc : public HostResolverProc { int* os_error) { event_.Wait(); { - AutoLock l(lock_); + base::AutoLock l(lock_); capture_list_.push_back(CaptureEntry(hostname, address_family)); } return ResolveUsingPrevious(hostname, address_family, @@ -102,7 +102,7 @@ class CapturingHostResolverProc : public HostResolverProc { CaptureList GetCaptureList() const { CaptureList copy; { - AutoLock l(lock_); + base::AutoLock l(lock_); copy = capture_list_; } return copy; @@ -112,7 +112,7 @@ class CapturingHostResolverProc : public HostResolverProc { ~CapturingHostResolverProc() {} CaptureList capture_list_; - mutable Lock lock_; + mutable base::Lock lock_; base::WaitableEvent event_; }; diff --git a/net/base/keygen_handler_mac.cc b/net/base/keygen_handler_mac.cc index fdad99e..df9ce4a 100644 --- a/net/base/keygen_handler_mac.cc +++ b/net/base/keygen_handler_mac.cc @@ -10,10 +10,10 @@ #include "base/base64.h" #include "base/crypto/cssm_init.h" -#include "base/lock.h" #include "base/logging.h" #include "base/mac/scoped_cftyperef.h" #include "base/string_util.h" +#include "base/synchronization/lock.h" #include "base/sys_string_conversions.h" // These are in Security.framework but not declared in a public header. @@ -234,7 +234,7 @@ static OSStatus CreateRSAKeyPair(int size_in_bits, } base::mac::ScopedCFTypeRef<SecKeychainRef> scoped_keychain(keychain); { - AutoLock locked(base::GetMacSecurityServicesLock()); + base::AutoLock locked(base::GetMacSecurityServicesLock()); err = SecKeyCreatePair( keychain, CSSM_ALGID_RSA, @@ -261,7 +261,7 @@ static OSStatus CreateSignatureContext(SecKeyRef key, OSStatus err; const CSSM_ACCESS_CREDENTIALS* credentials = NULL; { - AutoLock locked(base::GetMacSecurityServicesLock()); + base::AutoLock locked(base::GetMacSecurityServicesLock()); err = SecKeyGetCredentials(key, CSSM_ACL_AUTHORIZATION_SIGN, kSecCredentialTypeDefault, @@ -274,7 +274,7 @@ static OSStatus CreateSignatureContext(SecKeyRef key, CSSM_CSP_HANDLE csp_handle = 0; { - AutoLock locked(base::GetMacSecurityServicesLock()); + base::AutoLock locked(base::GetMacSecurityServicesLock()); err = SecKeyGetCSPHandle(key, &csp_handle); } if (err) { @@ -284,7 +284,7 @@ static OSStatus CreateSignatureContext(SecKeyRef key, const CSSM_KEY* cssm_key = NULL; { - AutoLock locked(base::GetMacSecurityServicesLock()); + base::AutoLock locked(base::GetMacSecurityServicesLock()); err = SecKeyGetCSSMKey(key, &cssm_key); } if (err) { diff --git a/net/base/listen_socket_unittest.cc b/net/base/listen_socket_unittest.cc index 23dd089..53fc79b 100644 --- a/net/base/listen_socket_unittest.cc +++ b/net/base/listen_socket_unittest.cc @@ -73,13 +73,13 @@ void ListenSocketTester::TearDown() { } void ListenSocketTester::ReportAction(const ListenSocketTestAction& action) { - AutoLock locked(lock_); + base::AutoLock locked(lock_); queue_.push_back(action); cv_.Broadcast(); } void ListenSocketTester::NextAction() { - AutoLock locked(lock_); + base::AutoLock locked(lock_); while (queue_.empty()) cv_.Wait(); last_action_ = queue_.front(); diff --git a/net/base/net_util.cc b/net/base/net_util.cc index 804ff2a..99c6ea8 100644 --- a/net/base/net_util.cc +++ b/net/base/net_util.cc @@ -38,7 +38,6 @@ #include "base/i18n/icu_string_conversions.h" #include "base/i18n/time_formatting.h" #include "base/json/string_escape.h" -#include "base/lock.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/metrics/histogram.h" @@ -51,6 +50,7 @@ #include "base/string_tokenizer.h" #include "base/string_util.h" #include "base/stringprintf.h" +#include "base/synchronization/lock.h" #include "base/sys_string_conversions.h" #include "base/time.h" #include "base/utf_offset_string_conversions.h" @@ -550,7 +550,7 @@ void SetExemplarSetForLang(const std::string& lang, map.insert(std::make_pair(lang, lang_set)); } -static Lock lang_set_lock; +static base::Lock lang_set_lock; // Returns true if all the characters in component_characters are used by // the language |lang|. @@ -560,7 +560,7 @@ bool IsComponentCoveredByLang(const icu::UnicodeSet& component_characters, icu::UnicodeSet* lang_set; // We're called from both the UI thread and the history thread. { - AutoLock lock(lang_set_lock); + base::AutoLock lock(lang_set_lock); if (!GetExemplarSetForLang(lang, &lang_set)) { UErrorCode status = U_ZERO_ERROR; ULocaleData* uld = ulocdata_open(lang.c_str(), &status); diff --git a/net/base/openssl_memory_private_key_store.cc b/net/base/openssl_memory_private_key_store.cc index 6b65dbe..bc64b57 100644 --- a/net/base/openssl_memory_private_key_store.cc +++ b/net/base/openssl_memory_private_key_store.cc @@ -26,7 +26,7 @@ class OpenSSLMemoryKeyStore : public OpenSSLPrivateKeyStore { } virtual ~OpenSSLMemoryKeyStore() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); for (std::vector<EVP_PKEY*>::iterator it = keys_.begin(); it != keys_.end(); ++it) { EVP_PKEY_free(*it); @@ -35,13 +35,13 @@ class OpenSSLMemoryKeyStore : public OpenSSLPrivateKeyStore { virtual bool StorePrivateKey(const GURL& url, EVP_PKEY* pkey) { CRYPTO_add(&pkey->references, 1, CRYPTO_LOCK_EVP_PKEY); - AutoLock lock(lock_); + base::AutoLock lock(lock_); keys_.push_back(pkey); return true; } virtual EVP_PKEY* FetchPrivateKey(EVP_PKEY* pkey) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); for (std::vector<EVP_PKEY*>::iterator it = keys_.begin(); it != keys_.end(); ++it) { if (EVP_PKEY_cmp(*it, pkey) == 1) diff --git a/net/base/test_completion_callback_unittest.cc b/net/base/test_completion_callback_unittest.cc index a0ae9bf..d0274e4 100644 --- a/net/base/test_completion_callback_unittest.cc +++ b/net/base/test_completion_callback_unittest.cc @@ -55,7 +55,7 @@ class ExampleEmployer::ExampleWorker ExampleEmployer* employer_; CompletionCallback* callback_; // Used to post ourselves onto the origin thread. - Lock origin_loop_lock_; + base::Lock origin_loop_lock_; MessageLoop* origin_loop_; }; @@ -68,7 +68,7 @@ void ExampleEmployer::ExampleWorker::DoWork() { // The origin loop could go away while we are trying to post to it, so we // need to call its PostTask method inside a lock. See ~ExampleEmployer. { - AutoLock locked(origin_loop_lock_); + base::AutoLock locked(origin_loop_lock_); if (origin_loop_) { origin_loop_->PostTask(FROM_HERE, reply); reply = NULL; diff --git a/net/base/x509_certificate.cc b/net/base/x509_certificate.cc index 7385743..b705790 100644 --- a/net/base/x509_certificate.cc +++ b/net/base/x509_certificate.cc @@ -64,7 +64,7 @@ class X509CertificateCache { // You must acquire this lock before using any private data of this object. // You must not block while holding this lock. - Lock lock_; + base::Lock lock_; // The certificate cache. You must acquire |lock_| before using |cache_|. CertMap cache_; @@ -79,7 +79,7 @@ base::LazyInstance<X509CertificateCache, // Insert |cert| into the cache. The cache does NOT AddRef |cert|. // Any existing certificate with the same fingerprint will be replaced. void X509CertificateCache::Insert(X509Certificate* cert) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); DCHECK(!IsNullFingerprint(cert->fingerprint())) << "Only insert certs with real fingerprints."; @@ -89,7 +89,7 @@ void X509CertificateCache::Insert(X509Certificate* cert) { // Remove |cert| from the cache. The cache does not assume that |cert| is // already in the cache. void X509CertificateCache::Remove(X509Certificate* cert) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); CertMap::iterator pos(cache_.find(cert->fingerprint())); if (pos == cache_.end()) @@ -101,7 +101,7 @@ void X509CertificateCache::Remove(X509Certificate* cert) { // not exist, this method returns NULL. X509Certificate* X509CertificateCache::Find( const SHA1Fingerprint& fingerprint) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); CertMap::iterator pos(cache_.find(fingerprint)); if (pos == cache_.end()) diff --git a/net/base/x509_certificate.h b/net/base/x509_certificate.h index 47178f5..961c68a 100644 --- a/net/base/x509_certificate.h +++ b/net/base/x509_certificate.h @@ -24,7 +24,7 @@ #include <CoreFoundation/CFArray.h> #include <Security/SecBase.h> -#include "base/lock.h" +#include "base/synchronization/lock.h" #elif defined(USE_OPENSSL) // Forward declaration; real one in <x509.h> struct x509_st; @@ -370,7 +370,7 @@ class X509Certificate : public base::RefCountedThreadSafe<X509Certificate> { #if defined(OS_MACOSX) // Blocks multiple threads from verifying the cert simultaneously. // (Marked mutable because it's used in a const method.) - mutable Lock verification_lock_; + mutable base::Lock verification_lock_; #endif // Where the certificate comes from. diff --git a/net/base/x509_certificate_mac.cc b/net/base/x509_certificate_mac.cc index fd965cb3..7c5cc64 100644 --- a/net/base/x509_certificate_mac.cc +++ b/net/base/x509_certificate_mac.cc @@ -471,7 +471,7 @@ int X509Certificate::Verify(const std::string& hostname, int flags, // of sporadic crashes in the SecTrustEvaluate call below, way down inside // Apple's cert code, which we suspect are caused by a thread-safety issue. // So as a speculative fix allow only one thread to use SecTrust on this cert. - AutoLock lock(verification_lock_); + base::AutoLock lock(verification_lock_); SecTrustRef trust_ref = NULL; status = SecTrustCreateWithCertificates(cert_array, ssl_policy, &trust_ref); diff --git a/net/http/disk_cache_based_ssl_host_info.h b/net/http/disk_cache_based_ssl_host_info.h index c094163..2beb7e4 100644 --- a/net/http/disk_cache_based_ssl_host_info.h +++ b/net/http/disk_cache_based_ssl_host_info.h @@ -7,7 +7,6 @@ #include <string> -#include "base/lock.h" #include "base/scoped_ptr.h" #include "base/threading/non_thread_safe.h" #include "base/weak_ptr.h" diff --git a/net/ocsp/nss_ocsp.cc b/net/ocsp/nss_ocsp.cc index d541370..f4a5443 100644 --- a/net/ocsp/nss_ocsp.cc +++ b/net/ocsp/nss_ocsp.cc @@ -17,7 +17,6 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/lazy_instance.h" -#include "base/lock.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/metrics/histogram.h" @@ -25,6 +24,7 @@ #include "base/string_util.h" #include "base/stringprintf.h" #include "base/synchronization/condition_variable.h" +#include "base/synchronization/lock.h" #include "base/threading/thread_checker.h" #include "base/time.h" #include "googleurl/src/gurl.h" diff --git a/net/proxy/polling_proxy_config_service.cc b/net/proxy/polling_proxy_config_service.cc index 01acac2..7526c19 100644 --- a/net/proxy/polling_proxy_config_service.cc +++ b/net/proxy/polling_proxy_config_service.cc @@ -4,10 +4,10 @@ #include "net/proxy/polling_proxy_config_service.h" -#include "base/lock.h" #include "base/message_loop_proxy.h" #include "base/observer_list.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "base/threading/worker_pool.h" #include "net/proxy/proxy_config.h" @@ -32,7 +32,7 @@ class PollingProxyConfigService::Core // Called when the parent PollingProxyConfigService is destroyed // (observers should not be called past this point). void Orphan() { - AutoLock l(lock_); + base::AutoLock l(lock_); origin_loop_proxy_ = NULL; } @@ -99,7 +99,7 @@ class PollingProxyConfigService::Core ProxyConfig config; func(&config); - AutoLock l(lock_); + base::AutoLock l(lock_); if (origin_loop_proxy_) { origin_loop_proxy_->PostTask( FROM_HERE, @@ -145,7 +145,7 @@ class PollingProxyConfigService::Core base::TimeTicks last_poll_time_; base::TimeDelta poll_interval_; - Lock lock_; + base::Lock lock_; scoped_refptr<base::MessageLoopProxy> origin_loop_proxy_; bool have_initialized_origin_loop_; diff --git a/net/proxy/sync_host_resolver_bridge.cc b/net/proxy/sync_host_resolver_bridge.cc index 37a847f..80270f6 100644 --- a/net/proxy/sync_host_resolver_bridge.cc +++ b/net/proxy/sync_host_resolver_bridge.cc @@ -6,8 +6,8 @@ #include "base/compiler_specific.h" #include "base/logging.h" -#include "base/lock.h" #include "base/message_loop.h" +#include "base/synchronization/lock.h" #include "base/synchronization/waitable_event.h" #include "net/base/net_errors.h" #include "net/base/net_log.h" @@ -26,7 +26,7 @@ class SyncHostResolverBridge::Core // Returns true if Shutdown() has been called. bool HasShutdown() const { - AutoLock l(lock_); + base::AutoLock l(lock_); return HasShutdownLocked(); } @@ -66,7 +66,7 @@ class SyncHostResolverBridge::Core bool has_shutdown_; // Mutex to guard accesses to |has_shutdown_|. - mutable Lock lock_; + mutable base::Lock lock_; DISALLOW_COPY_AND_ASSIGN(Core); }; @@ -121,7 +121,7 @@ int SyncHostResolverBridge::Core::WaitForResolveCompletion() { event_.Wait(); { - AutoLock l(lock_); + base::AutoLock l(lock_); if (HasShutdownLocked()) return ERR_ABORTED; event_.Reset(); @@ -139,7 +139,7 @@ void SyncHostResolverBridge::Core::Shutdown() { } { - AutoLock l(lock_); + base::AutoLock l(lock_); has_shutdown_ = true; } diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc index e485c8a..169776a 100644 --- a/net/socket/ssl_client_socket_openssl.cc +++ b/net/socket/ssl_client_socket_openssl.cc @@ -10,10 +10,10 @@ #include <openssl/ssl.h> #include <openssl/err.h> -#include "base/lock.h" #include "base/metrics/histogram.h" #include "base/openssl_util.h" #include "base/singleton.h" +#include "base/synchronization/lock.h" #include "net/base/cert_verifier.h" #include "net/base/net_errors.h" #include "net/base/openssl_private_key_store.h" @@ -207,7 +207,7 @@ class SSLSessionCache { // Declare the session cleaner-upper before the lock, so any call into // OpenSSL to free the session will happen after the lock is released. base::ScopedOpenSSL<SSL_SESSION, SSL_SESSION_free> session_to_free; - AutoLock lock(lock_); + base::AutoLock lock(lock_); DCHECK_EQ(0U, session_map_.count(session)); std::pair<HostPortMap::iterator, bool> res = @@ -229,7 +229,7 @@ class SSLSessionCache { // Declare the session cleaner-upper before the lock, so any call into // OpenSSL to free the session will happen after the lock is released. base::ScopedOpenSSL<SSL_SESSION, SSL_SESSION_free> session_to_free; - AutoLock lock(lock_); + base::AutoLock lock(lock_); SessionMap::iterator it = session_map_.find(session); if (it == session_map_.end()) @@ -246,7 +246,7 @@ class SSLSessionCache { // Looks up the host:port in the cache, and if a session is found it is added // to |ssl|, returning true on success. bool SetSSLSession(SSL* ssl, const HostPortPair& host_and_port) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); HostPortMap::iterator it = host_port_map_.find(host_and_port); if (it == host_port_map_.end()) return false; @@ -274,7 +274,7 @@ class SSLSessionCache { SessionMap session_map_; // Protects access to both the above maps. - Lock lock_; + base::Lock lock_; DISALLOW_COPY_AND_ASSIGN(SSLSessionCache); }; diff --git a/net/socket/ssl_client_socket_win.cc b/net/socket/ssl_client_socket_win.cc index ae4d4b5..5a37de8 100644 --- a/net/socket/ssl_client_socket_win.cc +++ b/net/socket/ssl_client_socket_win.cc @@ -9,9 +9,9 @@ #include "base/compiler_specific.h" #include "base/lazy_instance.h" -#include "base/lock.h" #include "base/stl_util-inl.h" #include "base/string_util.h" +#include "base/synchronization/lock.h" #include "base/utf_string_conversions.h" #include "net/base/cert_verifier.h" #include "net/base/connection_type_histograms.h" @@ -149,7 +149,7 @@ class CredHandleTable { DCHECK(0 < ssl_version_mask && ssl_version_mask < arraysize(anonymous_creds_)); CredHandleClass* handle; - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (client_cert) { CredHandleMapKey key = std::make_pair(client_cert, ssl_version_mask); CredHandleMap::const_iterator it = client_cert_creds_.find(key); @@ -184,7 +184,7 @@ class CredHandleTable { PCCERT_CONTEXT client_cert, int ssl_version_mask); - Lock lock_; + base::Lock lock_; // Anonymous (no client certificate) CredHandles for all possible // combinations of SSL versions. Defined as an array for fast lookup. diff --git a/net/socket_stream/socket_stream_job_manager.cc b/net/socket_stream/socket_stream_job_manager.cc index de2f0a8..105fc3e 100644 --- a/net/socket_stream/socket_stream_job_manager.cc +++ b/net/socket_stream/socket_stream_job_manager.cc @@ -31,7 +31,7 @@ SocketStreamJob* SocketStreamJobManager::CreateJob( const std::string& scheme = url.scheme(); // already lowercase - AutoLock locked(lock_); + base::AutoLock locked(lock_); FactoryMap::const_iterator found = factories_.find(scheme); if (found != factories_.end()) { SocketStreamJob* job = found->second(url, delegate); @@ -46,7 +46,7 @@ SocketStreamJob* SocketStreamJobManager::CreateJob( SocketStreamJob::ProtocolFactory* SocketStreamJobManager::RegisterProtocolFactory( const std::string& scheme, SocketStreamJob::ProtocolFactory* factory) { - AutoLock locked(lock_); + base::AutoLock locked(lock_); SocketStreamJob::ProtocolFactory* old_factory; FactoryMap::iterator found = factories_.find(scheme); diff --git a/net/socket_stream/socket_stream_job_manager.h b/net/socket_stream/socket_stream_job_manager.h index fbd572d..c9050f6 100644 --- a/net/socket_stream/socket_stream_job_manager.h +++ b/net/socket_stream/socket_stream_job_manager.h @@ -35,7 +35,7 @@ class SocketStreamJobManager { SocketStreamJobManager(); ~SocketStreamJobManager(); - mutable Lock lock_; + mutable base::Lock lock_; FactoryMap factories_; DISALLOW_COPY_AND_ASSIGN(SocketStreamJobManager); diff --git a/net/tools/flip_server/flip_in_mem_edsm_server.cc b/net/tools/flip_server/flip_in_mem_edsm_server.cc index cc34d44..e2436e2 100644 --- a/net/tools/flip_server/flip_in_mem_edsm_server.cc +++ b/net/tools/flip_server/flip_in_mem_edsm_server.cc @@ -21,9 +21,9 @@ #include "base/command_line.h" #include "base/logging.h" +#include "base/synchronization/lock.h" #include "base/threading/simple_thread.h" #include "base/timer.h" -#include "base/lock.h" #include "net/spdy/spdy_frame_builder.h" #include "net/spdy/spdy_framer.h" #include "net/spdy/spdy_protocol.h" @@ -2781,15 +2781,15 @@ class Notification { explicit Notification(bool value) : value_(value) {} void Notify() { - AutoLock al(lock_); + base::AutoLock al(lock_); value_ = true; } bool HasBeenNotified() { - AutoLock al(lock_); + base::AutoLock al(lock_); return value_; } bool value_; - Lock lock_; + base::Lock lock_; }; //////////////////////////////////////////////////////////////////////////////// diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc index adc6f44..7a1599a 100644 --- a/net/url_request/url_request_file_job.cc +++ b/net/url_request/url_request_file_job.cc @@ -23,6 +23,7 @@ #include "base/message_loop.h" #include "base/platform_file.h" #include "base/string_util.h" +#include "base/synchronization/lock.h" #include "base/threading/worker_pool.h" #include "base/threading/thread_restrictions.h" #include "build/build_config.h" @@ -50,7 +51,7 @@ class URLRequestFileJob::AsyncResolver void Resolve(const FilePath& file_path) { base::PlatformFileInfo file_info; bool exists = file_util::GetFileInfo(file_path, &file_info); - AutoLock locked(lock_); + base::AutoLock locked(lock_); if (owner_loop_) { owner_loop_->PostTask(FROM_HERE, NewRunnableMethod( this, &AsyncResolver::ReturnResults, exists, file_info)); @@ -60,7 +61,7 @@ class URLRequestFileJob::AsyncResolver void Cancel() { owner_ = NULL; - AutoLock locked(lock_); + base::AutoLock locked(lock_); owner_loop_ = NULL; } @@ -76,7 +77,7 @@ class URLRequestFileJob::AsyncResolver URLRequestFileJob* owner_; - Lock lock_; + base::Lock lock_; MessageLoop* owner_loop_; }; #endif diff --git a/net/url_request/url_request_job_manager.cc b/net/url_request/url_request_job_manager.cc index c630ba2..f311cc4 100644 --- a/net/url_request/url_request_job_manager.cc +++ b/net/url_request/url_request_job_manager.cc @@ -152,7 +152,7 @@ net::URLRequestJob* URLRequestJobManager::MaybeInterceptResponse( bool URLRequestJobManager::SupportsScheme(const std::string& scheme) const { // The set of registered factories may change on another thread. { - AutoLock locked(lock_); + base::AutoLock locked(lock_); if (factories_.find(scheme) != factories_.end()) return true; } @@ -171,7 +171,7 @@ net::URLRequest::ProtocolFactory* URLRequestJobManager::RegisterProtocolFactory( DCHECK(IsAllowedThread()); #endif - AutoLock locked(lock_); + base::AutoLock locked(lock_); net::URLRequest::ProtocolFactory* old_factory; FactoryMap::iterator i = factories_.find(scheme); @@ -194,7 +194,7 @@ void URLRequestJobManager::RegisterRequestInterceptor( DCHECK(IsAllowedThread()); #endif - AutoLock locked(lock_); + base::AutoLock locked(lock_); DCHECK(std::find(interceptors_.begin(), interceptors_.end(), interceptor) == interceptors_.end()); @@ -207,7 +207,7 @@ void URLRequestJobManager::UnregisterRequestInterceptor( DCHECK(IsAllowedThread()); #endif - AutoLock locked(lock_); + base::AutoLock locked(lock_); InterceptorList::iterator i = std::find(interceptors_.begin(), interceptors_.end(), interceptor); diff --git a/net/url_request/url_request_job_manager.h b/net/url_request/url_request_job_manager.h index 34e3a58..e4efcf5 100644 --- a/net/url_request/url_request_job_manager.h +++ b/net/url_request/url_request_job_manager.h @@ -10,7 +10,7 @@ #include <string> #include <vector> -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "base/threading/platform_thread.h" #include "net/url_request/url_request.h" @@ -76,7 +76,7 @@ class URLRequestJobManager { URLRequestJobManager(); ~URLRequestJobManager(); - mutable Lock lock_; + mutable base::Lock lock_; FactoryMap factories_; InterceptorList interceptors_; bool enable_file_access_; diff --git a/printing/backend/print_backend_cups.cc b/printing/backend/print_backend_cups.cc index 90f2d33..01aa18d 100644 --- a/printing/backend/print_backend_cups.cc +++ b/printing/backend/print_backend_cups.cc @@ -13,9 +13,9 @@ #include "base/file_util.h" #include "base/lazy_instance.h" -#include "base/lock.h" #include "base/logging.h" #include "base/string_number_conversions.h" +#include "base/synchronization/lock.h" #include "base/values.h" #include "googleurl/src/gurl.h" #include "printing/backend/cups_helper.h" @@ -220,8 +220,8 @@ int PrintBackendCUPS::GetDests(cups_dest_t** dests) { FilePath PrintBackendCUPS::GetPPD(const char* name) { // cupsGetPPD returns a filename stored in a static buffer in CUPS. // Protect this code with lock. - static Lock ppd_lock; - AutoLock ppd_autolock(ppd_lock); + static base::Lock ppd_lock; + base::AutoLock ppd_autolock(ppd_lock); FilePath ppd_path; const char* ppd_file_path = NULL; if (print_server_url_.is_empty()) { // Use default (local) print server. diff --git a/printing/printed_document.cc b/printing/printed_document.cc index f50bf83..0360b5b 100644 --- a/printing/printed_document.cc +++ b/printing/printed_document.cc @@ -78,7 +78,7 @@ void PrintedDocument::SetPage(int page_number, page_rect, has_visible_overlays)); { - AutoLock lock(lock_); + base::AutoLock lock(lock_); mutable_.pages_[page_number] = page; if (mutable_.shrink_factor == 0) { mutable_.shrink_factor = shrink; @@ -91,7 +91,7 @@ void PrintedDocument::SetPage(int page_number, bool PrintedDocument::GetPage(int page_number, scoped_refptr<PrintedPage>* page) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); PrintedPages::const_iterator itr = mutable_.pages_.find(page_number); if (itr != mutable_.pages_.end()) { if (itr->second.get()) { @@ -103,7 +103,7 @@ bool PrintedDocument::GetPage(int page_number, } bool PrintedDocument::IsComplete() const { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (!mutable_.page_count_) return false; PageNumber page(immutable_.settings_, mutable_.page_count_); @@ -119,14 +119,14 @@ bool PrintedDocument::IsComplete() const { } void PrintedDocument::DisconnectSource() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); mutable_.source_ = NULL; } uint32 PrintedDocument::MemoryUsage() const { std::vector< scoped_refptr<PrintedPage> > pages_copy; { - AutoLock lock(lock_); + base::AutoLock lock(lock_); pages_copy.reserve(mutable_.pages_.size()); PrintedPages::const_iterator end = mutable_.pages_.end(); for (PrintedPages::const_iterator itr = mutable_.pages_.begin(); @@ -144,7 +144,7 @@ uint32 PrintedDocument::MemoryUsage() const { } void PrintedDocument::set_page_count(int max_page) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); DCHECK_EQ(0, mutable_.page_count_); mutable_.page_count_ = max_page; if (immutable_.settings_.ranges.empty()) { @@ -157,12 +157,12 @@ void PrintedDocument::set_page_count(int max_page) { } int PrintedDocument::page_count() const { - AutoLock lock(lock_); + base::AutoLock lock(lock_); return mutable_.page_count_; } int PrintedDocument::expected_page_count() const { - AutoLock lock(lock_); + base::AutoLock lock(lock_); return mutable_.expected_page_count_; } diff --git a/printing/printed_document.h b/printing/printed_document.h index c471b80..599d453 100644 --- a/printing/printed_document.h +++ b/printing/printed_document.h @@ -7,10 +7,10 @@ #include <map> -#include "base/lock.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "base/string16.h" +#include "base/synchronization/lock.h" #include "gfx/native_widget_types.h" #include "googleurl/src/gurl.h" #include "printing/print_settings.h" @@ -194,7 +194,7 @@ class PrintedDocument : public base::RefCountedThreadSafe<PrintedDocument> { // All writable data member access must be guarded by this lock. Needs to be // mutable since it can be acquired from const member functions. - mutable Lock lock_; + mutable base::Lock lock_; // All the mutable members. Mutable mutable_; diff --git a/printing/printed_document_cairo.cc b/printing/printed_document_cairo.cc index 76085e1..d24fef9 100644 --- a/printing/printed_document_cairo.cc +++ b/printing/printed_document_cairo.cc @@ -17,7 +17,7 @@ void PrintedDocument::RenderPrintedPage( #ifndef NDEBUG { // Make sure the page is from our list. - AutoLock lock(lock_); + base::AutoLock lock(lock_); DCHECK(&page == mutable_.pages_.find(page.page_number() - 1)->second.get()); } #endif diff --git a/printing/printed_document_mac.cc b/printing/printed_document_mac.cc index 3c5a401..2651516 100644 --- a/printing/printed_document_mac.cc +++ b/printing/printed_document_mac.cc @@ -18,7 +18,7 @@ void PrintedDocument::RenderPrintedPage( #ifndef NDEBUG { // Make sure the page is from our list. - AutoLock lock(lock_); + base::AutoLock lock(lock_); DCHECK(&page == mutable_.pages_.find(page.page_number() - 1)->second.get()); } #endif diff --git a/printing/printed_document_win.cc b/printing/printed_document_win.cc index 892de34..0cd0bb9 100644 --- a/printing/printed_document_win.cc +++ b/printing/printed_document_win.cc @@ -43,7 +43,7 @@ void PrintedDocument::RenderPrintedPage( #ifndef NDEBUG { // Make sure the page is from our list. - AutoLock lock(lock_); + base::AutoLock lock(lock_); DCHECK(&page == mutable_.pages_.find(page.page_number() - 1)->second.get()); } #endif diff --git a/remoting/base/tracer.h b/remoting/base/tracer.h index 95d4e9c..70698c2 100644 --- a/remoting/base/tracer.h +++ b/remoting/base/tracer.h @@ -53,9 +53,9 @@ #include <string> -#include "base/lock.h" #include "base/ref_counted.h" #include "base/singleton.h" +#include "base/synchronization/lock.h" #include "base/task.h" #include "base/scoped_ptr.h" #include "remoting/proto/trace.pb.h" @@ -82,7 +82,7 @@ class Tracer : public base::RefCountedThreadSafe<Tracer> { friend class base::RefCountedThreadSafe<Tracer>; virtual ~Tracer(); - Lock lock_; + base::Lock lock_; scoped_ptr<TraceBuffer> buffer_; DISALLOW_COPY_AND_ASSIGN(Tracer); diff --git a/remoting/host/capturer.cc b/remoting/host/capturer.cc index 3e32070..cf1bac7 100644 --- a/remoting/host/capturer.cc +++ b/remoting/host/capturer.cc @@ -38,7 +38,7 @@ media::VideoFrame::Format Capturer::pixel_format() const { } void Capturer::ClearInvalidRects() { - AutoLock auto_inval_rects_lock(inval_rects_lock_); + base::AutoLock auto_inval_rects_lock(inval_rects_lock_); inval_rects_.clear(); } @@ -48,13 +48,13 @@ void Capturer::InvalidateRects(const InvalidRects& inval_rects) { inval_rects.begin(), inval_rects.end(), std::inserter(temp_rects, temp_rects.begin())); { - AutoLock auto_inval_rects_lock(inval_rects_lock_); + base::AutoLock auto_inval_rects_lock(inval_rects_lock_); inval_rects_.swap(temp_rects); } } void Capturer::InvalidateFullScreen() { - AutoLock auto_inval_rects_lock(inval_rects_lock_); + base::AutoLock auto_inval_rects_lock(inval_rects_lock_); inval_rects_.clear(); inval_rects_.insert(gfx::Rect(0, 0, width_, height_)); } @@ -68,7 +68,7 @@ void Capturer::CaptureInvalidRects(CaptureCompletedCallback* callback) { // Braced to scope the lock. InvalidRects local_rects; { - AutoLock auto_inval_rects_lock(inval_rects_lock_); + base::AutoLock auto_inval_rects_lock(inval_rects_lock_); local_rects.swap(inval_rects_); } diff --git a/remoting/host/capturer.h b/remoting/host/capturer.h index 548b685..1282ebe 100644 --- a/remoting/host/capturer.h +++ b/remoting/host/capturer.h @@ -7,7 +7,7 @@ #include "base/basictypes.h" #include "base/callback.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "base/task.h" #include "remoting/base/capture_data.h" #include "remoting/base/types.h" @@ -138,7 +138,7 @@ class Capturer { InvalidRects inval_rects_; // A lock protecting |inval_rects_| across threads. - Lock inval_rects_lock_; + base::Lock inval_rects_lock_; }; } // namespace remoting diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc index a06098c..45be613 100644 --- a/remoting/host/chromoting_host.cc +++ b/remoting/host/chromoting_host.cc @@ -70,7 +70,7 @@ void ChromotingHost::Start(Task* shutdown_task) { // Make sure this object is not started. { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (state_ != kInitial) return; state_ = kStarted; @@ -113,7 +113,7 @@ void ChromotingHost::Shutdown() { // No-op if this object is not started yet. { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (state_ != kStarted) { state_ = kStopped; return; @@ -264,7 +264,7 @@ void ChromotingHost::OnStateChange(JingleClient* jingle_client, void ChromotingHost::OnNewClientSession( protocol::Session* session, protocol::SessionManager::IncomingSessionResponse* response) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // TODO(hclam): Allow multiple clients to connect to the host. if (connection_.get() || state_ != kStarted) { *response = protocol::SessionManager::DECLINE; diff --git a/remoting/host/chromoting_host.h b/remoting/host/chromoting_host.h index bc470e7..33680a6 100644 --- a/remoting/host/chromoting_host.h +++ b/remoting/host/chromoting_host.h @@ -174,7 +174,7 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>, State state_; // Lock is to lock the access to |state_|. - Lock lock_; + base::Lock lock_; // Configuration of the protocol. scoped_ptr<protocol::CandidateSessionConfig> protocol_config_; diff --git a/remoting/host/in_memory_host_config.cc b/remoting/host/in_memory_host_config.cc index 7827b8f..253b563 100644 --- a/remoting/host/in_memory_host_config.cc +++ b/remoting/host/in_memory_host_config.cc @@ -17,12 +17,12 @@ InMemoryHostConfig::~InMemoryHostConfig() {} bool InMemoryHostConfig::GetString(const std::string& path, std::string* out_value) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return values_->GetString(path, out_value); } bool InMemoryHostConfig::GetBoolean(const std::string& path, bool* out_value) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return values_->GetBoolean(path, out_value); } @@ -32,12 +32,12 @@ void InMemoryHostConfig::Save() { void InMemoryHostConfig::SetString(const std::string& path, const std::string& in_value) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); values_->SetString(path, in_value); } void InMemoryHostConfig::SetBoolean(const std::string& path, bool in_value) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); values_->SetBoolean(path, in_value); } diff --git a/remoting/host/in_memory_host_config.h b/remoting/host/in_memory_host_config.h index 1078c50..998580a 100644 --- a/remoting/host/in_memory_host_config.h +++ b/remoting/host/in_memory_host_config.h @@ -7,9 +7,9 @@ #include <string> -#include "base/lock.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "remoting/host/host_config.h" class DictionaryValue; @@ -34,7 +34,7 @@ class InMemoryHostConfig : public MutableHostConfig { protected: // |lock_| must be locked whenever |values_| is used. - Lock lock_; + base::Lock lock_; scoped_ptr<DictionaryValue> values_; private: diff --git a/remoting/host/json_host_config.cc b/remoting/host/json_host_config.cc index ab639f0..36b39f2e 100644 --- a/remoting/host/json_host_config.cc +++ b/remoting/host/json_host_config.cc @@ -8,6 +8,7 @@ #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/message_loop_proxy.h" +#include "base/synchronization/lock.h" #include "base/task.h" #include "base/values.h" @@ -35,7 +36,7 @@ bool JsonHostConfig::Read() { } DictionaryValue* dictionary = static_cast<DictionaryValue*>(value.release()); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); values_.reset(dictionary); return true; } @@ -47,7 +48,7 @@ void JsonHostConfig::Save() { void JsonHostConfig::DoWrite() { std::string file_content; - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); base::JSONWriter::Write(values_.get(), true, &file_content); // TODO(sergeyu): Move ImportantFileWriter to base and use it here. file_util::WriteFile(filename_, file_content.c_str(), file_content.size()); diff --git a/remoting/host/json_host_config.h b/remoting/host/json_host_config.h index b4e2912..d9f233b 100644 --- a/remoting/host/json_host_config.h +++ b/remoting/host/json_host_config.h @@ -8,7 +8,6 @@ #include <string> #include "base/file_path.h" -#include "base/lock.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "remoting/host/in_memory_host_config.h" diff --git a/remoting/jingle_glue/jingle_client.cc b/remoting/jingle_glue/jingle_client.cc index 6484e5a..7b00d79 100644 --- a/remoting/jingle_glue/jingle_client.cc +++ b/remoting/jingle_glue/jingle_client.cc @@ -32,7 +32,7 @@ JingleClient::JingleClient(JingleThread* thread) } JingleClient::~JingleClient() { - AutoLock auto_lock(state_lock_); + base::AutoLock auto_lock(state_lock_); DCHECK(!initialized_ || closed_); } @@ -42,7 +42,7 @@ void JingleClient::Init( DCHECK_NE(username, ""); { - AutoLock auto_lock(state_lock_); + base::AutoLock auto_lock(state_lock_); DCHECK(!initialized_ && !closed_); initialized_ = true; @@ -101,7 +101,7 @@ void JingleClient::Close() { void JingleClient::Close(Task* closed_task) { { - AutoLock auto_lock(state_lock_); + base::AutoLock auto_lock(state_lock_); // If the client is already closed then don't close again. if (closed_) { if (closed_task) @@ -137,7 +137,7 @@ void JingleClient::DoClose() { } std::string JingleClient::GetFullJid() { - AutoLock auto_lock(full_jid_lock_); + base::AutoLock auto_lock(full_jid_lock_); return full_jid_; } @@ -179,7 +179,7 @@ void JingleClient::OnConnectionStateChanged(buzz::XmppEngine::State state) { } void JingleClient::SetFullJid(const std::string& full_jid) { - AutoLock auto_lock(full_jid_lock_); + base::AutoLock auto_lock(full_jid_lock_); full_jid_ = full_jid; } @@ -189,7 +189,7 @@ void JingleClient::UpdateState(State new_state) { { // We have to have the lock held, otherwise we cannot be sure that // the client hasn't been closed when we call the callback. - AutoLock auto_lock(state_lock_); + base::AutoLock auto_lock(state_lock_); if (!closed_) callback_->OnStateChange(this, new_state); } diff --git a/remoting/jingle_glue/jingle_client.h b/remoting/jingle_glue/jingle_client.h index 1d0920a..173e90e 100644 --- a/remoting/jingle_glue/jingle_client.h +++ b/remoting/jingle_glue/jingle_client.h @@ -7,8 +7,8 @@ #include <string> -#include "base/lock.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #include "third_party/libjingle/source/talk/xmpp/xmppclient.h" class MessageLoop; @@ -123,11 +123,12 @@ class JingleClient : public base::RefCountedThreadSafe<JingleClient>, // The XmppClient and its state and jid. buzz::XmppClient* client_; State state_; - Lock full_jid_lock_; + base::Lock full_jid_lock_; std::string full_jid_; // Current state of the object. - Lock state_lock_; // Must be locked when accessing initialized_ or closed_. + // Must be locked when accessing initialized_ or closed_. + base::Lock state_lock_; bool initialized_; bool closed_; scoped_ptr<Task> closed_task_; diff --git a/remoting/protocol/buffered_socket_writer.cc b/remoting/protocol/buffered_socket_writer.cc index 11b8395..db069b2 100644 --- a/remoting/protocol/buffered_socket_writer.cc +++ b/remoting/protocol/buffered_socket_writer.cc @@ -48,7 +48,7 @@ BufferedSocketWriterBase::~BufferedSocketWriterBase() { } void BufferedSocketWriterBase::Init(net::Socket* socket, WriteFailedCallback* callback) { // TODO(garykac) Save copy of WriteFailedCallback. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); message_loop_ = MessageLoop::current(); socket_ = socket; DCHECK(socket_); @@ -56,7 +56,7 @@ void BufferedSocketWriterBase::Init(net::Socket* socket, bool BufferedSocketWriterBase::Write( scoped_refptr<net::IOBufferWithSize> data, Task* done_task) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (!socket_) return false; queue_.push_back(new PendingPacket(data, done_task)); @@ -76,7 +76,7 @@ void BufferedSocketWriterBase::DoWrite() { // Don't write after Close(). { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (closed_) return; } @@ -85,7 +85,7 @@ void BufferedSocketWriterBase::DoWrite() { net::IOBuffer* current_packet; int current_packet_size; { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); GetNextPacket_Locked(¤t_packet, ¤t_packet_size); } @@ -96,7 +96,7 @@ void BufferedSocketWriterBase::DoWrite() { int result = socket_->Write(current_packet, current_packet_size, &written_callback_); if (result >= 0) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); AdvanceBufferPosition_Locked(result); } else { if (result == net::ERR_IO_PENDING) { @@ -123,7 +123,7 @@ void BufferedSocketWriterBase::OnWritten(int result) { } { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); AdvanceBufferPosition_Locked(result); } @@ -133,7 +133,7 @@ void BufferedSocketWriterBase::OnWritten(int result) { } void BufferedSocketWriterBase::HandleError(int result) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); closed_ = true; STLDeleteElements(&queue_); @@ -142,17 +142,17 @@ void BufferedSocketWriterBase::HandleError(int result) { } int BufferedSocketWriterBase::GetBufferSize() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return buffer_size_; } int BufferedSocketWriterBase::GetBufferChunks() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); return queue_.size(); } void BufferedSocketWriterBase::Close() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); closed_ = true; } diff --git a/remoting/protocol/buffered_socket_writer.h b/remoting/protocol/buffered_socket_writer.h index 3ea127e..1560b0f 100644 --- a/remoting/protocol/buffered_socket_writer.h +++ b/remoting/protocol/buffered_socket_writer.h @@ -7,8 +7,8 @@ #include <list> -#include "base/lock.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #include "net/base/io_buffer.h" #include "net/socket/socket.h" @@ -86,7 +86,7 @@ class BufferedSocketWriterBase void HandleError(int result); // Must be locked when accessing |socket_|, |queue_| and |buffer_size_|; - Lock lock_; + base::Lock lock_; net::Socket* socket_; MessageLoop* message_loop_; diff --git a/remoting/protocol/jingle_session.h b/remoting/protocol/jingle_session.h index f8689cc..94c28f6 100644 --- a/remoting/protocol/jingle_session.h +++ b/remoting/protocol/jingle_session.h @@ -6,7 +6,6 @@ #define REMOTING_PROTOCOL_JINGLE_SESSION_H_ #include "base/crypto/rsa_private_key.h" -#include "base/lock.h" #include "base/ref_counted.h" #include "net/base/completion_callback.h" #include "remoting/protocol/session.h" diff --git a/remoting/protocol/jingle_session_manager.h b/remoting/protocol/jingle_session_manager.h index 3656e05..344095b 100644 --- a/remoting/protocol/jingle_session_manager.h +++ b/remoting/protocol/jingle_session_manager.h @@ -8,7 +8,6 @@ #include <list> #include <string> -#include "base/lock.h" #include "base/ref_counted.h" #include "net/base/x509_certificate.h" #include "remoting/protocol/jingle_session.h" diff --git a/remoting/protocol/protocol_test_client.cc b/remoting/protocol/protocol_test_client.cc index 6486331..5f64aa4 100644 --- a/remoting/protocol/protocol_test_client.cc +++ b/remoting/protocol/protocol_test_client.cc @@ -114,7 +114,7 @@ class ProtocolTestClient scoped_refptr<JingleClient> client_; scoped_refptr<JingleSessionManager> session_manager_; ConnectionsList connections_; - Lock connections_lock_; + base::Lock connections_lock_; base::WaitableEvent closed_event_; }; @@ -236,7 +236,7 @@ void ProtocolTestClient::Run(const std::string& username, std::getline(std::cin, line); { - AutoLock auto_lock(connections_lock_); + base::AutoLock auto_lock(connections_lock_); // Broadcast message to all clients. for (ConnectionsList::iterator it = connections_.begin(); @@ -309,7 +309,7 @@ void ProtocolTestClient::OnNewSession( session->SetStateChangeCallback( NewCallback(test_connection, &ProtocolTestConnection::OnStateChange)); test_connection->Init(session); - AutoLock auto_lock(connections_lock_); + base::AutoLock auto_lock(connections_lock_); connections_.push_back(make_scoped_refptr(test_connection)); } @@ -320,7 +320,7 @@ void ProtocolTestClient::OnFinishedClosing() { void ProtocolTestClient::DestroyConnection( scoped_refptr<ProtocolTestConnection> connection) { connection->Close(); - AutoLock auto_lock(connections_lock_); + base::AutoLock auto_lock(connections_lock_); for (ConnectionsList::iterator it = connections_.begin(); it != connections_.end(); ++it) { if ((*it) == connection) { diff --git a/skia/ext/SkThread_chrome.cc b/skia/ext/SkThread_chrome.cc index 98375fa..948cf1f 100644 --- a/skia/ext/SkThread_chrome.cc +++ b/skia/ext/SkThread_chrome.cc @@ -8,8 +8,8 @@ #include "base/atomicops.h" #include "base/basictypes.h" -#include "base/lock.h" #include "base/logging.h" +#include "base/synchronization/lock.h" int32_t sk_atomic_inc(int32_t* addr) { // sk_atomic_inc is expected to return the old value, Barrier_AtomicIncrement @@ -24,22 +24,22 @@ int32_t sk_atomic_dec(int32_t* addr) { } SkMutex::SkMutex(bool isGlobal) : fIsGlobal(isGlobal) { - COMPILE_ASSERT(sizeof(Lock) <= sizeof(fStorage), Lock_is_too_big_for_SkMutex); - Lock* lock = reinterpret_cast<Lock*>(fStorage); - new(lock) Lock(); + COMPILE_ASSERT(sizeof(base::Lock) <= sizeof(fStorage), Lock_is_too_big_for_SkMutex); + base::Lock* lock = reinterpret_cast<base::Lock*>(fStorage); + new(lock) base::Lock(); } SkMutex::~SkMutex() { - Lock* lock = reinterpret_cast<Lock*>(fStorage); + base::Lock* lock = reinterpret_cast<base::Lock*>(fStorage); lock->~Lock(); } void SkMutex::acquire() { - Lock* lock = reinterpret_cast<Lock*>(fStorage); + base::Lock* lock = reinterpret_cast<base::Lock*>(fStorage); lock->Acquire(); } void SkMutex::release() { - Lock* lock = reinterpret_cast<Lock*>(fStorage); + base::Lock* lock = reinterpret_cast<base::Lock*>(fStorage); lock->Release(); } diff --git a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/mutex.h b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/mutex.h index b99dcee..4d64f0f 100644 --- a/third_party/cacheinvalidation/overrides/google/cacheinvalidation/mutex.h +++ b/third_party/cacheinvalidation/overrides/google/cacheinvalidation/mutex.h @@ -5,19 +5,19 @@ #ifndef GOOGLE_CACHEINVALIDATION_MUTEX_H_ #define GOOGLE_CACHEINVALIDATION_MUTEX_H_ -#include "base/lock.h" #include "base/logging.h" +#include "base/synchronization/lock.h" namespace invalidation { -typedef ::Lock Mutex; +typedef base::Lock Mutex; class MutexLock { public: explicit MutexLock(Mutex* m) : auto_lock_(*m) {} private: - AutoLock auto_lock_; + base::AutoLock auto_lock_; DISALLOW_COPY_AND_ASSIGN(MutexLock); }; diff --git a/tools/memory_watcher/call_stack.cc b/tools/memory_watcher/call_stack.cc index 15ca917..93d941e 100644 --- a/tools/memory_watcher/call_stack.cc +++ b/tools/memory_watcher/call_stack.cc @@ -71,7 +71,7 @@ static void UltraSafeDebugBreak() { // static bool CallStack::LoadDbgHelp() { if (!dbghelp_loaded_) { - AutoLock Lock(dbghelp_lock_); + base::AutoLock Lock(dbghelp_lock_); // Re-check if we've loaded successfully now that we have the lock. if (dbghelp_loaded_) @@ -289,7 +289,7 @@ void CallStack::ToString(PrivateAllocatorString* output) { return; } - AutoLock lock(dbghelp_lock_); + base::AutoLock lock(dbghelp_lock_); // Iterate through each frame in the call stack. for (int32 index = 0; index < frame_count_; index++) { @@ -379,7 +379,7 @@ AllocationStack* AllocationStack::freelist_ = NULL; void* AllocationStack::operator new(size_t size) { DCHECK(size == sizeof(AllocationStack)); { - AutoLock lock(freelist_lock_); + base::AutoLock lock(freelist_lock_); if (freelist_ != NULL) { AllocationStack* stack = freelist_; freelist_ = freelist_->next_; @@ -392,7 +392,7 @@ void* AllocationStack::operator new(size_t size) { void AllocationStack::operator delete(void* ptr) { AllocationStack *stack = reinterpret_cast<AllocationStack*>(ptr); - AutoLock lock(freelist_lock_); + base::AutoLock lock(freelist_lock_); DCHECK(stack->next_ == NULL); stack->next_ = freelist_; freelist_ = stack; diff --git a/tools/memory_watcher/call_stack.h b/tools/memory_watcher/call_stack.h index 12a0114..941aad4 100644 --- a/tools/memory_watcher/call_stack.h +++ b/tools/memory_watcher/call_stack.h @@ -17,8 +17,8 @@ #include <map> #include <string> -#include "base/lock.h" #include "base/logging.h" +#include "base/synchronization/lock.h" #include "tools/memory_watcher/memory_watcher.h" // The CallStack Class @@ -110,7 +110,7 @@ class CallStack { // dbghelp_lock_ is used to serialize access across all calls to the DbgHelp // library. This may be overly conservative (serializing them all together), // but does guarantee correctness. - static Lock dbghelp_lock_; + static base::Lock dbghelp_lock_; // Record the fact that dbghelp has been loaded. // Changes to this variable are protected by dbghelp_lock_. @@ -160,7 +160,7 @@ class AllocationStack : public CallStack { AllocationStack* next_; // Pointer used when on the freelist. int32 size_; // Size of block allocated. static AllocationStack* freelist_; - static Lock freelist_lock_; + static base::Lock freelist_lock_; DISALLOW_COPY_AND_ASSIGN(AllocationStack); }; diff --git a/tools/memory_watcher/memory_hook.cc b/tools/memory_watcher/memory_hook.cc index 2340d84..0c0a05d 100644 --- a/tools/memory_watcher/memory_hook.cc +++ b/tools/memory_watcher/memory_hook.cc @@ -290,7 +290,7 @@ static LPVOID WINAPI Perftools_MapViewOfFileEx(HANDLE hFileMappingObject, dwFileOffsetHigh, dwFileOffsetLow, dwNumberOfBytesToMap, lpBaseAddress); { - AutoLock lock(known_maps_lock); + base::AutoLock lock(known_maps_lock); MEMORY_BASIC_INFORMATION info; if (known_maps.find(result) == known_maps.end()) { CHECK(VirtualQuery(result, &info, sizeof(info))); @@ -326,7 +326,7 @@ static DWORD WINAPI Perftools_NtUnmapViewOfSection(HANDLE process, // than calling UnmapViewOfFile. If we didn't trap this function, // then we appear to have bogus leaks. { - AutoLock lock(known_maps_lock); + base::AutoLock lock(known_maps_lock); MEMORY_BASIC_INFORMATION info; CHECK(VirtualQuery(lpBaseAddress, &info, sizeof(info))); if (known_maps.find(lpBaseAddress) != known_maps.end()) { diff --git a/tools/memory_watcher/memory_watcher.cc b/tools/memory_watcher/memory_watcher.cc index 5ff8dae..29053f0 100644 --- a/tools/memory_watcher/memory_watcher.cc +++ b/tools/memory_watcher/memory_watcher.cc @@ -8,10 +8,10 @@ #include "tools/memory_watcher/memory_watcher.h" #include "base/file_util.h" -#include "base/lock.h" #include "base/logging.h" #include "base/metrics/stats_counters.h" #include "base/string_util.h" +#include "base/synchronization/lock.h" #include "base/utf_string_conversions.h" #include "tools/memory_watcher/call_stack.h" #include "tools/memory_watcher/preamble_patcher.h" @@ -107,7 +107,7 @@ void MemoryWatcher::OnTrack(HANDLE heap, int32 id, int32 size) { if (!stack->Valid()) return; // Recursion blocked generation of stack. { - AutoLock lock(block_map_lock_); + base::AutoLock lock(block_map_lock_); // Ideally, we'd like to verify that the block being added // here is not already in our list of tracked blocks. However, @@ -151,7 +151,7 @@ void MemoryWatcher::OnUntrack(HANDLE heap, int32 id, int32 size) { return; { - AutoLock lock(block_map_lock_); + base::AutoLock lock(block_map_lock_); active_thread_id_ = GetCurrentThreadId(); // First, find the block in our block_map. @@ -197,7 +197,7 @@ void MemoryWatcher::DumpLeaks() { return; Unhook(); - AutoLock lock(block_map_lock_); + base::AutoLock lock(block_map_lock_); active_thread_id_ = GetCurrentThreadId(); OpenLogFile(); diff --git a/tools/memory_watcher/memory_watcher.h b/tools/memory_watcher/memory_watcher.h index 8cee2b80..8f5f1c2 100644 --- a/tools/memory_watcher/memory_watcher.h +++ b/tools/memory_watcher/memory_watcher.h @@ -14,7 +14,7 @@ #include <map> #include <functional> -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "tools/memory_watcher/memory_hook.h" class CallStack; @@ -76,7 +76,7 @@ class MemoryWatcher : MemoryObserver { // a stack track. Used to avoid recursive tracking. DWORD active_thread_id_; - Lock block_map_lock_; + base::Lock block_map_lock_; // The block_map provides quick lookups based on the allocation // pointer. This is important for having fast round trips through // malloc/free. diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc index 94885b0..6f93748 100644 --- a/ui/base/resource/resource_bundle.cc +++ b/ui/base/resource/resource_bundle.cc @@ -4,10 +4,10 @@ #include "ui/base/resource/resource_bundle.h" -#include "base/lock.h" #include "base/logging.h" #include "base/stl_util-inl.h" #include "base/string_piece.h" +#include "base/synchronization/lock.h" #include "build/build_config.h" #include "gfx/codec/png_codec.h" #include "gfx/font.h" @@ -96,7 +96,7 @@ ResourceBundle& ResourceBundle::GetSharedInstance() { SkBitmap* ResourceBundle::GetBitmapNamed(int resource_id) { // Check to see if we already have the Skia image in the cache. { - AutoLock lock_scope(*lock_); + base::AutoLock lock_scope(*lock_); SkImageMap::const_iterator found = skia_images_.find(resource_id); if (found != skia_images_.end()) return found->second; @@ -108,7 +108,7 @@ SkBitmap* ResourceBundle::GetBitmapNamed(int resource_id) { if (bitmap.get()) { // We loaded successfully. Cache the Skia version of the bitmap. - AutoLock lock_scope(*lock_); + base::AutoLock lock_scope(*lock_); // Another thread raced us, and has already cached the skia image. if (skia_images_.count(resource_id)) @@ -123,7 +123,7 @@ SkBitmap* ResourceBundle::GetBitmapNamed(int resource_id) { LOG(WARNING) << "Unable to load bitmap with id " << resource_id; NOTREACHED(); // Want to assert in debug mode. - AutoLock lock_scope(*lock_); // Guard empty_bitmap initialization. + base::AutoLock lock_scope(*lock_); // Guard empty_bitmap initialization. static SkBitmap* empty_bitmap = NULL; if (!empty_bitmap) { @@ -183,7 +183,7 @@ gfx::NativeImage ResourceBundle::GetNativeImageNamed(int resource_id) { } ResourceBundle::ResourceBundle() - : lock_(new Lock), + : lock_(new base::Lock), resources_data_(NULL), locale_resources_data_(NULL) { } @@ -195,7 +195,7 @@ void ResourceBundle::FreeImages() { } void ResourceBundle::LoadFontsIfNecessary() { - AutoLock lock_scope(*lock_); + base::AutoLock lock_scope(*lock_); if (!base_font_.get()) { base_font_.reset(new gfx::Font()); diff --git a/ui/base/resource/resource_bundle_dummy.cc b/ui/base/resource/resource_bundle_dummy.cc index fc46ace..653d9f0 100644 --- a/ui/base/resource/resource_bundle_dummy.cc +++ b/ui/base/resource/resource_bundle_dummy.cc @@ -6,8 +6,8 @@ #include <windows.h> -#include "base/lock.h" #include "base/logging.h" +#include "base/synchronization/lock.h" #include "gfx/font.h" #include "gfx/platform_font_win.h" @@ -51,7 +51,7 @@ ResourceBundle& ResourceBundle::GetSharedInstance() { } ResourceBundle::ResourceBundle() - : lock_(new Lock), + : lock_(new base::Lock), resources_data_(NULL), locale_resources_data_(NULL) { } diff --git a/ui/base/resource/resource_bundle_linux.cc b/ui/base/resource/resource_bundle_linux.cc index 92a39df..8bef0a2 100644 --- a/ui/base/resource/resource_bundle_linux.cc +++ b/ui/base/resource/resource_bundle_linux.cc @@ -10,11 +10,11 @@ #include "base/file_path.h" #include "base/file_util.h" #include "base/i18n/rtl.h" -#include "base/lock.h" #include "base/logging.h" #include "base/path_service.h" #include "base/string_piece.h" #include "base/string_util.h" +#include "base/synchronization/lock.h" #include "gfx/font.h" #include "gfx/gtk_util.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -92,7 +92,7 @@ GdkPixbuf* ResourceBundle::GetPixbufImpl(int resource_id, bool rtl_enabled) { // Check to see if we already have the pixbuf in the cache. { - AutoLock lock_scope(*lock_); + base::AutoLock lock_scope(*lock_); GdkPixbufMap::const_iterator found = gdk_pixbufs_.find(key); if (found != gdk_pixbufs_.end()) return found->second; @@ -104,7 +104,7 @@ GdkPixbuf* ResourceBundle::GetPixbufImpl(int resource_id, bool rtl_enabled) { // We loaded successfully. Cache the pixbuf. if (pixbuf) { - AutoLock lock_scope(*lock_); + base::AutoLock lock_scope(*lock_); // Another thread raced us, and has already cached the pixbuf. if (gdk_pixbufs_.count(key)) { @@ -121,7 +121,7 @@ GdkPixbuf* ResourceBundle::GetPixbufImpl(int resource_id, bool rtl_enabled) { LOG(WARNING) << "Unable to load GdkPixbuf with id " << resource_id; NOTREACHED(); // Want to assert in debug mode. - AutoLock lock_scope(*lock_); // Guard empty_bitmap initialization. + base::AutoLock lock_scope(*lock_); // Guard empty_bitmap initialization. static GdkPixbuf* empty_bitmap = NULL; if (!empty_bitmap) { diff --git a/ui/base/resource/resource_bundle_posix.cc b/ui/base/resource/resource_bundle_posix.cc index 119d721..277974d 100644 --- a/ui/base/resource/resource_bundle_posix.cc +++ b/ui/base/resource/resource_bundle_posix.cc @@ -5,11 +5,11 @@ #include "ui/base/resource/resource_bundle.h" #include "app/l10n_util.h" -#include "base/lock.h" #include "base/logging.h" #include "base/stl_util-inl.h" #include "base/string16.h" #include "base/string_piece.h" +#include "base/synchronization/lock.h" #include "gfx/font.h" #include "ui/base/resource/data_pack.h" diff --git a/ui/base/resource/resource_bundle_win.cc b/ui/base/resource/resource_bundle_win.cc index 9f590d5..629265a 100644 --- a/ui/base/resource/resource_bundle_win.cc +++ b/ui/base/resource/resource_bundle_win.cc @@ -9,12 +9,12 @@ #include "app/l10n_util.h" #include "base/debug/stack_trace.h" #include "base/file_util.h" -#include "base/lock.h" #include "base/logging.h" #include "base/path_service.h" #include "base/resource_util.h" #include "base/stl_util-inl.h" #include "base/string_piece.h" +#include "base/synchronization/lock.h" #include "base/win/windows_version.h" #include "gfx/font.h" #include "ui/base/ui_base_paths.h" diff --git a/webkit/glue/media/buffered_data_source.cc b/webkit/glue/media/buffered_data_source.cc index b6efa16..d7a2f47 100644 --- a/webkit/glue/media/buffered_data_source.cc +++ b/webkit/glue/media/buffered_data_source.cc @@ -115,7 +115,7 @@ bool BufferedDataSource::IsUrlSupported(const std::string& url) { void BufferedDataSource::Stop(media::FilterCallback* callback) { { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); stop_signal_received_ = true; } if (callback) { @@ -166,7 +166,7 @@ void BufferedDataSource::Abort() { // If we are told to abort, immediately return from any pending read // with an error. if (read_callback_.get()) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DoneRead_Locked(net::ERR_FAILED); } @@ -414,7 +414,7 @@ void BufferedDataSource::HttpInitialStartCallback(int error) { // let tasks on render thread to run but make sure they don't call outside // this object when Stop() method is ever called. Locking this method is safe // because |lock_| is only acquired in tasks on render thread. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stop_signal_received_) return; @@ -465,7 +465,7 @@ void BufferedDataSource::NonHttpInitialStartCallback(int error) { // let tasks on render thread to run but make sure they don't call outside // this object when Stop() method is ever called. Locking this method is safe // because |lock_| is only acquired in tasks on render thread. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stop_signal_received_) return; @@ -504,7 +504,7 @@ void BufferedDataSource::PartialReadStartCallback(int error) { // let tasks on render thread to run but make sure they don't call outside // this object when Stop() method is ever called. Locking this method is // safe because |lock_| is only acquired in tasks on render thread. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stop_signal_received_) return; DoneRead_Locked(net::ERR_INVALID_RESPONSE); @@ -534,7 +534,7 @@ void BufferedDataSource::ReadCallback(int error) { // let tasks on render thread to run but make sure they don't call outside // this object when Stop() method is ever called. Locking this method is safe // because |lock_| is only acquired in tasks on render thread. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stop_signal_received_) return; @@ -570,7 +570,7 @@ void BufferedDataSource::NetworkEventCallback() { // let tasks on render thread to run but make sure they don't call outside // this object when Stop() method is ever called. Locking this method is safe // because |lock_| is only acquired in tasks on render thread. - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (stop_signal_received_) return; diff --git a/webkit/glue/media/buffered_data_source.h b/webkit/glue/media/buffered_data_source.h index 1c4e3fa..c40b480 100644 --- a/webkit/glue/media/buffered_data_source.h +++ b/webkit/glue/media/buffered_data_source.h @@ -8,8 +8,8 @@ #include <string> #include "base/callback.h" -#include "base/lock.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "webkit/glue/media/buffered_resource_loader.h" namespace webkit_glue { @@ -175,7 +175,7 @@ class BufferedDataSource : public WebDataSource { MessageLoop* render_loop_; // Protects |stopped_|. - Lock lock_; + base::Lock lock_; // Stop signal to suppressing activities. This variable is set on the pipeline // thread and read from the render thread. diff --git a/webkit/glue/media/buffered_resource_loader.h b/webkit/glue/media/buffered_resource_loader.h index df57612..80e9632 100644 --- a/webkit/glue/media/buffered_resource_loader.h +++ b/webkit/glue/media/buffered_resource_loader.h @@ -8,7 +8,6 @@ #include <string> #include "base/callback.h" -#include "base/lock.h" #include "base/scoped_ptr.h" #include "base/timer.h" #include "googleurl/src/gurl.h" diff --git a/webkit/glue/media/simple_data_source.cc b/webkit/glue/media/simple_data_source.cc index bc2c20d..f4f92dd 100644 --- a/webkit/glue/media/simple_data_source.cc +++ b/webkit/glue/media/simple_data_source.cc @@ -35,12 +35,12 @@ SimpleDataSource::SimpleDataSource( } SimpleDataSource::~SimpleDataSource() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK(state_ == UNINITIALIZED || state_ == STOPPED); } void SimpleDataSource::Stop(media::FilterCallback* callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); state_ = STOPPED; if (callback) { callback->Run(); @@ -54,7 +54,7 @@ void SimpleDataSource::Stop(media::FilterCallback* callback) { void SimpleDataSource::Initialize(const std::string& url, media::FilterCallback* callback) { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK_EQ(state_, UNINITIALIZED); DCHECK(callback); state_ = INITIALIZING; @@ -157,7 +157,7 @@ void SimpleDataSource::didFinishLoading( WebKit::WebURLLoader* loader, double finishTime) { DCHECK(MessageLoop::current() == render_loop_); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // It's possible this gets called after Stop(), in which case |host_| is no // longer valid. if (state_ == STOPPED) @@ -179,7 +179,7 @@ void SimpleDataSource::didFail( WebKit::WebURLLoader* loader, const WebKit::WebURLError& error) { DCHECK(MessageLoop::current() == render_loop_); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // It's possible this gets called after Stop(), in which case |host_| is no // longer valid. if (state_ == STOPPED) @@ -217,7 +217,7 @@ void SimpleDataSource::SetURL(const GURL& url) { void SimpleDataSource::StartTask() { DCHECK(MessageLoop::current() == render_loop_); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); // We may have stopped. if (state_ == STOPPED) @@ -253,7 +253,7 @@ void SimpleDataSource::StartTask() { void SimpleDataSource::CancelTask() { DCHECK(MessageLoop::current() == render_loop_); - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); DCHECK_EQ(state_, STOPPED); // Cancel any pending requests. diff --git a/webkit/glue/media/simple_data_source.h b/webkit/glue/media/simple_data_source.h index 2e415f0..10d93ff 100644 --- a/webkit/glue/media/simple_data_source.h +++ b/webkit/glue/media/simple_data_source.h @@ -120,7 +120,7 @@ class SimpleDataSource : public WebDataSource, State state_; // Used for accessing |state_|. - Lock lock_; + base::Lock lock_; // Filter callbacks. scoped_ptr<media::FilterCallback> initialize_callback_; diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc index b4da504..c93fdfd 100644 --- a/webkit/glue/webkitclient_impl.cc +++ b/webkit/glue/webkitclient_impl.cc @@ -13,7 +13,6 @@ #include <vector> #include "base/debug/trace_event.h" -#include "base/lock.h" #include "base/message_loop.h" #include "base/metrics/stats_counters.h" #include "base/metrics/histogram.h" @@ -22,6 +21,7 @@ #include "base/singleton.h" #include "base/string_number_conversions.h" #include "base/string_util.h" +#include "base/synchronization/lock.h" #include "base/time.h" #include "base/utf_string_conversions.h" #include "grit/webkit_resources.h" @@ -78,7 +78,7 @@ class MemoryUsageCache { // Returns true if the cached value is fresh. // Returns false if the cached value is stale, or if |cached_value| is NULL. bool IsCachedValueValid(size_t* cached_value) { - AutoLock scoped_lock(lock_); + base::AutoLock scoped_lock(lock_); if (!cached_value) return false; if (base::Time::Now() - last_updated_time_ > cache_valid_time_) @@ -89,7 +89,7 @@ class MemoryUsageCache { // Setter for |memory_value_|, refreshes |last_updated_time_|. void SetMemoryValue(const size_t value) { - AutoLock scoped_lock(lock_); + base::AutoLock scoped_lock(lock_); memory_value_ = value; last_updated_time_ = base::Time::Now(); } @@ -104,7 +104,7 @@ class MemoryUsageCache { // The last time the cached value was updated. base::Time last_updated_time_; - Lock lock_; + base::Lock lock_; }; } // anonymous namespace diff --git a/webkit/glue/webmediaplayer_impl.cc b/webkit/glue/webmediaplayer_impl.cc index b97eb8d..b9df79d 100644 --- a/webkit/glue/webmediaplayer_impl.cc +++ b/webkit/glue/webmediaplayer_impl.cc @@ -80,7 +80,7 @@ WebMediaPlayerImpl::Proxy::~Proxy() { } void WebMediaPlayerImpl::Proxy::Repaint() { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); if (outstanding_repaints_ < kMaxOutstandingRepaints) { ++outstanding_repaints_; @@ -164,7 +164,7 @@ void WebMediaPlayerImpl::Proxy::NetworkEventCallback() { void WebMediaPlayerImpl::Proxy::RepaintTask() { DCHECK(MessageLoop::current() == render_loop_); { - AutoLock auto_lock(lock_); + base::AutoLock auto_lock(lock_); --outstanding_repaints_; DCHECK_GE(outstanding_repaints_, 0); } diff --git a/webkit/glue/webmediaplayer_impl.h b/webkit/glue/webmediaplayer_impl.h index 33cc7b2..d388aef 100644 --- a/webkit/glue/webmediaplayer_impl.h +++ b/webkit/glue/webmediaplayer_impl.h @@ -53,11 +53,11 @@ #ifndef WEBKIT_GLUE_WEBMEDIAPLAYER_IMPL_H_ #define WEBKIT_GLUE_WEBMEDIAPLAYER_IMPL_H_ -#include "base/lock.h" #include "base/message_loop.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "base/threading/thread.h" +#include "base/synchronization/lock.h" #include "base/synchronization/waitable_event.h" #include "gfx/rect.h" #include "gfx/size.h" @@ -149,7 +149,7 @@ class WebMediaPlayerImpl : public WebKit::WebMediaPlayer, scoped_refptr<WebDataSource> data_source_; scoped_refptr<WebVideoRenderer> video_renderer_; - Lock lock_; + base::Lock lock_; int outstanding_repaints_; }; diff --git a/webkit/plugins/npapi/plugin_list.cc b/webkit/plugins/npapi/plugin_list.cc index b2e236a..96912d9 100644 --- a/webkit/plugins/npapi/plugin_list.cc +++ b/webkit/plugins/npapi/plugin_list.cc @@ -182,25 +182,25 @@ bool PluginList::DebugPluginLoading() { } bool PluginList::PluginsLoaded() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); return plugins_loaded_; } void PluginList::RefreshPlugins() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); plugins_need_refresh_ = true; } void PluginList::AddExtraPluginPath(const FilePath& plugin_path) { // Chrome OS only loads plugins from /opt/google/chrome/plugins. #if !defined(OS_CHROMEOS) - AutoLock lock(lock_); + base::AutoLock lock(lock_); extra_plugin_paths_.push_back(plugin_path); #endif } void PluginList::RemoveExtraPluginPath(const FilePath& plugin_path) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); std::vector<FilePath>::iterator it = std::find(extra_plugin_paths_.begin(), extra_plugin_paths_.end(), plugin_path); @@ -211,7 +211,7 @@ void PluginList::RemoveExtraPluginPath(const FilePath& plugin_path) { void PluginList::AddExtraPluginDir(const FilePath& plugin_dir) { // Chrome OS only loads plugins from /opt/google/chrome/plugins. #if !defined(OS_CHROMEOS) - AutoLock lock(lock_); + base::AutoLock lock(lock_); extra_plugin_dirs_.push_back(plugin_dir); #endif } @@ -220,7 +220,7 @@ void PluginList::RegisterInternalPlugin(const WebPluginInfo& info) { PluginEntryPoints entry_points = {0}; InternalPlugin plugin = { info, entry_points }; - AutoLock lock(lock_); + base::AutoLock lock(lock_); internal_plugins_.push_back(plugin); } @@ -242,12 +242,12 @@ void PluginList::RegisterInternalPlugin(const FilePath& filename, plugin.entry_points = entry_points; - AutoLock lock(lock_); + base::AutoLock lock(lock_); internal_plugins_.push_back(plugin); } void PluginList::UnregisterInternalPlugin(const FilePath& path) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); for (size_t i = 0; i < internal_plugins_.size(); i++) { if (internal_plugins_[i].info.path == path) { internal_plugins_.erase(internal_plugins_.begin() + i); @@ -261,7 +261,7 @@ bool PluginList::ReadPluginInfo(const FilePath& filename, WebPluginInfo* info, const PluginEntryPoints** entry_points) { { - AutoLock lock(lock_); + base::AutoLock lock(lock_); for (size_t i = 0; i < internal_plugins_.size(); ++i) { if (filename == internal_plugins_[i].info.path) { *entry_points = &internal_plugins_[i].entry_points; @@ -331,7 +331,7 @@ PluginList::PluginList() } bool PluginList::ShouldDisableGroup(const string16& group_name) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (PluginGroup::IsPluginNameDisabledByPolicy(group_name)) { disabled_groups_.insert(group_name); return true; @@ -346,7 +346,7 @@ void PluginList::LoadPlugins(bool refresh) { std::vector<FilePath> extra_plugin_dirs; std::vector<InternalPlugin> internal_plugins; { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (plugins_loaded_ && !refresh && !plugins_need_refresh_) return; @@ -414,13 +414,13 @@ void PluginList::LoadPlugins(bool refresh) { group->DisableOutdatedPlugins(); } if (!group->Enabled()) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); disabled_groups_.insert(group_name); } } // Only update the data now since loading plugins can take a while. - AutoLock lock(lock_); + base::AutoLock lock(lock_); plugins_ = new_plugins; plugins_loaded_ = true; @@ -463,7 +463,7 @@ void PluginList::LoadPlugin(const FilePath& path, plugin_info.enabled = true; } - AutoLock lock(lock_); + base::AutoLock lock(lock_); plugins->push_back(plugin_info); AddToPluginGroups(plugin_info); } @@ -508,7 +508,7 @@ bool PluginList::SupportsExtension(const WebPluginInfo& info, void PluginList::GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins) { LoadPlugins(refresh); - AutoLock lock(lock_); + base::AutoLock lock(lock_); *plugins = plugins_; } @@ -517,7 +517,7 @@ void PluginList::GetEnabledPlugins(bool refresh, LoadPlugins(refresh); plugins->clear(); - AutoLock lock(lock_); + base::AutoLock lock(lock_); for (std::vector<WebPluginInfo>::const_iterator it = plugins_.begin(); it != plugins_.end(); ++it) { @@ -536,7 +536,7 @@ void PluginList::GetPluginInfoArray( DCHECK(info); LoadPlugins(false); - AutoLock lock(lock_); + base::AutoLock lock(lock_); info->clear(); if (actual_mime_types) actual_mime_types->clear(); @@ -636,7 +636,7 @@ bool PluginList::GetPluginInfo(const GURL& url, bool PluginList::GetPluginInfoByPath(const FilePath& plugin_path, WebPluginInfo* info) { LoadPlugins(false); - AutoLock lock(lock_); + base::AutoLock lock(lock_); for (size_t i = 0; i < plugins_.size(); ++i) { if (plugins_[i].path == plugin_path) { *info = plugins_[i]; @@ -662,7 +662,7 @@ void PluginList::GetPluginGroups( const PluginGroup* PluginList::GetPluginGroup( const WebPluginInfo& web_plugin_info) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); return AddToPluginGroups(web_plugin_info); } @@ -676,13 +676,13 @@ string16 PluginList::GetPluginGroupName(std::string identifier) { std::string PluginList::GetPluginGroupIdentifier( const WebPluginInfo& web_plugin_info) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); PluginGroup* group = AddToPluginGroups(web_plugin_info); return group->identifier(); } void PluginList::AddHardcodedPluginGroups() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); const PluginGroupDefinition* definitions = GetPluginGroupDefinitions(); for (size_t i = 0; i < GetPluginGroupDefinitionsSize(); ++i) { PluginGroup* definition_group = PluginGroup::FromPluginGroupDefinition( @@ -720,7 +720,7 @@ PluginGroup* PluginList::AddToPluginGroups( } bool PluginList::EnablePlugin(const FilePath& filename) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); bool did_enable = false; @@ -745,7 +745,7 @@ bool PluginList::EnablePlugin(const FilePath& filename) { } bool PluginList::DisablePlugin(const FilePath& filename) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); bool did_disable = false; @@ -771,7 +771,7 @@ bool PluginList::DisablePlugin(const FilePath& filename) { bool PluginList::EnableGroup(bool enable, const string16& group_name) { bool did_change = false; { - AutoLock lock(lock_); + base::AutoLock lock(lock_); std::set<string16>::iterator entry = disabled_groups_.find(group_name); if (enable) { diff --git a/webkit/plugins/npapi/plugin_list.h b/webkit/plugins/npapi/plugin_list.h index bf9865e..f0c269b 100644 --- a/webkit/plugins/npapi/plugin_list.h +++ b/webkit/plugins/npapi/plugin_list.h @@ -12,7 +12,7 @@ #include "base/basictypes.h" #include "base/file_path.h" #include "base/linked_ptr.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "third_party/npapi/bindings/nphostapi.h" #include "webkit/plugins/npapi/plugin_group.h" #include "webkit/plugins/npapi/webplugininfo.h" @@ -329,7 +329,7 @@ class PluginList { // Need synchronization for the above members since this object can be // accessed on multiple threads. - Lock lock_; + base::Lock lock_; friend struct base::DefaultLazyInstanceTraits<PluginList>; diff --git a/webkit/tools/test_shell/simple_database_system.cc b/webkit/tools/test_shell/simple_database_system.cc index d407359..dc80f69 100644 --- a/webkit/tools/test_shell/simple_database_system.cc +++ b/webkit/tools/test_shell/simple_database_system.cc @@ -175,7 +175,7 @@ void SimpleDatabaseSystem::SetFullFilePathsForVfsFile( FilePath file_name = DatabaseUtil::GetFullFilePathForVfsFile(db_tracker_, vfs_file_name); - AutoLock file_names_auto_lock(file_names_lock_); + base::AutoLock file_names_auto_lock(file_names_lock_); file_names_[vfs_file_name] = file_name; file_names_[vfs_file_name + ASCIIToUTF16("-journal")] = FilePath::FromWStringHack(file_name.ToWStringHack() + @@ -187,7 +187,7 @@ FilePath SimpleDatabaseSystem::GetFullFilePathForVfsFile( if (vfs_file_name.empty()) // temp file, used for vacuuming return FilePath(); - AutoLock file_names_auto_lock(file_names_lock_); + base::AutoLock file_names_auto_lock(file_names_lock_); DCHECK(file_names_.find(vfs_file_name) != file_names_.end()); return file_names_[vfs_file_name]; } diff --git a/webkit/tools/test_shell/simple_database_system.h b/webkit/tools/test_shell/simple_database_system.h index 74214e8..7efe072 100644 --- a/webkit/tools/test_shell/simple_database_system.h +++ b/webkit/tools/test_shell/simple_database_system.h @@ -7,11 +7,11 @@ #include "base/file_path.h" #include "base/hash_tables.h" -#include "base/lock.h" #include "base/platform_file.h" #include "base/ref_counted.h" #include "base/scoped_temp_dir.h" #include "base/string16.h" +#include "base/synchronization/lock.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabaseObserver.h" #include "webkit/database/database_connections.h" #include "webkit/database/database_tracker.h" @@ -75,7 +75,7 @@ class SimpleDatabaseSystem : public webkit_database::DatabaseTracker::Observer, scoped_refptr<webkit_database::DatabaseTracker> db_tracker_; - Lock file_names_lock_; + base::Lock file_names_lock_; base::hash_map<string16, FilePath> file_names_; webkit_database::DatabaseConnections database_connections_; |