summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--chrome/browser/jankometer.cc4
-rw-r--r--chrome/browser/printing/printing_layout_uitest.cc2
-rw-r--r--chrome/browser/renderer_host/render_message_filter.cc4
-rw-r--r--chrome/browser/ui/cocoa/keystone_glue.mm4
-rw-r--r--chrome/gpu/gpu_thread.cc4
-rw-r--r--chrome/renderer/pepper_devices.h2
-rw-r--r--net/base/cert_verifier.cc8
-rw-r--r--net/base/dnsrr_resolver.cc8
-rw-r--r--net/base/file_stream_posix.cc22
-rw-r--r--net/base/host_resolver_impl.cc6
-rw-r--r--net/base/keygen_handler_unittest.cc10
-rw-r--r--net/base/test_completion_callback_unittest.cc8
-rw-r--r--net/disk_cache/backend_impl.cc4
-rw-r--r--net/disk_cache/file_posix.cc6
-rw-r--r--net/proxy/polling_proxy_config_service.cc8
-rw-r--r--net/tools/flip_server/flip_in_mem_edsm_server.cc2
-rw-r--r--net/url_request/url_request_file_job.cc7
-rw-r--r--ppapi/proxy/ppb_audio_proxy.cc2
-rw-r--r--ppapi/shared_impl/audio_impl.h2
40 files changed, 164 insertions, 152 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
diff --git a/chrome/browser/jankometer.cc b/chrome/browser/jankometer.cc
index ed4f9fd..a2f63c0 100644
--- a/chrome/browser/jankometer.cc
+++ b/chrome/browser/jankometer.cc
@@ -13,9 +13,9 @@
#include "base/metrics/stats_counters.h"
#include "base/ref_counted.h"
#include "base/string_util.h"
+#include "base/threading/watchdog.h"
#include "base/thread.h"
#include "base/time.h"
-#include "base/watchdog.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_thread.h"
@@ -55,7 +55,7 @@ const bool kPlaySounds = false;
//------------------------------------------------------------------------------
// Provide a special watchdog to make it easy to set the breakpoint on this
// class only.
-class JankWatchdog : public Watchdog {
+class JankWatchdog : public base::Watchdog {
public:
JankWatchdog(const TimeDelta& duration,
const std::string& thread_watched_name,
diff --git a/chrome/browser/printing/printing_layout_uitest.cc b/chrome/browser/printing/printing_layout_uitest.cc
index 754e8f5..1198705 100644
--- a/chrome/browser/printing/printing_layout_uitest.cc
+++ b/chrome/browser/printing/printing_layout_uitest.cc
@@ -4,8 +4,8 @@
#include "base/command_line.h"
#include "base/file_util.h"
-#include "base/simple_thread.h"
#include "base/test/test_file_util.h"
+#include "base/threading/simple_thread.h"
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/ui/ui_test.h"
#include "net/test/test_server.h"
diff --git a/chrome/browser/renderer_host/render_message_filter.cc b/chrome/browser/renderer_host/render_message_filter.cc
index b5adbaa..5f638ab 100644
--- a/chrome/browser/renderer_host/render_message_filter.cc
+++ b/chrome/browser/renderer_host/render_message_filter.cc
@@ -12,9 +12,9 @@
#include "base/process_util.h"
#include "base/shared_memory.h"
#include "base/sys_string_conversions.h"
+#include "base/threading/worker_pool.h"
#include "base/thread.h"
#include "base/utf_string_conversions.h"
-#include "base/worker_pool.h"
#include "chrome/browser/automation/automation_resource_message_filter.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_thread.h"
@@ -1352,7 +1352,7 @@ void RenderMessageFilter::OnKeygen(uint32 key_size_index,
VLOG(1) << "Dispatching keygen task to worker pool.";
// Dispatch to worker pool, so we do not block the IO thread.
- if (!WorkerPool::PostTask(
+ if (!base::WorkerPool::PostTask(
FROM_HERE,
NewRunnableMethod(
this, &RenderMessageFilter::OnKeygenOnWorkerThread,
diff --git a/chrome/browser/ui/cocoa/keystone_glue.mm b/chrome/browser/ui/cocoa/keystone_glue.mm
index b42375a..79e95fc 100644
--- a/chrome/browser/ui/cocoa/keystone_glue.mm
+++ b/chrome/browser/ui/cocoa/keystone_glue.mm
@@ -17,7 +17,7 @@
#include "base/sys_string_conversions.h"
#include "base/ref_counted.h"
#include "base/task.h"
-#include "base/worker_pool.h"
+#include "base/threading/worker_pool.h"
#include "chrome/browser/ui/cocoa/authorization_util.h"
#include "chrome/common/chrome_constants.h"
#include "grit/chromium_strings.h"
@@ -104,7 +104,7 @@ class PerformBridge : public base::RefCountedThreadSafe<PerformBridge> {
DCHECK(sel);
scoped_refptr<PerformBridge> op = new PerformBridge(target, sel, arg);
- WorkerPool::PostTask(
+ base::WorkerPool::PostTask(
FROM_HERE, NewRunnableMethod(op.get(), &PerformBridge::Run), true);
}
diff --git a/chrome/gpu/gpu_thread.cc b/chrome/gpu/gpu_thread.cc
index e95d27f..0c64e89 100644
--- a/chrome/gpu/gpu_thread.cc
+++ b/chrome/gpu/gpu_thread.cc
@@ -9,7 +9,7 @@
#include "app/gfx/gl/gl_context.h"
#include "base/command_line.h"
-#include "base/worker_pool.h"
+#include "base/threading/worker_pool.h"
#include "build/build_config.h"
#include "chrome/common/child_process.h"
#include "chrome/common/child_process_logging.h"
@@ -34,7 +34,7 @@ void GpuThread::Init(const base::Time& process_start_time) {
#if defined(OS_WIN)
// Asynchronously collect the DirectX diagnostics because this can take a
// couple of seconds.
- if (!WorkerPool::PostTask(
+ if (!base::WorkerPool::PostTask(
FROM_HERE,
NewRunnableFunction(&GpuThread::CollectDxDiagnostics, this),
true)) {
diff --git a/chrome/renderer/pepper_devices.h b/chrome/renderer/pepper_devices.h
index 912657a..c043ad9 100644
--- a/chrome/renderer/pepper_devices.h
+++ b/chrome/renderer/pepper_devices.h
@@ -10,7 +10,7 @@
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
#include "base/shared_memory.h"
-#include "base/simple_thread.h"
+#include "base/threading/simple_thread.h"
#include "chrome/common/render_messages.h"
#include "chrome/renderer/audio_message_filter.h"
#include "gfx/rect.h"
diff --git a/net/base/cert_verifier.cc b/net/base/cert_verifier.cc
index 4b3d904..3d22dec 100644
--- a/net/base/cert_verifier.cc
+++ b/net/base/cert_verifier.cc
@@ -8,7 +8,7 @@
#include "base/lock.h"
#include "base/message_loop.h"
#include "base/stl_util-inl.h"
-#include "base/worker_pool.h"
+#include "base/threading/worker_pool.h"
#include "net/base/net_errors.h"
#include "net/base/x509_certificate.h"
@@ -136,9 +136,9 @@ class CertVerifierWorker {
bool Start() {
DCHECK_EQ(MessageLoop::current(), origin_loop_);
- return WorkerPool::PostTask(
- FROM_HERE, NewRunnableMethod(this, &CertVerifierWorker::Run),
- true /* task is slow */);
+ return base::WorkerPool::PostTask(
+ FROM_HERE, NewRunnableMethod(this, &CertVerifierWorker::Run),
+ true /* task is slow */);
}
// Cancel is called from the origin loop when the CertVerifier is getting
diff --git a/net/base/dnsrr_resolver.cc b/net/base/dnsrr_resolver.cc
index 30031f3..393c213 100644
--- a/net/base/dnsrr_resolver.cc
+++ b/net/base/dnsrr_resolver.cc
@@ -15,7 +15,7 @@
#include "base/stl_util-inl.h"
#include "base/string_piece.h"
#include "base/task.h"
-#include "base/worker_pool.h"
+#include "base/threading/worker_pool.h"
#include "net/base/dns_reload_timer.h"
#include "net/base/dns_util.h"
#include "net/base/net_errors.h"
@@ -139,9 +139,9 @@ class RRResolverWorker {
bool Start() {
DCHECK_EQ(MessageLoop::current(), origin_loop_);
- return WorkerPool::PostTask(
- FROM_HERE, NewRunnableMethod(this, &RRResolverWorker::Run),
- true /* task is slow */);
+ return base::WorkerPool::PostTask(
+ FROM_HERE, NewRunnableMethod(this, &RRResolverWorker::Run),
+ true /* task is slow */);
}
// Cancel is called from the origin loop when the DnsRRResolver is getting
diff --git a/net/base/file_stream_posix.cc b/net/base/file_stream_posix.cc
index 1e20efe..887d9c1 100644
--- a/net/base/file_stream_posix.cc
+++ b/net/base/file_stream_posix.cc
@@ -21,8 +21,8 @@
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/string_util.h"
+#include "base/threading/worker_pool.h"
#include "base/waitable_event.h"
-#include "base/worker_pool.h"
#include "net/base/net_errors.h"
// We cast back and forth, so make sure it's the size we're expecting.
@@ -250,11 +250,11 @@ void FileStream::AsyncContext::InitiateAsyncRead(
DCHECK(!callback_);
callback_ = callback;
- WorkerPool::PostTask(FROM_HERE,
- new BackgroundReadTask(
- file, buf, buf_len,
- &background_io_completed_callback_),
- true /* task_is_slow */);
+ base::WorkerPool::PostTask(FROM_HERE,
+ new BackgroundReadTask(
+ file, buf, buf_len,
+ &background_io_completed_callback_),
+ true /* task_is_slow */);
}
void FileStream::AsyncContext::InitiateAsyncWrite(
@@ -263,11 +263,11 @@ void FileStream::AsyncContext::InitiateAsyncWrite(
DCHECK(!callback_);
callback_ = callback;
- WorkerPool::PostTask(FROM_HERE,
- new BackgroundWriteTask(
- file, buf, buf_len,
- &background_io_completed_callback_),
- true /* task_is_slow */);
+ base::WorkerPool::PostTask(FROM_HERE,
+ new BackgroundWriteTask(
+ file, buf, buf_len,
+ &background_io_completed_callback_),
+ true /* task_is_slow */);
}
void FileStream::AsyncContext::OnBackgroundIOCompleted(int result) {
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc
index b53ec6d..6e4637c 100644
--- a/net/base/host_resolver_impl.cc
+++ b/net/base/host_resolver_impl.cc
@@ -24,10 +24,10 @@
#include "base/metrics/histogram.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
+#include "base/threading/worker_pool.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
-#include "base/worker_pool.h"
#include "net/base/address_list.h"
#include "net/base/address_list_net_log_param.h"
#include "net/base/host_port_pair.h"
@@ -382,7 +382,7 @@ class HostResolverImpl::Job
start_time_ = base::TimeTicks::Now();
// Dispatch the job to a worker thread.
- if (!WorkerPool::PostTask(FROM_HERE,
+ if (!base::WorkerPool::PostTask(FROM_HERE,
NewRunnableMethod(this, &Job::DoLookup), true)) {
NOTREACHED();
@@ -650,7 +650,7 @@ class HostResolverImpl::IPv6ProbeJob
return;
DCHECK(IsOnOriginThread());
const bool kIsSlow = true;
- WorkerPool::PostTask(
+ base::WorkerPool::PostTask(
FROM_HERE, NewRunnableMethod(this, &IPv6ProbeJob::DoProbe), kIsSlow);
}
diff --git a/net/base/keygen_handler_unittest.cc b/net/base/keygen_handler_unittest.cc
index f4251f2..10ccc95 100644
--- a/net/base/keygen_handler_unittest.cc
+++ b/net/base/keygen_handler_unittest.cc
@@ -11,9 +11,9 @@
#include "base/logging.h"
#include "base/nss_util.h"
#include "base/task.h"
+#include "base/threading/worker_pool.h"
#include "base/thread_restrictions.h"
#include "base/waitable_event.h"
-#include "base/worker_pool.h"
#include "testing/gtest/include/gtest/gtest.h"
#if defined(USE_NSS)
@@ -124,10 +124,10 @@ TEST_F(KeygenHandlerTest, ConcurrencyTest) {
std::string results[NUM_HANDLERS];
for (int i = 0; i < NUM_HANDLERS; i++) {
events[i] = new base::WaitableEvent(false, false);
- WorkerPool::PostTask(FROM_HERE,
- new ConcurrencyTestTask(events[i], "some challenge",
- &results[i]),
- true);
+ base::WorkerPool::PostTask(
+ FROM_HERE,
+ new ConcurrencyTestTask(events[i], "some challenge", &results[i]),
+ true);
}
for (int i = 0; i < NUM_HANDLERS; i++) {
diff --git a/net/base/test_completion_callback_unittest.cc b/net/base/test_completion_callback_unittest.cc
index c19aae0..a0ae9bf 100644
--- a/net/base/test_completion_callback_unittest.cc
+++ b/net/base/test_completion_callback_unittest.cc
@@ -1,13 +1,13 @@
-// 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.
// Illustrates how to use worker threads that issue completion callbacks
-#include "testing/gtest/include/gtest/gtest.h"
+#include "base/threading/worker_pool.h"
#include "net/base/completion_callback.h"
#include "net/base/test_completion_callback.h"
-#include "base/worker_pool.h"
+#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
typedef PlatformTest TestCompletionCallbackTest;
@@ -102,7 +102,7 @@ bool ExampleEmployer::DoSomething(CompletionCallback* callback) {
request_ = new ExampleWorker(this, callback);
// Dispatch to worker thread...
- if (!WorkerPool::PostTask(FROM_HERE,
+ if (!base::WorkerPool::PostTask(FROM_HERE,
NewRunnableMethod(request_.get(), &ExampleWorker::DoWork), true)) {
NOTREACHED();
request_ = NULL;
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index 96f8723..4eab2675 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -13,10 +13,10 @@
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/sys_info.h"
+#include "base/threading/worker_pool.h"
#include "base/thread_restrictions.h"
#include "base/time.h"
#include "base/timer.h"
-#include "base/worker_pool.h"
#include "net/base/net_errors.h"
#include "net/disk_cache/cache_util.h"
#include "net/disk_cache/entry_impl.h"
@@ -142,7 +142,7 @@ bool DelayedCacheCleanup(const FilePath& full_path) {
return false;
}
- WorkerPool::PostTask(FROM_HERE, new CleanupTask(path, name_str), true);
+ base::WorkerPool::PostTask(FROM_HERE, new CleanupTask(path, name_str), true);
return true;
}
diff --git a/net/disk_cache/file_posix.cc b/net/disk_cache/file_posix.cc
index 1870c0b..01dafd3 100644
--- a/net/disk_cache/file_posix.cc
+++ b/net/disk_cache/file_posix.cc
@@ -7,7 +7,7 @@
#include <fcntl.h>
#include "base/logging.h"
-#include "base/worker_pool.h"
+#include "base/threading/worker_pool.h"
#include "net/disk_cache/disk_cache.h"
#include "net/disk_cache/in_flight_io.h"
@@ -113,7 +113,7 @@ void FileInFlightIO::PostRead(disk_cache::File *file, void* buf, size_t buf_len,
new FileBackgroundIO(file, buf, buf_len, offset, callback, this));
file->AddRef(); // Balanced on OnOperationComplete()
- WorkerPool::PostTask(FROM_HERE,
+ base::WorkerPool::PostTask(FROM_HERE,
NewRunnableMethod(operation.get(), &FileBackgroundIO::Read), true);
OnOperationPosted(operation);
}
@@ -125,7 +125,7 @@ void FileInFlightIO::PostWrite(disk_cache::File* file, const void* buf,
new FileBackgroundIO(file, buf, buf_len, offset, callback, this));
file->AddRef(); // Balanced on OnOperationComplete()
- WorkerPool::PostTask(FROM_HERE,
+ base::WorkerPool::PostTask(FROM_HERE,
NewRunnableMethod(operation.get(), &FileBackgroundIO::Write), true);
OnOperationPosted(operation);
}
diff --git a/net/proxy/polling_proxy_config_service.cc b/net/proxy/polling_proxy_config_service.cc
index 2db9792..98a164d 100644
--- a/net/proxy/polling_proxy_config_service.cc
+++ b/net/proxy/polling_proxy_config_service.cc
@@ -8,7 +8,7 @@
#include "base/message_loop_proxy.h"
#include "base/observer_list.h"
#include "base/scoped_ptr.h"
-#include "base/worker_pool.h"
+#include "base/threading/worker_pool.h"
#include "net/proxy/proxy_config.h"
namespace net {
@@ -88,10 +88,10 @@ class PollingProxyConfigService::Core
last_poll_time_ = base::TimeTicks::Now();
poll_task_outstanding_ = true;
poll_task_queued_ = false;
- WorkerPool::PostTask(
+ base::WorkerPool::PostTask(
FROM_HERE,
- NewRunnableMethod(
- this, &Core::PollOnWorkerThread, get_config_func_), true);
+ NewRunnableMethod(this, &Core::PollOnWorkerThread, get_config_func_),
+ true);
}
private:
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 1969e0c..a378e72 100644
--- a/net/tools/flip_server/flip_in_mem_edsm_server.cc
+++ b/net/tools/flip_server/flip_in_mem_edsm_server.cc
@@ -19,7 +19,7 @@
#include "base/command_line.h"
#include "base/logging.h"
-#include "base/simple_thread.h"
+#include "base/threading/simple_thread.h"
#include "base/timer.h"
#include "base/lock.h"
#include "net/spdy/spdy_frame_builder.h"
diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc
index 230ee06..d7ebe0a 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/threading/worker_pool.h"
#include "base/thread_restrictions.h"
#include "build/build_config.h"
#include "googleurl/src/gurl.h"
@@ -36,10 +37,6 @@
#include "net/url_request/url_request_error_job.h"
#include "net/url_request/url_request_file_dir_job.h"
-#if defined(OS_WIN)
-#include "base/worker_pool.h"
-#endif
-
namespace net {
#if defined(OS_WIN)
@@ -136,7 +133,7 @@ void URLRequestFileJob::Start() {
if (!file_path_.value().compare(0, 2, L"\\\\")) {
DCHECK(!async_resolver_);
async_resolver_ = new AsyncResolver(this);
- WorkerPool::PostTask(FROM_HERE, NewRunnableMethod(
+ base::WorkerPool::PostTask(FROM_HERE, NewRunnableMethod(
async_resolver_.get(), &AsyncResolver::Resolve, file_path_), true);
return;
}
diff --git a/ppapi/proxy/ppb_audio_proxy.cc b/ppapi/proxy/ppb_audio_proxy.cc
index 4468c4e..e23ac4e 100644
--- a/ppapi/proxy/ppb_audio_proxy.cc
+++ b/ppapi/proxy/ppb_audio_proxy.cc
@@ -4,7 +4,7 @@
#include "ppapi/proxy/ppb_audio_proxy.h"
-#include "base/simple_thread.h"
+#include "base/threading/simple_thread.h"
#include "ppapi/c/dev/ppb_audio_dev.h"
#include "ppapi/c/dev/ppb_audio_trusted_dev.h"
#include "ppapi/c/pp_errors.h"
diff --git a/ppapi/shared_impl/audio_impl.h b/ppapi/shared_impl/audio_impl.h
index 3a45142..f4d5681 100644
--- a/ppapi/shared_impl/audio_impl.h
+++ b/ppapi/shared_impl/audio_impl.h
@@ -6,9 +6,9 @@
#define PPAPI_SHARED_IMPL_AUDIO_IMPL_H_
#include "base/scoped_ptr.h"
-#include "base/simple_thread.h"
#include "base/shared_memory.h"
#include "base/sync_socket.h"
+#include "base/threading/simple_thread.h"
#include "ppapi/c/dev/ppb_audio_dev.h"
namespace pp {