summaryrefslogtreecommitdiffstats
path: root/base/threading
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-21 04:55:52 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-21 04:55:52 +0000
commit20305ec6f1acf21392c2f3938a14a96f1e28e76d (patch)
tree6eff1f7be4bad1a1362d3466f0ac59292dc51acc /base/threading
parentc6e8346b56ab61b35845aefcf9b241c654fe1253 (diff)
downloadchromium_src-20305ec6f1acf21392c2f3938a14a96f1e28e76d.zip
chromium_src-20305ec6f1acf21392c2f3938a14a96f1e28e76d.tar.gz
chromium_src-20305ec6f1acf21392c2f3938a14a96f1e28e76d.tar.bz2
Remove obsolete base/lock.h and fix up callers to use the new header file and
the base namespace. Fix several files including lock.h unnecessarily. BUG=none TEST=none Original review=http://codereview.chromium.org/6142009/ Patch by leviw@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72106 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/threading')
-rw-r--r--base/threading/simple_thread.h4
-rw-r--r--base/threading/thread_checker.h4
-rw-r--r--base/threading/thread_collision_warner_unittest.cc24
-rw-r--r--base/threading/worker_pool_posix_unittest.cc14
4 files changed, 23 insertions, 23 deletions
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();