summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
Diffstat (limited to 'base')
-rw-r--r--base/base.gyp8
-rw-r--r--base/base.gypi16
-rw-r--r--base/lazy_instance_unittest.cc2
-rw-r--r--base/metrics/stats_table_unittest.cc6
-rw-r--r--base/non_thread_safe_unittest.cc2
-rw-r--r--base/thread_checker_unittest.cc2
-rw-r--r--base/thread_collision_warner_unittest.cc2
-rw-r--r--base/thread_local_storage_unittest.cc2
-rw-r--r--base/thread_local_unittest.cc4
-rw-r--r--base/threading/simple_thread.cc (renamed from base/simple_thread.cc)4
-rw-r--r--base/threading/simple_thread.h (renamed from base/simple_thread.h)8
-rw-r--r--base/threading/simple_thread_unittest.cc (renamed from base/simple_thread_unittest.cc)54
-rw-r--r--base/threading/watchdog.cc (renamed from base/watchdog.cc)10
-rw-r--r--base/threading/watchdog.h (renamed from base/watchdog.h)12
-rw-r--r--base/threading/watchdog_unittest.cc (renamed from base/watchdog_unittest.cc)10
-rw-r--r--base/threading/worker_pool.h (renamed from base/worker_pool.h)12
-rw-r--r--base/threading/worker_pool_posix.cc (renamed from base/worker_pool_posix.cc)13
-rw-r--r--base/threading/worker_pool_posix.h (renamed from base/worker_pool_posix.h)8
-rw-r--r--base/threading/worker_pool_posix_unittest.cc (renamed from base/worker_pool_posix_unittest.cc)10
-rw-r--r--base/threading/worker_pool_unittest.cc (renamed from base/worker_pool_unittest.cc)10
-rw-r--r--base/threading/worker_pool_win.cc (renamed from base/worker_pool_win.cc)8
21 files changed, 109 insertions, 94 deletions
diff --git a/base/base.gyp b/base/base.gyp
index 075561b..327a098 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -125,7 +125,6 @@
'sha1_unittest.cc',
'sha2_unittest.cc',
'shared_memory_unittest.cc',
- 'simple_thread_unittest.cc',
'singleton_unittest.cc',
'stack_container_unittest.cc',
'string16_unittest.cc',
@@ -141,6 +140,10 @@
'sys_string_conversions_unittest.cc',
'task_queue_unittest.cc',
'task_unittest.cc',
+ 'threading/simple_thread_unittest.cc',
+ 'threading/watchdog_unittest.cc',
+ 'threading/worker_pool_posix_unittest.cc',
+ 'threading/worker_pool_unittest.cc',
'thread_checker_unittest.cc',
'thread_collision_warner_unittest.cc',
'thread_local_storage_unittest.cc',
@@ -159,7 +162,6 @@
'vlog_unittest.cc',
'waitable_event_unittest.cc',
'waitable_event_watcher_unittest.cc',
- 'watchdog_unittest.cc',
'weak_ptr_unittest.cc',
'win_util_unittest.cc',
'win/event_trace_consumer_unittest.cc',
@@ -171,8 +173,6 @@
'win/scoped_bstr_unittest.cc',
'win/scoped_comptr_unittest.cc',
'win/scoped_variant_unittest.cc',
- 'worker_pool_posix_unittest.cc',
- 'worker_pool_unittest.cc',
],
'dependencies': [
'base',
diff --git a/base/base.gypi b/base/base.gypi
index 102c49ca..e969149 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -209,8 +209,6 @@
'shared_memory.h',
'shared_memory_posix.cc',
'shared_memory_win.cc',
- 'simple_thread.cc',
- 'simple_thread.h',
'singleton.h',
'spin_wait.h',
'stack_container.h',
@@ -245,6 +243,14 @@
'task_queue.cc',
'task_queue.h',
'template_util.h',
+ 'threading/simple_thread.cc',
+ 'threading/simple_thread.h',
+ 'threading/watchdog.cc',
+ 'threading/watchdog.h',
+ 'threading/worker_pool.h',
+ 'threading/worker_pool_posix.cc',
+ 'threading/worker_pool_posix.h',
+ 'threading/worker_pool_win.cc',
'thread.cc',
'thread.h',
'thread_checker.cc',
@@ -289,8 +295,6 @@
'waitable_event_watcher_posix.cc',
'waitable_event_watcher_win.cc',
'waitable_event_win.cc',
- 'watchdog.cc',
- 'watchdog.h',
'weak_ptr.cc',
'weak_ptr.h',
'win/i18n.cc',
@@ -317,10 +321,6 @@
'win/windows_version.h',
'win_util.cc',
'win_util.h',
- 'worker_pool.h',
- 'worker_pool_posix.cc',
- 'worker_pool_posix.h',
- 'worker_pool_win.cc',
'nix/xdg_util.h',
'nix/xdg_util.cc',
],
diff --git a/base/lazy_instance_unittest.cc b/base/lazy_instance_unittest.cc
index 1731381..d9e0fa9 100644
--- a/base/lazy_instance_unittest.cc
+++ b/base/lazy_instance_unittest.cc
@@ -5,7 +5,7 @@
#include "base/at_exit.h"
#include "base/atomic_sequence_num.h"
#include "base/lazy_instance.h"
-#include "base/simple_thread.h"
+#include "base/threading/simple_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
diff --git a/base/metrics/stats_table_unittest.cc b/base/metrics/stats_table_unittest.cc
index c9eb9a2..9052244 100644
--- a/base/metrics/stats_table_unittest.cc
+++ b/base/metrics/stats_table_unittest.cc
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/metrics/stats_counters.h"
+#include "base/metrics/stats_table.h"
#include "base/platform_thread.h"
-#include "base/simple_thread.h"
#include "base/shared_memory.h"
-#include "base/metrics/stats_table.h"
-#include "base/metrics/stats_counters.h"
#include "base/string_piece.h"
#include "base/string_util.h"
#include "base/test/multiprocess_test.h"
+#include "base/threading/simple_thread.h"
#include "base/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/multiprocess_func_list.h"
diff --git a/base/non_thread_safe_unittest.cc b/base/non_thread_safe_unittest.cc
index 1db198b..98af0e1 100644
--- a/base/non_thread_safe_unittest.cc
+++ b/base/non_thread_safe_unittest.cc
@@ -6,7 +6,7 @@
#include "base/logging.h"
#include "base/non_thread_safe.h"
#include "base/scoped_ptr.h"
-#include "base/simple_thread.h"
+#include "base/threading/simple_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
#ifndef NDEBUG
diff --git a/base/thread_checker_unittest.cc b/base/thread_checker_unittest.cc
index 6c55348..2b4aa7a 100644
--- a/base/thread_checker_unittest.cc
+++ b/base/thread_checker_unittest.cc
@@ -6,7 +6,7 @@
#include "base/logging.h"
#include "base/thread_checker.h"
#include "base/scoped_ptr.h"
-#include "base/simple_thread.h"
+#include "base/threading/simple_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
#ifndef NDEBUG
diff --git a/base/thread_collision_warner_unittest.cc b/base/thread_collision_warner_unittest.cc
index b70cfbe..e563036b 100644
--- a/base/thread_collision_warner_unittest.cc
+++ b/base/thread_collision_warner_unittest.cc
@@ -6,7 +6,7 @@
#include "base/lock.h"
#include "base/platform_thread.h"
#include "base/scoped_ptr.h"
-#include "base/simple_thread.h"
+#include "base/threading/simple_thread.h"
#include "base/thread_collision_warner.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/thread_local_storage_unittest.cc b/base/thread_local_storage_unittest.cc
index cb24c75..dc82c53 100644
--- a/base/thread_local_storage_unittest.cc
+++ b/base/thread_local_storage_unittest.cc
@@ -7,7 +7,7 @@
#include <process.h>
#endif
-#include "base/simple_thread.h"
+#include "base/threading/simple_thread.h"
#include "base/thread_local_storage.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/thread_local_unittest.cc b/base/thread_local_unittest.cc
index 7632c56..a155ca2 100644
--- a/base/thread_local_unittest.cc
+++ b/base/thread_local_unittest.cc
@@ -1,9 +1,9 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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 "base/logging.h"
-#include "base/simple_thread.h"
+#include "base/threading/simple_thread.h"
#include "base/thread_local.h"
#include "base/waitable_event.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/simple_thread.cc b/base/threading/simple_thread.cc
index 086a430..df1953f 100644
--- a/base/simple_thread.cc
+++ b/base/threading/simple_thread.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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 "base/simple_thread.h"
+#include "base/threading/simple_thread.h"
#include "base/logging.h"
#include "base/platform_thread.h"
diff --git a/base/simple_thread.h b/base/threading/simple_thread.h
index 13c46c0..dbff3ae 100644
--- a/base/simple_thread.h
+++ b/base/threading/simple_thread.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -37,8 +37,8 @@
// // The SimpleThread object is still valid, however you may not call Join
// // or Start again.
-#ifndef BASE_SIMPLE_THREAD_H_
-#define BASE_SIMPLE_THREAD_H_
+#ifndef BASE_THREADING_SIMPLE_THREAD_H_
+#define BASE_THREADING_SIMPLE_THREAD_H_
#pragma once
#include <string>
@@ -179,4 +179,4 @@ class DelegateSimpleThreadPool : public DelegateSimpleThread::Delegate {
} // namespace base
-#endif // BASE_SIMPLE_THREAD_H_
+#endif // BASE_THREADING_SIMPLE_THREAD_H_
diff --git a/base/simple_thread_unittest.cc b/base/threading/simple_thread_unittest.cc
index 208290a..56aed6b 100644
--- a/base/simple_thread_unittest.cc
+++ b/base/threading/simple_thread_unittest.cc
@@ -3,14 +3,16 @@
// found in the LICENSE file.
#include "base/atomic_sequence_num.h"
-#include "base/simple_thread.h"
#include "base/string_number_conversions.h"
+#include "base/threading/simple_thread.h"
#include "base/waitable_event.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace base {
+
namespace {
-class SetIntRunner : public base::DelegateSimpleThread::Delegate {
+class SetIntRunner : public DelegateSimpleThread::Delegate {
public:
SetIntRunner(int* ptr, int val) : ptr_(ptr), val_(val) { }
~SetIntRunner() { }
@@ -24,9 +26,9 @@ class SetIntRunner : public base::DelegateSimpleThread::Delegate {
int val_;
};
-class WaitEventRunner : public base::DelegateSimpleThread::Delegate {
+class WaitEventRunner : public DelegateSimpleThread::Delegate {
public:
- explicit WaitEventRunner(base::WaitableEvent* event) : event_(event) { }
+ explicit WaitEventRunner(WaitableEvent* event) : event_(event) { }
~WaitEventRunner() { }
virtual void Run() {
@@ -35,27 +37,27 @@ class WaitEventRunner : public base::DelegateSimpleThread::Delegate {
EXPECT_TRUE(event_->IsSignaled());
}
private:
- base::WaitableEvent* event_;
+ WaitableEvent* event_;
};
-class SeqRunner : public base::DelegateSimpleThread::Delegate {
+class SeqRunner : public DelegateSimpleThread::Delegate {
public:
- explicit SeqRunner(base::AtomicSequenceNumber* seq) : seq_(seq) { }
+ explicit SeqRunner(AtomicSequenceNumber* seq) : seq_(seq) { }
virtual void Run() {
seq_->GetNext();
}
private:
- base::AtomicSequenceNumber* seq_;
+ AtomicSequenceNumber* seq_;
};
// We count up on a sequence number, firing on the event when we've hit our
// expected amount, otherwise we wait on the event. This will ensure that we
// have all threads outstanding until we hit our expected thread pool size.
-class VerifyPoolRunner : public base::DelegateSimpleThread::Delegate {
+class VerifyPoolRunner : public DelegateSimpleThread::Delegate {
public:
- VerifyPoolRunner(base::AtomicSequenceNumber* seq,
- int total, base::WaitableEvent* event)
+ VerifyPoolRunner(AtomicSequenceNumber* seq,
+ int total, WaitableEvent* event)
: seq_(seq), total_(total), event_(event) { }
virtual void Run() {
@@ -67,9 +69,9 @@ class VerifyPoolRunner : public base::DelegateSimpleThread::Delegate {
}
private:
- base::AtomicSequenceNumber* seq_;
+ AtomicSequenceNumber* seq_;
int total_;
- base::WaitableEvent* event_;
+ WaitableEvent* event_;
};
} // namespace
@@ -80,7 +82,7 @@ TEST(SimpleThreadTest, CreateAndJoin) {
SetIntRunner runner(&stack_int, 7);
EXPECT_EQ(0, stack_int);
- base::DelegateSimpleThread thread(&runner, "int_setter");
+ DelegateSimpleThread thread(&runner, "int_setter");
EXPECT_FALSE(thread.HasBeenStarted());
EXPECT_FALSE(thread.HasBeenJoined());
EXPECT_EQ(0, stack_int);
@@ -97,10 +99,10 @@ TEST(SimpleThreadTest, CreateAndJoin) {
TEST(SimpleThreadTest, WaitForEvent) {
// Create a thread, and wait for it to signal us.
- base::WaitableEvent event(true, false);
+ WaitableEvent event(true, false);
WaitEventRunner runner(&event);
- base::DelegateSimpleThread thread(&runner, "event_waiter");
+ DelegateSimpleThread thread(&runner, "event_waiter");
EXPECT_FALSE(event.IsSignaled());
thread.Start();
@@ -110,18 +112,18 @@ TEST(SimpleThreadTest, WaitForEvent) {
}
TEST(SimpleThreadTest, NamedWithOptions) {
- base::WaitableEvent event(true, false);
+ WaitableEvent event(true, false);
WaitEventRunner runner(&event);
- base::SimpleThread::Options options;
- base::DelegateSimpleThread thread(&runner, "event_waiter", options);
+ SimpleThread::Options options;
+ DelegateSimpleThread thread(&runner, "event_waiter", options);
EXPECT_EQ(thread.name_prefix(), "event_waiter");
EXPECT_FALSE(event.IsSignaled());
thread.Start();
EXPECT_EQ(thread.name_prefix(), "event_waiter");
EXPECT_EQ(thread.name(),
- std::string("event_waiter/") + base::IntToString(thread.tid()));
+ std::string("event_waiter/") + IntToString(thread.tid()));
event.Wait();
EXPECT_TRUE(event.IsSignaled());
@@ -130,13 +132,13 @@ TEST(SimpleThreadTest, NamedWithOptions) {
// We keep the name and tid, even after the thread is gone.
EXPECT_EQ(thread.name_prefix(), "event_waiter");
EXPECT_EQ(thread.name(),
- std::string("event_waiter/") + base::IntToString(thread.tid()));
+ std::string("event_waiter/") + IntToString(thread.tid()));
}
TEST(SimpleThreadTest, ThreadPool) {
- base::AtomicSequenceNumber seq;
+ AtomicSequenceNumber seq;
SeqRunner runner(&seq);
- base::DelegateSimpleThreadPool pool("seq_runner", 10);
+ DelegateSimpleThreadPool pool("seq_runner", 10);
// Add work before we're running.
pool.AddWork(&runner, 300);
@@ -153,8 +155,8 @@ TEST(SimpleThreadTest, ThreadPool) {
// We can reuse our pool. Verify that all 10 threads can actually run in
// parallel, so this test will only pass if there are actually 10 threads.
- base::AtomicSequenceNumber seq2;
- base::WaitableEvent event(true, false);
+ AtomicSequenceNumber seq2;
+ WaitableEvent event(true, false);
// Changing 9 to 10, for example, would cause us JoinAll() to never return.
VerifyPoolRunner verifier(&seq2, 9, &event);
pool.Start();
@@ -164,3 +166,5 @@ TEST(SimpleThreadTest, ThreadPool) {
pool.JoinAll();
EXPECT_EQ(seq2.GetNext(), 10);
}
+
+} // namespace base
diff --git a/base/watchdog.cc b/base/threading/watchdog.cc
index f9326e1..8474744 100644
--- a/base/watchdog.cc
+++ b/base/threading/watchdog.cc
@@ -2,17 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/watchdog.h"
+#include "base/threading/watchdog.h"
#include "base/compiler_specific.h"
#include "base/logging.h"
#include "base/platform_thread.h"
-using base::TimeDelta;
-using base::TimeTicks;
-
-//------------------------------------------------------------------------------
-// Public API methods.
+namespace base {
// Start thread running in a Disarmed state.
Watchdog::Watchdog(const TimeDelta& duration,
@@ -144,3 +140,5 @@ Lock Watchdog::static_lock_; // Lock for access of static data...
TimeTicks Watchdog::last_debugged_alarm_time_ = TimeTicks();
// static
TimeDelta Watchdog::last_debugged_alarm_delay_;
+
+} // namespace base
diff --git a/base/watchdog.h b/base/threading/watchdog.h
index b4262d4..025fe09 100644
--- a/base/watchdog.h
+++ b/base/threading/watchdog.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -15,8 +15,8 @@
// a second thread, and their methods call (Arm() and Disarm()) return very
// quickly.
-#ifndef BASE_WATCHDOG_H__
-#define BASE_WATCHDOG_H__
+#ifndef BASE_THREADING_WATCHDOG_H_
+#define BASE_THREADING_WATCHDOG_H_
#pragma once
#include <string>
@@ -26,6 +26,8 @@
#include "base/platform_thread.h"
#include "base/time.h"
+namespace base {
+
class Watchdog {
public:
// Constructor specifies how long the Watchdog will wait before alarming.
@@ -91,4 +93,6 @@ class Watchdog {
DISALLOW_COPY_AND_ASSIGN(Watchdog);
};
-#endif // BASE_WATCHDOG_H__
+} // namespace base
+
+#endif // BASE_THREADING_WATCHDOG_H_
diff --git a/base/watchdog_unittest.cc b/base/threading/watchdog_unittest.cc
index 658a31a..347781e 100644
--- a/base/watchdog_unittest.cc
+++ b/base/threading/watchdog_unittest.cc
@@ -2,9 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Tests for Watchdog class.
-
-#include "base/watchdog.h"
+#include "base/threading/watchdog.h"
#include "base/logging.h"
#include "base/platform_thread.h"
@@ -12,8 +10,7 @@
#include "base/time.h"
#include "testing/gtest/include/gtest/gtest.h"
-using base::TimeDelta;
-using base::TimeTicks;
+namespace base {
namespace {
@@ -50,6 +47,7 @@ class WatchdogTest : public testing::Test {
}
};
+} // namespace
//------------------------------------------------------------------------------
// Actual tests
@@ -139,4 +137,4 @@ TEST_F(WatchdogTest, DisarmTest) {
EXPECT_EQ(1, watchdog.alarm_counter());
}
-} // namespace
+} // namespace base
diff --git a/base/worker_pool.h b/base/threading/worker_pool.h
index e0b75a9..9a02acc 100644
--- a/base/worker_pool.h
+++ b/base/threading/worker_pool.h
@@ -1,15 +1,17 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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_WORKER_POOL_H_
-#define BASE_WORKER_POOL_H_
+#ifndef BASE_THREADING_WORKER_POOL_H_
+#define BASE_THREADING_WORKER_POOL_H_
#pragma once
#include "base/tracked.h"
class Task;
+namespace base {
+
// This is a facility that runs tasks that don't require a specific thread or
// a message loop.
//
@@ -28,4 +30,6 @@ class WorkerPool {
Task* task, bool task_is_slow);
};
-#endif // BASE_WORKER_POOL_H_
+} // namespace base
+
+#endif // BASE_THREADING_WORKER_POOL_H_
diff --git a/base/worker_pool_posix.cc b/base/threading/worker_pool_posix.cc
index 85e1d8e..2facc01 100644
--- a/base/worker_pool_posix.cc
+++ b/base/threading/worker_pool_posix.cc
@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/worker_pool.h"
-#include "base/worker_pool_posix.h"
+#include "base/threading/worker_pool_posix.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
@@ -11,6 +10,9 @@
#include "base/ref_counted.h"
#include "base/stringprintf.h"
#include "base/task.h"
+#include "base/threading/worker_pool.h"
+
+namespace base {
namespace {
@@ -32,8 +34,9 @@ class WorkerPoolImpl {
};
WorkerPoolImpl::WorkerPoolImpl()
- : pool_(new base::PosixDynamicThreadPool(
- "WorkerPool", kIdleSecondsBeforeExit)) {}
+ : pool_(new base::PosixDynamicThreadPool("WorkerPool",
+ kIdleSecondsBeforeExit)) {
+}
WorkerPoolImpl::~WorkerPoolImpl() {
pool_->Terminate();
@@ -90,8 +93,6 @@ bool WorkerPool::PostTask(const tracked_objects::Location& from_here,
return true;
}
-namespace base {
-
PosixDynamicThreadPool::PosixDynamicThreadPool(
const std::string& name_prefix,
int idle_seconds_before_exit)
diff --git a/base/worker_pool_posix.h b/base/threading/worker_pool_posix.h
index 73d8287..6c99e76 100644
--- a/base/worker_pool_posix.h
+++ b/base/threading/worker_pool_posix.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
//
@@ -21,8 +21,8 @@
// implementation of WorkerPool. No one else should be using these classes.
// These symbols are exported in a header purely for testing purposes.
-#ifndef BASE_WORKER_POOL_POSIX_H_
-#define BASE_WORKER_POOL_POSIX_H_
+#ifndef BASE_THREADING_WORKER_POOL_POSIX_H_
+#define BASE_THREADING_WORKER_POOL_POSIX_H_
#pragma once
#include <queue>
@@ -86,4 +86,4 @@ class PosixDynamicThreadPool
} // namespace base
-#endif // BASE_WORKER_POOL_POSIX_H_
+#endif // BASE_THREADING_WORKER_POOL_POSIX_H_
diff --git a/base/worker_pool_posix_unittest.cc b/base/threading/worker_pool_posix_unittest.cc
index 55453c8..48df16e 100644
--- a/base/worker_pool_posix_unittest.cc
+++ b/base/threading/worker_pool_posix_unittest.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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 "base/worker_pool_posix.h"
+#include "base/threading/worker_pool_posix.h"
#include <set>
@@ -40,8 +40,6 @@ class PosixDynamicThreadPool::PosixDynamicThreadPoolPeer {
DISALLOW_COPY_AND_ASSIGN(PosixDynamicThreadPoolPeer);
};
-} // namespace base
-
namespace {
// IncrementingTask's main purpose is to increment a counter. It also updates a
@@ -177,6 +175,8 @@ class PosixDynamicThreadPoolTest : public testing::Test {
base::WaitableEvent start_;
};
+} // namespace
+
TEST_F(PosixDynamicThreadPoolTest, Basic) {
EXPECT_EQ(0, peer_.num_idle_threads());
EXPECT_EQ(0U, unique_threads_.size());
@@ -265,4 +265,4 @@ TEST_F(PosixDynamicThreadPoolTest, Complex) {
EXPECT_EQ(4, counter_);
}
-} // namespace
+} // namespace base
diff --git a/base/worker_pool_unittest.cc b/base/threading/worker_pool_unittest.cc
index f6bee96..cf8e0e8 100644
--- a/base/worker_pool_unittest.cc
+++ b/base/threading/worker_pool_unittest.cc
@@ -4,14 +4,14 @@
#include "base/task.h"
#include "base/waitable_event.h"
-#include "base/worker_pool.h"
+#include "base/threading/worker_pool.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
-using base::WaitableEvent;
-
typedef PlatformTest WorkerPoolTest;
+namespace base {
+
namespace {
class PostTaskTestTask : public Task {
@@ -27,6 +27,8 @@ class PostTaskTestTask : public Task {
WaitableEvent* event_;
};
+} // namespace
+
TEST_F(WorkerPoolTest, PostTask) {
WaitableEvent test_event(false, false);
WaitableEvent long_test_event(false, false);
@@ -41,4 +43,4 @@ TEST_F(WorkerPoolTest, PostTask) {
EXPECT_TRUE(signaled);
}
-} // namespace
+} // namespace base
diff --git a/base/worker_pool_win.cc b/base/threading/worker_pool_win.cc
index 3f383b9..2072e52 100644
--- a/base/worker_pool_win.cc
+++ b/base/threading/worker_pool_win.cc
@@ -1,12 +1,14 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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 "base/worker_pool.h"
+#include "base/threading/worker_pool.h"
#include "base/logging.h"
#include "base/task.h"
+namespace base {
+
namespace {
DWORD CALLBACK WorkItemCallback(void* param) {
@@ -34,3 +36,5 @@ bool WorkerPool::PostTask(const tracked_objects::Location& from_here,
return true;
}
+
+} // namespace base