Move platform_thread to base/threading and put in the base namespace. I left a
stub and "using" declarations in the old location to avoid having to change the
entire project at once.

TEST=it compiles
BUG=none
Review URL: http://codereview.chromium.org/6001010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70342 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: ce072a7181ea5d58133e33654133236f5d9f5551
diff --git a/base/base.gyp b/base/base.gyp
index 56f4e99..cc98aa4 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -112,7 +112,6 @@
         'path_service_unittest.cc',
         'pickle_unittest.cc',
         'platform_file_unittest.cc',
-        'platform_thread_unittest.cc',
         'pr_time_unittest.cc',
         'process_util_unittest.cc',
         'process_util_unittest_mac.h',
@@ -140,13 +139,14 @@
         'sys_string_conversions_unittest.cc',
         'task_queue_unittest.cc',
         'task_unittest.cc',
+        'threading/platform_thread_unittest.cc',
         'threading/simple_thread_unittest.cc',
+        'threading/thread_checker_unittest.cc',
         'threading/thread_local_storage_unittest.cc',
         'threading/thread_local_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_unittest.cc',
         'time_unittest.cc',
diff --git a/base/base.gypi b/base/base.gypi
index b73b6b1..d07cd43 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -165,10 +165,6 @@
           'platform_file.h',
           'platform_file_posix.cc',
           'platform_file_win.cc',
-          'platform_thread.h',
-          'platform_thread_mac.mm',
-          'platform_thread_posix.cc',
-          'platform_thread_win.cc',
           'port.h',
           'process.h',
           'process_linux.cc',
@@ -243,8 +239,14 @@
           'task_queue.cc',
           'task_queue.h',
           'template_util.h',
+          'threading/platform_thread.h',
+          'threading/platform_thread_mac.mm',
+          'threading/platform_thread_posix.cc',
+          'threading/platform_thread_win.cc',
           'threading/simple_thread.cc',
           'threading/simple_thread.h',
+          'threading/thread_checker.cc',
+          'threading/thread_checker.h',
           'threading/thread_local.h',
           'threading/thread_local_posix.cc',
           'threading/thread_local_storage.h',
@@ -259,8 +261,6 @@
           'threading/worker_pool_win.cc',
           'thread.cc',
           'thread.h',
-          'thread_checker.cc',
-          'thread_checker.h',
           'thread_collision_warner.cc',
           'thread_collision_warner.h',
           'thread_restrictions.h',
diff --git a/base/cancellation_flag.h b/base/cancellation_flag.h
index 98ca846..b4fddb2 100644
--- a/base/cancellation_flag.h
+++ b/base/cancellation_flag.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.
 
@@ -7,7 +7,7 @@
 #pragma once
 
 #include "base/atomicops.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
 
 namespace base {
 
diff --git a/base/condition_variable_unittest.cc b/base/condition_variable_unittest.cc
index 67d1839..ab83fbf 100644
--- a/base/condition_variable_unittest.cc
+++ b/base/condition_variable_unittest.cc
@@ -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.
 
@@ -11,14 +11,16 @@
 #include "base/condition_variable.h"
 #include "base/lock.h"
 #include "base/logging.h"
-#include "base/platform_thread.h"
 #include "base/scoped_ptr.h"
 #include "base/spin_wait.h"
+#include "base/threading/platform_thread.h"
 #include "base/thread_collision_warner.h"
 #include "base/time.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "testing/platform_test.h"
 
+using base::PlatformThread;
+using base::PlatformThreadHandle;
 using base::TimeDelta;
 using base::TimeTicks;
 
diff --git a/base/debug/debugger.cc b/base/debug/debugger.cc
index 9ca7e8d..fb23524 100644
--- a/base/debug/debugger.cc
+++ b/base/debug/debugger.cc
@@ -4,7 +4,7 @@
 
 #include "base/debug/debugger.h"
 
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
 
 namespace base {
 namespace debug {
diff --git a/base/debug/trace_event.cc b/base/debug/trace_event.cc
index f50422c..16538c1 100644
--- a/base/debug/trace_event.cc
+++ b/base/debug/trace_event.cc
@@ -8,9 +8,9 @@
 #include "base/file_path.h"
 #include "base/file_util.h"
 #include "base/path_service.h"
-#include "base/platform_thread.h"
 #include "base/process_util.h"
 #include "base/stringprintf.h"
+#include "base/threading/platform_thread.h"
 #include "base/utf_string_conversions.h"
 #include "base/time.h"
 
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc
index cb77828..4aaed90 100644
--- a/base/file_util_unittest.cc
+++ b/base/file_util_unittest.cc
@@ -19,9 +19,9 @@
 #include "base/file_path.h"
 #include "base/file_util.h"
 #include "base/path_service.h"
-#include "base/platform_thread.h"
 #include "base/scoped_handle.h"
 #include "base/scoped_temp_dir.h"
+#include "base/threading/platform_thread.h"
 #include "base/time.h"
 #include "base/utf_string_conversions.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -347,11 +347,11 @@
 
   // Age to perfection
 #if defined(OS_WIN)
-  PlatformThread::Sleep(100);
+  base::PlatformThread::Sleep(100);
 #elif defined(OS_POSIX)
   // We need to wait at least one second here because the precision of
   // file creation time is one second.
-  PlatformThread::Sleep(1500);
+  base::PlatformThread::Sleep(1500);
 #endif
 
   // Establish our cutoff time
diff --git a/base/lazy_instance.cc b/base/lazy_instance.cc
index eb71061..32bb788 100644
--- a/base/lazy_instance.cc
+++ b/base/lazy_instance.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 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.
 
@@ -7,7 +7,7 @@
 #include "base/at_exit.h"
 #include "base/atomicops.h"
 #include "base/basictypes.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
 
 namespace base {
diff --git a/base/lazy_instance_unittest.cc b/base/lazy_instance_unittest.cc
index d9e0fa9..28bf04e 100644
--- a/base/lazy_instance_unittest.cc
+++ b/base/lazy_instance_unittest.cc
@@ -26,7 +26,8 @@
 class SlowConstructor {
  public:
   SlowConstructor() : some_int_(0) {
-    PlatformThread::Sleep(1000);  // Sleep for 1 second to try to cause a race.
+    // Sleep for 1 second to try to cause a race.
+    base::PlatformThread::Sleep(1000);
     ++constructed;
     some_int_ = 12;
   }
diff --git a/base/lock.cc b/base/lock.cc
index c73a458..dc21271 100644
--- a/base/lock.cc
+++ b/base/lock.cc
@@ -11,6 +11,9 @@
 #include "base/lock.h"
 #include "base/logging.h"
 
+using base::PlatformThread;
+using base::PlatformThreadId;
+
 Lock::Lock() : lock_() {
   owned_by_thread_ = false;
   owning_thread_id_ = static_cast<PlatformThreadId>(0);
diff --git a/base/lock.h b/base/lock.h
index ba34964..672e3fb 100644
--- a/base/lock.h
+++ b/base/lock.h
@@ -7,7 +7,7 @@
 #pragma once
 
 #include "base/lock_impl.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
 
 // A convenient wrapper for an OS specific critical section.  The only real
 // intelligence in this class is in debug mode for the support for the
@@ -80,7 +80,7 @@
   // Determines validity of owning_thread_id_.  Needed as we don't have
   // a null owning_thread_id_ value.
   bool owned_by_thread_;
-  PlatformThreadId owning_thread_id_;
+  base::PlatformThreadId owning_thread_id_;
 #endif  // NDEBUG
 
   LockImpl lock_;  // Platform specific underlying lock implementation.
diff --git a/base/lock_unittest.cc b/base/lock_unittest.cc
index cf99df9..a0a8d48 100644
--- a/base/lock_unittest.cc
+++ b/base/lock_unittest.cc
@@ -6,9 +6,13 @@
 
 #include <stdlib.h>
 
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
+using base::kNullThreadHandle;
+using base::PlatformThread;
+using base::PlatformThreadHandle;
+
 typedef testing::Test LockTest;
 
 // Basic test to make sure that Acquire()/Release()/Try() don't crash ----------
diff --git a/base/message_loop_unittest.cc b/base/message_loop_unittest.cc
index a196519..2217737 100644
--- a/base/message_loop_unittest.cc
+++ b/base/message_loop_unittest.cc
@@ -7,9 +7,9 @@
 #include "base/eintr_wrapper.h"
 #include "base/logging.h"
 #include "base/message_loop.h"
-#include "base/platform_thread.h"
 #include "base/ref_counted.h"
 #include "base/task.h"
+#include "base/threading/platform_thread.h"
 #include "base/thread.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -21,6 +21,7 @@
 #include "base/message_pump_libevent.h"
 #endif
 
+using base::PlatformThread;
 using base::Thread;
 using base::Time;
 using base::TimeDelta;
diff --git a/base/message_pump_glib.cc b/base/message_pump_glib.cc
index fd24285..b9dcc46 100644
--- a/base/message_pump_glib.cc
+++ b/base/message_pump_glib.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 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.
 
@@ -12,7 +12,7 @@
 
 #include "base/eintr_wrapper.h"
 #include "base/logging.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
 
 namespace {
 
@@ -177,8 +177,8 @@
 #ifndef NDEBUG
   // Make sure we only run this on one thread.  GTK only has one message pump
   // so we can only have one UI loop per process.
-  static PlatformThreadId thread_id = PlatformThread::CurrentId();
-  DCHECK(thread_id == PlatformThread::CurrentId()) <<
+  static base::PlatformThreadId thread_id = base::PlatformThread::CurrentId();
+  DCHECK(thread_id == base::PlatformThread::CurrentId()) <<
       "Running MessagePumpForUI on two different threads; "
       "this is unsupported by GLib!";
 #endif
diff --git a/base/message_pump_glib_unittest.cc b/base/message_pump_glib_unittest.cc
index 72d2fbf..7316070 100644
--- a/base/message_pump_glib_unittest.cc
+++ b/base/message_pump_glib_unittest.cc
@@ -11,7 +11,6 @@
 #include <vector>
 
 #include "base/message_loop.h"
-#include "base/platform_thread.h"
 #include "base/ref_counted.h"
 #include "base/thread.h"
 #include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/metrics/stats_table.cc b/base/metrics/stats_table.cc
index a5e85c9..0e4cad9 100644
--- a/base/metrics/stats_table.cc
+++ b/base/metrics/stats_table.cc
@@ -5,12 +5,12 @@
 #include "base/metrics/stats_table.h"
 
 #include "base/logging.h"
-#include "base/platform_thread.h"
 #include "base/process_util.h"
 #include "base/scoped_ptr.h"
 #include "base/shared_memory.h"
 #include "base/string_piece.h"
 #include "base/string_util.h"
+#include "base/threading/platform_thread.h"
 #include "base/threading/thread_local_storage.h"
 #include "base/utf_string_conversions.h"
 
diff --git a/base/metrics/stats_table_unittest.cc b/base/metrics/stats_table_unittest.cc
index 9052244..944813d 100644
--- a/base/metrics/stats_table_unittest.cc
+++ b/base/metrics/stats_table_unittest.cc
@@ -4,11 +4,11 @@
 
 #include "base/metrics/stats_counters.h"
 #include "base/metrics/stats_table.h"
-#include "base/platform_thread.h"
 #include "base/shared_memory.h"
 #include "base/string_piece.h"
 #include "base/string_util.h"
 #include "base/test/multiprocess_test.h"
+#include "base/threading/platform_thread.h"
 #include "base/threading/simple_thread.h"
 #include "base/utf_string_conversions.h"
 #include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/non_thread_safe.h b/base/non_thread_safe.h
index 6f993ee..24a9012 100644
--- a/base/non_thread_safe.h
+++ b/base/non_thread_safe.h
@@ -6,8 +6,7 @@
 #define BASE_NON_THREAD_SAFE_H_
 #pragma once
 
-#include "base/platform_thread.h"
-#include "base/thread_checker.h"
+#include "base/threading/thread_checker.h"
 
 // A helper class used to help verify that methods of a class are
 // called from the same thread.  One can inherit from this class and use
@@ -43,7 +42,7 @@
   void DetachFromThread();
 
  private:
-  ThreadChecker thread_checker_;
+  base::ThreadChecker thread_checker_;
 };
 #else
 // Do nothing in release mode.
diff --git a/base/observer_list_unittest.cc b/base/observer_list_unittest.cc
index 6b57550..652d358 100644
--- a/base/observer_list_unittest.cc
+++ b/base/observer_list_unittest.cc
@@ -8,17 +8,15 @@
 #include <vector>
 
 #include "base/message_loop.h"
-#include "base/platform_thread.h"
 #include "base/ref_counted.h"
+#include "base/threading/platform_thread.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
+using base::PlatformThread;
 using base::Time;
 
 namespace {
 
-class ObserverListTest : public testing::Test {
-};
-
 class Foo {
  public:
   virtual void Observe(int x) = 0;
@@ -291,7 +289,7 @@
   observer_list->AddObserver(&b);
 
   AddRemoveThread* threaded_observer[kMaxThreads];
-  PlatformThreadHandle threads[kMaxThreads];
+  base::PlatformThreadHandle threads[kMaxThreads];
   for (int index = 0; index < num_threads; index++) {
     threaded_observer[index] = new AddRemoveThread(observer_list.get(), false);
     EXPECT_TRUE(PlatformThread::Create(0,
diff --git a/base/platform_thread.h b/base/platform_thread.h
index 43bf298..36f8f07 100644
--- a/base/platform_thread.h
+++ b/base/platform_thread.h
@@ -1,87 +1,24 @@
-// 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.
 
-// WARNING: You should *NOT* be using this class directly.  PlatformThread is
-// the low-level platform-specific abstraction to the OS's threading interface.
-// You should instead be using a message-loop driven Thread, see thread.h.
 
 #ifndef BASE_PLATFORM_THREAD_H_
 #define BASE_PLATFORM_THREAD_H_
 #pragma once
 
-#include "base/basictypes.h"
+// This file is for backwards-compatibility to keep things compiling that use
+// the old location & lack of namespace.
+//
+// TODO(brettw) make all callers use the new location & namespace and delete
+// this file.
 
-// PlatformThreadHandle should not be assumed to be a numeric type, since the
-// standard intends to allow pthread_t to be a structure.  This means you
-// should not initialize it to a value, like 0.  If it's a member variable, the
-// constructor can safely "value initialize" using () in the initializer list.
-#if defined(OS_WIN)
-#include <windows.h>
-typedef DWORD PlatformThreadId;
-typedef void* PlatformThreadHandle;  // HANDLE
-const PlatformThreadHandle kNullThreadHandle = NULL;
-#elif defined(OS_POSIX)
-#include <pthread.h>
-typedef pthread_t PlatformThreadHandle;
-const PlatformThreadHandle kNullThreadHandle = 0;
-#if defined(OS_MACOSX)
-#include <mach/mach.h>
-typedef mach_port_t PlatformThreadId;
-#else  // OS_POSIX && !OS_MACOSX
-#include <unistd.h>
-typedef pid_t PlatformThreadId;
-#endif
-#endif
+#include "base/threading/platform_thread.h"
 
-const PlatformThreadId kInvalidThreadId = 0;
-
-// A namespace for low-level thread functions.
-class PlatformThread {
- public:
-  // Implement this interface to run code on a background thread.  Your
-  // ThreadMain method will be called on the newly created thread.
-  class Delegate {
-   public:
-    virtual ~Delegate() {}
-    virtual void ThreadMain() = 0;
-  };
-
-  // Gets the current thread id, which may be useful for logging purposes.
-  static PlatformThreadId CurrentId();
-
-  // Yield the current thread so another thread can be scheduled.
-  static void YieldCurrentThread();
-
-  // Sleeps for the specified duration (units are milliseconds).
-  static void Sleep(int duration_ms);
-
-  // Sets the thread name visible to a debugger.  This has no effect otherwise.
-  static void SetName(const char* name);
-
-  // Creates a new thread.  The |stack_size| parameter can be 0 to indicate
-  // that the default stack size should be used.  Upon success,
-  // |*thread_handle| will be assigned a handle to the newly created thread,
-  // and |delegate|'s ThreadMain method will be executed on the newly created
-  // thread.
-  // NOTE: When you are done with the thread handle, you must call Join to
-  // release system resources associated with the thread.  You must ensure that
-  // the Delegate object outlives the thread.
-  static bool Create(size_t stack_size, Delegate* delegate,
-                     PlatformThreadHandle* thread_handle);
-
-  // CreateNonJoinable() does the same thing as Create() except the thread
-  // cannot be Join()'d.  Therefore, it also does not output a
-  // PlatformThreadHandle.
-  static bool CreateNonJoinable(size_t stack_size, Delegate* delegate);
-
-  // Joins with a thread created via the Create function.  This function blocks
-  // the caller until the designated thread exits.  This will invalidate
-  // |thread_handle|.
-  static void Join(PlatformThreadHandle thread_handle);
-
- private:
-  DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread);
-};
+using base::PlatformThread;
+using base::PlatformThreadHandle;
+using base::PlatformThreadId;
+using base::kNullThreadHandle;
+using base::kInvalidThreadId;
 
 #endif  // BASE_PLATFORM_THREAD_H_
diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc
index cd2eedd..0116d8f 100644
--- a/base/process_util_posix.cc
+++ b/base/process_util_posix.cc
@@ -22,10 +22,10 @@
 #include "base/dir_reader_posix.h"
 #include "base/eintr_wrapper.h"
 #include "base/logging.h"
-#include "base/platform_thread.h"
 #include "base/process_util.h"
 #include "base/scoped_ptr.h"
 #include "base/stringprintf.h"
+#include "base/threading/platform_thread.h"
 #include "base/thread_restrictions.h"
 #include "base/time.h"
 #include "base/waitable_event.h"
@@ -893,7 +893,7 @@
       result = true;
       break;
     }
-    PlatformThread::Sleep(100);
+    base::PlatformThread::Sleep(100);
   } while ((base::Time::Now() - end_time) > base::TimeDelta());
 
   return result;
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc
index 0eaf5d4..fd05c23 100644
--- a/base/process_util_unittest.cc
+++ b/base/process_util_unittest.cc
@@ -12,11 +12,11 @@
 #include "base/file_path.h"
 #include "base/logging.h"
 #include "base/path_service.h"
-#include "base/platform_thread.h"
 #include "base/process_util.h"
 #include "base/scoped_ptr.h"
 #include "base/test/multiprocess_test.h"
 #include "base/test/test_timeouts.h"
+#include "base/threading/platform_thread.h"
 #include "base/utf_string_conversions.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "testing/multiprocess_func_list.h"
@@ -67,7 +67,7 @@
 void WaitToDie(const char* filename) {
   FILE *fp;
   do {
-    PlatformThread::Sleep(10);
+    base::PlatformThread::Sleep(10);
     fp = fopen(filename, "r");
   } while (!fp);
   fclose(fp);
@@ -92,7 +92,7 @@
   int waited = 0;
   do {
     status = base::GetTerminationStatus(handle, exit_code);
-    PlatformThread::Sleep(kIntervalMs);
+    base::PlatformThread::Sleep(kIntervalMs);
     waited += kIntervalMs;
   } while (status == base::TERMINATION_STATUS_STILL_RUNNING &&
            waited < kMaxWaitTimeMs);
diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc
index 67161597..f86b46c 100644
--- a/base/shared_memory_posix.cc
+++ b/base/shared_memory_posix.cc
@@ -12,7 +12,7 @@
 
 #include "base/file_util.h"
 #include "base/logging.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
 #include "base/safe_strerror_posix.h"
 #include "base/thread_restrictions.h"
 #include "base/utf_string_conversions.h"
@@ -299,7 +299,7 @@
       continue;
     } else if (errno == ENOLCK) {
       // temporary kernel resource exaustion
-      PlatformThread::Sleep(500);
+      base::PlatformThread::Sleep(500);
       continue;
     } else {
       NOTREACHED() << "lockf() failed."
diff --git a/base/shared_memory_unittest.cc b/base/shared_memory_unittest.cc
index f646158..b515e79 100644
--- a/base/shared_memory_unittest.cc
+++ b/base/shared_memory_unittest.cc
@@ -4,10 +4,10 @@
 
 #include "base/basictypes.h"
 #include "base/mac/scoped_nsautorelease_pool.h"
-#include "base/platform_thread.h"
 #include "base/shared_memory.h"
 #include "base/scoped_ptr.h"
 #include "base/test/multiprocess_test.h"
+#include "base/threading/platform_thread.h"
 #include "base/time.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "testing/multiprocess_func_list.h"
@@ -327,7 +327,7 @@
 
 // On POSIX it is especially important we test shmem across processes,
 // not just across threads.  But the test is enabled on all platforms.
-class SharedMemoryProcessTest : public base::MultiProcessTest {
+class SharedMemoryProcessTest : public MultiProcessTest {
  public:
 
   static void CleanUp() {
@@ -380,14 +380,14 @@
 TEST_F(SharedMemoryProcessTest, MAYBE_Tasks) {
   SharedMemoryProcessTest::CleanUp();
 
-  base::ProcessHandle handles[kNumTasks];
+  ProcessHandle handles[kNumTasks];
   for (int index = 0; index < kNumTasks; ++index) {
     handles[index] = SpawnChild("SharedMemoryTestMain", false);
   }
 
   int exit_code = 0;
   for (int index = 0; index < kNumTasks; ++index) {
-    EXPECT_TRUE(base::WaitForExitCode(handles[index], &exit_code));
+    EXPECT_TRUE(WaitForExitCode(handles[index], &exit_code));
     EXPECT_TRUE(exit_code == 0);
   }
 
diff --git a/base/singleton.h b/base/singleton.h
index e5713c4..a644156 100644
--- a/base/singleton.h
+++ b/base/singleton.h
@@ -8,8 +8,8 @@
 
 #include "base/at_exit.h"
 #include "base/atomicops.h"
-#include "base/platform_thread.h"
 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
+#include "base/threading/platform_thread.h"
 #include "base/thread_restrictions.h"
 
 // Default traits for Singleton<Type>. Calls operator new and operator delete on
@@ -243,7 +243,7 @@
       value = base::subtle::NoBarrier_Load(&instance_);
       if (value != kBeingCreatedMarker)
         break;
-      PlatformThread::YieldCurrentThread();
+      base::PlatformThread::YieldCurrentThread();
     }
 
     // See the corresponding HAPPENS_BEFORE above.
diff --git a/base/spin_wait.h b/base/spin_wait.h
index 34484d2..1e31b14 100644
--- a/base/spin_wait.h
+++ b/base/spin_wait.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.
 
@@ -12,11 +12,11 @@
 // We provide a simple one argument spin wait (for 1 second), and a generic
 // spin wait (for longer periods of time).
 
-#ifndef BASE_SPIN_WAIT_H__
-#define BASE_SPIN_WAIT_H__
+#ifndef BASE_SPIN_WAIT_H_
+#define BASE_SPIN_WAIT_H_
 #pragma once
 
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
 #include "base/time.h"
 
 // Provide a macro that will wait no longer than 1 second for an asynchronous
@@ -44,8 +44,8 @@
                 kTimeout.InMilliseconds()) << "Timed out"; \
         break; \
       } \
-      PlatformThread::Sleep(50); \
+      base::PlatformThread::Sleep(50); \
     } \
   } while (0)
 
-#endif  // BASE_SPIN_WAIT_H__
+#endif  // BASE_SPIN_WAIT_H_
diff --git a/base/task.h b/base/task.h
index e6e0d2d..85c0878 100644
--- a/base/task.h
+++ b/base/task.h
@@ -228,7 +228,7 @@
 struct RunnableMethodTraits {
   RunnableMethodTraits() {
 #ifndef NDEBUG
-    origin_thread_id_ = PlatformThread::CurrentId();
+    origin_thread_id_ = base::PlatformThread::CurrentId();
 #endif
   }
 
@@ -236,7 +236,7 @@
 #ifndef NDEBUG
     // If destroyed on a separate thread, then we had better have been using
     // thread-safe reference counting!
-    if (origin_thread_id_ != PlatformThread::CurrentId())
+    if (origin_thread_id_ != base::PlatformThread::CurrentId())
       DCHECK(T::ImplementsThreadSafeReferenceCounting());
 #endif
   }
@@ -258,7 +258,7 @@
 
  private:
 #ifndef NDEBUG
-  PlatformThreadId origin_thread_id_;
+  base::PlatformThreadId origin_thread_id_;
 #endif
 };
 
diff --git a/base/thread.h b/base/thread.h
index fc542f0..17bd33b 100644
--- a/base/thread.h
+++ b/base/thread.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-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.
 
@@ -10,7 +10,7 @@
 
 #include "base/message_loop.h"
 #include "base/message_loop_proxy.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
 
 namespace base {
 
diff --git a/base/thread_collision_warner.cc b/base/thread_collision_warner.cc
index 1a13643..be68bc5 100644
--- a/base/thread_collision_warner.cc
+++ b/base/thread_collision_warner.cc
@@ -5,7 +5,7 @@
 #include "base/thread_collision_warner.h"
 
 #include "base/logging.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
 
 namespace base {
 
diff --git a/base/thread_collision_warner_unittest.cc b/base/thread_collision_warner_unittest.cc
index e563036..d7e1732 100644
--- a/base/thread_collision_warner_unittest.cc
+++ b/base/thread_collision_warner_unittest.cc
@@ -1,11 +1,11 @@
-// Copyright (c) 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/compiler_specific.h"
 #include "base/lock.h"
-#include "base/platform_thread.h"
 #include "base/scoped_ptr.h"
+#include "base/threading/platform_thread.h"
 #include "base/threading/simple_thread.h"
 #include "base/thread_collision_warner.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -190,7 +190,7 @@
 
     void push(int value) {
       DFAKE_SCOPED_LOCK(push_pop_);
-      PlatformThread::Sleep(5000);
+      base::PlatformThread::Sleep(5000);
     }
 
     int pop() {
@@ -248,7 +248,7 @@
 
     void push(int value) {
       DFAKE_SCOPED_LOCK(push_pop_);
-      PlatformThread::Sleep(2000);
+      base::PlatformThread::Sleep(2000);
     }
 
     int pop() {
@@ -318,7 +318,7 @@
     void push(int) {
       DFAKE_SCOPED_RECURSIVE_LOCK(push_pop_);
       bar();
-      PlatformThread::Sleep(2000);
+      base::PlatformThread::Sleep(2000);
     }
 
     int pop() {
diff --git a/base/thread_unittest.cc b/base/thread_unittest.cc
index 6b72b83..6eff102 100644
--- a/base/thread_unittest.cc
+++ b/base/thread_unittest.cc
@@ -35,7 +35,7 @@
   explicit SleepSome(int msec) : msec_(msec) {
   }
   virtual void Run() {
-    PlatformThread::Sleep(msec_);
+    base::PlatformThread::Sleep(msec_);
   }
  private:
   int msec_;
@@ -47,7 +47,7 @@
   virtual ~SleepInsideInitThread() { }
 
   virtual void Init() {
-    PlatformThread::Sleep(500);
+    base::PlatformThread::Sleep(500);
     init_called_ = true;
   }
   bool InitCalled() { return init_called_; }
@@ -178,7 +178,7 @@
   // instead to avoid busy waiting, but this is sufficient for
   // testing purposes).
   for (int i = 100; i >= 0 && !was_invoked; --i) {
-    PlatformThread::Sleep(10);
+    base::PlatformThread::Sleep(10);
   }
   EXPECT_TRUE(was_invoked);
 }
diff --git a/base/threading/platform_thread.h b/base/threading/platform_thread.h
new file mode 100644
index 0000000..0a3c75d
--- /dev/null
+++ b/base/threading/platform_thread.h
@@ -0,0 +1,99 @@
+// 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.
+
+// WARNING: You should *NOT* be using this class directly.  PlatformThread is
+// the low-level platform-specific abstraction to the OS's threading interface.
+// You should instead be using a message-loop driven Thread, see thread.h.
+
+#ifndef BASE_THREADING_PLATFORM_THREAD_H_
+#define BASE_THREADING_PLATFORM_THREAD_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "build/build_config.h"
+
+#if defined(OS_WIN)
+#include <windows.h>
+#elif defined(OS_POSIX)
+#include <pthread.h>
+#if defined(OS_MACOSX)
+#include <mach/mach.h>
+#else  // OS_POSIX && !OS_MACOSX
+#include <unistd.h>
+#endif
+#endif
+
+namespace base {
+
+// PlatformThreadHandle should not be assumed to be a numeric type, since the
+// standard intends to allow pthread_t to be a structure.  This means you
+// should not initialize it to a value, like 0.  If it's a member variable, the
+// constructor can safely "value initialize" using () in the initializer list.
+#if defined(OS_WIN)
+typedef DWORD PlatformThreadId;
+typedef void* PlatformThreadHandle;  // HANDLE
+const PlatformThreadHandle kNullThreadHandle = NULL;
+#elif defined(OS_POSIX)
+typedef pthread_t PlatformThreadHandle;
+const PlatformThreadHandle kNullThreadHandle = 0;
+#if defined(OS_MACOSX)
+typedef mach_port_t PlatformThreadId;
+#else  // OS_POSIX && !OS_MACOSX
+typedef pid_t PlatformThreadId;
+#endif
+#endif
+
+const PlatformThreadId kInvalidThreadId = 0;
+
+// A namespace for low-level thread functions.
+class PlatformThread {
+ public:
+  // Implement this interface to run code on a background thread.  Your
+  // ThreadMain method will be called on the newly created thread.
+  class Delegate {
+   public:
+    virtual ~Delegate() {}
+    virtual void ThreadMain() = 0;
+  };
+
+  // Gets the current thread id, which may be useful for logging purposes.
+  static PlatformThreadId CurrentId();
+
+  // Yield the current thread so another thread can be scheduled.
+  static void YieldCurrentThread();
+
+  // Sleeps for the specified duration (units are milliseconds).
+  static void Sleep(int duration_ms);
+
+  // Sets the thread name visible to a debugger.  This has no effect otherwise.
+  static void SetName(const char* name);
+
+  // Creates a new thread.  The |stack_size| parameter can be 0 to indicate
+  // that the default stack size should be used.  Upon success,
+  // |*thread_handle| will be assigned a handle to the newly created thread,
+  // and |delegate|'s ThreadMain method will be executed on the newly created
+  // thread.
+  // NOTE: When you are done with the thread handle, you must call Join to
+  // release system resources associated with the thread.  You must ensure that
+  // the Delegate object outlives the thread.
+  static bool Create(size_t stack_size, Delegate* delegate,
+                     PlatformThreadHandle* thread_handle);
+
+  // CreateNonJoinable() does the same thing as Create() except the thread
+  // cannot be Join()'d.  Therefore, it also does not output a
+  // PlatformThreadHandle.
+  static bool CreateNonJoinable(size_t stack_size, Delegate* delegate);
+
+  // Joins with a thread created via the Create function.  This function blocks
+  // the caller until the designated thread exits.  This will invalidate
+  // |thread_handle|.
+  static void Join(PlatformThreadHandle thread_handle);
+
+ private:
+  DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread);
+};
+
+}  // namespace base
+
+#endif  // BASE_THREADING_PLATFORM_THREAD_H_
diff --git a/base/platform_thread_posix.cc b/base/threading/platform_thread_posix.cc
similarity index 97%
rename from base/platform_thread_posix.cc
rename to base/threading/platform_thread_posix.cc
index 9807ac6..0ef4990 100644
--- a/base/platform_thread_posix.cc
+++ b/base/threading/platform_thread_posix.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/platform_thread.h"
+#include "base/threading/platform_thread.h"
 
 #include <errno.h>
 #include <sched.h>
@@ -29,10 +29,10 @@
 #include <sys/nacl_syscalls.h>
 #endif
 
-#if defined(OS_MACOSX)
 namespace base {
+
+#if defined(OS_MACOSX)
 void InitThreading();
-}  // namespace base
 #endif
 
 namespace {
@@ -42,9 +42,7 @@
   bool joinable;
 };
 
-}  // namespace
-
-static void* ThreadFunc(void* params) {
+void* ThreadFunc(void* params) {
   ThreadParams* thread_params = static_cast<ThreadParams*>(params);
   PlatformThread::Delegate* delegate = thread_params->delegate;
   if (!thread_params->joinable)
@@ -54,6 +52,70 @@
   return NULL;
 }
 
+bool CreateThread(size_t stack_size, bool joinable,
+                  PlatformThread::Delegate* delegate,
+                  PlatformThreadHandle* thread_handle) {
+#if defined(OS_MACOSX)
+  base::InitThreading();
+#endif  // OS_MACOSX
+
+  bool success = false;
+  pthread_attr_t attributes;
+  pthread_attr_init(&attributes);
+
+  // Pthreads are joinable by default, so only specify the detached attribute if
+  // the thread should be non-joinable.
+  if (!joinable) {
+    pthread_attr_setdetachstate(&attributes, PTHREAD_CREATE_DETACHED);
+  }
+
+#if defined(OS_MACOSX)
+  // The Mac OS X default for a pthread stack size is 512kB.
+  // Libc-594.1.4/pthreads/pthread.c's pthread_attr_init uses
+  // DEFAULT_STACK_SIZE for this purpose.
+  //
+  // 512kB isn't quite generous enough for some deeply recursive threads that
+  // otherwise request the default stack size by specifying 0. Here, adopt
+  // glibc's behavior as on Linux, which is to use the current stack size
+  // limit (ulimit -s) as the default stack size. See
+  // glibc-2.11.1/nptl/nptl-init.c's __pthread_initialize_minimal_internal. To
+  // avoid setting the limit below the Mac OS X default or the minimum usable
+  // stack size, these values are also considered. If any of these values
+  // can't be determined, or if stack size is unlimited (ulimit -s unlimited),
+  // stack_size is left at 0 to get the system default.
+  //
+  // Mac OS X normally only applies ulimit -s to the main thread stack. On
+  // contemporary OS X and Linux systems alike, this value is generally 8MB
+  // or in that neighborhood.
+  if (stack_size == 0) {
+    size_t default_stack_size;
+    struct rlimit stack_rlimit;
+    if (pthread_attr_getstacksize(&attributes, &default_stack_size) == 0 &&
+        getrlimit(RLIMIT_STACK, &stack_rlimit) == 0 &&
+        stack_rlimit.rlim_cur != RLIM_INFINITY) {
+      stack_size = std::max(std::max(default_stack_size,
+                                     static_cast<size_t>(PTHREAD_STACK_MIN)),
+                            static_cast<size_t>(stack_rlimit.rlim_cur));
+    }
+  }
+#endif  // OS_MACOSX
+
+  if (stack_size > 0)
+    pthread_attr_setstacksize(&attributes, stack_size);
+
+  ThreadParams* params = new ThreadParams;
+  params->delegate = delegate;
+  params->joinable = joinable;
+  success = !pthread_create(thread_handle, &attributes, ThreadFunc, params);
+
+  pthread_attr_destroy(&attributes);
+  if (!success)
+    delete params;
+  return success;
+}
+
+}  // namespace
+
 // static
 PlatformThreadId PlatformThread::CurrentId() {
   // Pthreads doesn't have the concept of a thread ID, so we have to reach down
@@ -135,72 +197,6 @@
 }
 #endif  // defined(OS_LINUX)
 
-namespace {
-
-bool CreateThread(size_t stack_size, bool joinable,
-                  PlatformThread::Delegate* delegate,
-                  PlatformThreadHandle* thread_handle) {
-#if defined(OS_MACOSX)
-  base::InitThreading();
-#endif  // OS_MACOSX
-
-  bool success = false;
-  pthread_attr_t attributes;
-  pthread_attr_init(&attributes);
-
-  // Pthreads are joinable by default, so only specify the detached attribute if
-  // the thread should be non-joinable.
-  if (!joinable) {
-    pthread_attr_setdetachstate(&attributes, PTHREAD_CREATE_DETACHED);
-  }
-
-#if defined(OS_MACOSX)
-  // The Mac OS X default for a pthread stack size is 512kB.
-  // Libc-594.1.4/pthreads/pthread.c's pthread_attr_init uses
-  // DEFAULT_STACK_SIZE for this purpose.
-  //
-  // 512kB isn't quite generous enough for some deeply recursive threads that
-  // otherwise request the default stack size by specifying 0. Here, adopt
-  // glibc's behavior as on Linux, which is to use the current stack size
-  // limit (ulimit -s) as the default stack size. See
-  // glibc-2.11.1/nptl/nptl-init.c's __pthread_initialize_minimal_internal. To
-  // avoid setting the limit below the Mac OS X default or the minimum usable
-  // stack size, these values are also considered. If any of these values
-  // can't be determined, or if stack size is unlimited (ulimit -s unlimited),
-  // stack_size is left at 0 to get the system default.
-  //
-  // Mac OS X normally only applies ulimit -s to the main thread stack. On
-  // contemporary OS X and Linux systems alike, this value is generally 8MB
-  // or in that neighborhood.
-  if (stack_size == 0) {
-    size_t default_stack_size;
-    struct rlimit stack_rlimit;
-    if (pthread_attr_getstacksize(&attributes, &default_stack_size) == 0 &&
-        getrlimit(RLIMIT_STACK, &stack_rlimit) == 0 &&
-        stack_rlimit.rlim_cur != RLIM_INFINITY) {
-      stack_size = std::max(std::max(default_stack_size,
-                                     static_cast<size_t>(PTHREAD_STACK_MIN)),
-                            static_cast<size_t>(stack_rlimit.rlim_cur));
-    }
-  }
-#endif  // OS_MACOSX
-
-  if (stack_size > 0)
-    pthread_attr_setstacksize(&attributes, stack_size);
-
-  ThreadParams* params = new ThreadParams;
-  params->delegate = delegate;
-  params->joinable = joinable;
-  success = !pthread_create(thread_handle, &attributes, ThreadFunc, params);
-
-  pthread_attr_destroy(&attributes);
-  if (!success)
-    delete params;
-  return success;
-}
-
-}  // anonymous namespace
-
 // static
 bool PlatformThread::Create(size_t stack_size, Delegate* delegate,
                             PlatformThreadHandle* thread_handle) {
@@ -225,3 +221,5 @@
   base::ThreadRestrictions::AssertIOAllowed();
   pthread_join(thread_handle, NULL);
 }
+
+}  // namespace base
diff --git a/base/platform_thread_unittest.cc b/base/threading/platform_thread_unittest.cc
similarity index 91%
rename from base/platform_thread_unittest.cc
rename to base/threading/platform_thread_unittest.cc
index 9875aa8..4b49450 100644
--- a/base/platform_thread_unittest.cc
+++ b/base/threading/platform_thread_unittest.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
 
 #include "testing/gtest/include/gtest/gtest.h"
 
-typedef testing::Test PlatformThreadTest;
+namespace base {
 
 // Trivial tests that thread runs and doesn't crash on create and join ---------
 
@@ -26,7 +26,7 @@
   DISALLOW_COPY_AND_ASSIGN(TrivialThread);
 };
 
-TEST_F(PlatformThreadTest, Trivial) {
+TEST(PlatformThreadTest, Trivial) {
   TrivialThread thread;
   PlatformThreadHandle handle = kNullThreadHandle;
 
@@ -36,7 +36,7 @@
   ASSERT_TRUE(thread.did_run());
 }
 
-TEST_F(PlatformThreadTest, TrivialTimesTen) {
+TEST(PlatformThreadTest, TrivialTimesTen) {
   TrivialThread thread[10];
   PlatformThreadHandle handle[arraysize(thread)];
 
@@ -72,7 +72,7 @@
   DISALLOW_COPY_AND_ASSIGN(FunctionTestThread);
 };
 
-TEST_F(PlatformThreadTest, Function) {
+TEST(PlatformThreadTest, Function) {
   PlatformThreadId main_thread_id = PlatformThread::CurrentId();
 
   FunctionTestThread thread;
@@ -85,7 +85,7 @@
   EXPECT_NE(thread.thread_id(), main_thread_id);
 }
 
-TEST_F(PlatformThreadTest, FunctionTimesTen) {
+TEST(PlatformThreadTest, FunctionTimesTen) {
   PlatformThreadId main_thread_id = PlatformThread::CurrentId();
 
   FunctionTestThread thread[10];
@@ -102,3 +102,5 @@
     EXPECT_NE(thread[n].thread_id(), main_thread_id);
   }
 }
+
+}  // namespace base
diff --git a/base/threading/simple_thread.cc b/base/threading/simple_thread.cc
index df1953f..2b030f6 100644
--- a/base/threading/simple_thread.cc
+++ b/base/threading/simple_thread.cc
@@ -5,7 +5,7 @@
 #include "base/threading/simple_thread.h"
 
 #include "base/logging.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
 #include "base/string_number_conversions.h"
 
 namespace base {
diff --git a/base/threading/simple_thread.h b/base/threading/simple_thread.h
index dbff3ae..c401e01 100644
--- a/base/threading/simple_thread.h
+++ b/base/threading/simple_thread.h
@@ -47,8 +47,8 @@
 
 #include "base/basictypes.h"
 #include "base/lock.h"
+#include "base/threading/platform_thread.h"
 #include "base/waitable_event.h"
-#include "base/platform_thread.h"
 
 namespace base {
 
diff --git a/base/thread_checker.cc b/base/threading/thread_checker.cc
similarity index 90%
rename from base/thread_checker.cc
rename to base/threading/thread_checker.cc
index 52f9847..28ba400 100644
--- a/base/thread_checker.cc
+++ b/base/threading/thread_checker.cc
@@ -2,11 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "base/thread_checker.h"
+#include "base/threading/thread_checker.h"
 
 // This code is only done in debug builds.
 #ifndef NDEBUG
 
+namespace base {
+
 ThreadChecker::ThreadChecker() : valid_thread_id_(kInvalidThreadId) {
   EnsureThreadIdAssigned();
 }
@@ -31,4 +33,6 @@
   valid_thread_id_ = PlatformThread::CurrentId();
 }
 
+}  // namespace base
+
 #endif  // NDEBUG
diff --git a/base/thread_checker.h b/base/threading/thread_checker.h
similarity index 88%
rename from base/thread_checker.h
rename to base/threading/thread_checker.h
index c09bcbe..c0010fb 100644
--- a/base/thread_checker.h
+++ b/base/threading/thread_checker.h
@@ -2,15 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef BASE_THREAD_CHECKER_H_
-#define BASE_THREAD_CHECKER_H_
+#ifndef BASE_THREADING_THREAD_CHECKER_H_
+#define BASE_THREADING_THREAD_CHECKER_H_
 #pragma once
 
 #ifndef NDEBUG
 #include "base/lock.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
 #endif // NDEBUG
 
+namespace base {
+
 // Before using this class, please consider using NonThreadSafe as it
 // makes it much easier to determine the nature of your class.
 //
@@ -66,4 +68,6 @@
 };
 #endif  // NDEBUG
 
-#endif  // BASE_THREAD_CHECKER_H_
+}  // namespace base
+
+#endif  // BASE_THREADING_THREAD_CHECKER_H_
diff --git a/base/thread_checker_unittest.cc b/base/threading/thread_checker_unittest.cc
similarity index 97%
rename from base/thread_checker_unittest.cc
rename to base/threading/thread_checker_unittest.cc
index 2b4aa7a..6ce5bf1 100644
--- a/base/thread_checker_unittest.cc
+++ b/base/threading/thread_checker_unittest.cc
@@ -4,13 +4,15 @@
 
 #include "base/basictypes.h"
 #include "base/logging.h"
-#include "base/thread_checker.h"
 #include "base/scoped_ptr.h"
+#include "base/threading/thread_checker.h"
 #include "base/threading/simple_thread.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 #ifndef NDEBUG
 
+namespace base {
+
 // Simple class to exersice the basics of ThreadChecker.
 // Both the destructor and DoStuff should verify that they were
 // called on the same thread as the constructor.
@@ -139,4 +141,6 @@
 
 #endif  // GTEST_HAS_DEATH_TEST
 
+}  // namespace base
+
 #endif  // NDEBUG
diff --git a/base/threading/watchdog.cc b/base/threading/watchdog.cc
index 8474744..cd21578 100644
--- a/base/threading/watchdog.cc
+++ b/base/threading/watchdog.cc
@@ -6,7 +6,7 @@
 
 #include "base/compiler_specific.h"
 #include "base/logging.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
 
 namespace base {
 
diff --git a/base/threading/watchdog.h b/base/threading/watchdog.h
index 025fe09..8641f04 100644
--- a/base/threading/watchdog.h
+++ b/base/threading/watchdog.h
@@ -23,7 +23,7 @@
 
 #include "base/condition_variable.h"
 #include "base/lock.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
 #include "base/time.h"
 
 namespace base {
diff --git a/base/threading/watchdog_unittest.cc b/base/threading/watchdog_unittest.cc
index 347781e..f96487b 100644
--- a/base/threading/watchdog_unittest.cc
+++ b/base/threading/watchdog_unittest.cc
@@ -5,8 +5,8 @@
 #include "base/threading/watchdog.h"
 
 #include "base/logging.h"
-#include "base/platform_thread.h"
 #include "base/spin_wait.h"
+#include "base/threading/platform_thread.h"
 #include "base/time.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/base/threading/worker_pool_posix.cc b/base/threading/worker_pool_posix.cc
index 2facc01..8466403 100644
--- a/base/threading/worker_pool_posix.cc
+++ b/base/threading/worker_pool_posix.cc
@@ -6,10 +6,10 @@
 
 #include "base/lazy_instance.h"
 #include "base/logging.h"
-#include "base/platform_thread.h"
 #include "base/ref_counted.h"
 #include "base/stringprintf.h"
 #include "base/task.h"
+#include "base/threading/platform_thread.h"
 #include "base/threading/worker_pool.h"
 
 namespace base {
diff --git a/base/threading/worker_pool_posix.h b/base/threading/worker_pool_posix.h
index 6c99e76..44f0208 100644
--- a/base/threading/worker_pool_posix.h
+++ b/base/threading/worker_pool_posix.h
@@ -31,9 +31,9 @@
 #include "base/basictypes.h"
 #include "base/condition_variable.h"
 #include "base/lock.h"
-#include "base/platform_thread.h"
 #include "base/ref_counted.h"
 #include "base/scoped_ptr.h"
+#include "base/threading/platform_thread.h"
 
 class Task;
 
diff --git a/base/threading/worker_pool_posix_unittest.cc b/base/threading/worker_pool_posix_unittest.cc
index 48df16e..25509bf 100644
--- a/base/threading/worker_pool_posix_unittest.cc
+++ b/base/threading/worker_pool_posix_unittest.cc
@@ -8,8 +8,8 @@
 
 #include "base/condition_variable.h"
 #include "base/lock.h"
-#include "base/platform_thread.h"
 #include "base/task.h"
+#include "base/threading/platform_thread.h"
 #include "base/waitable_event.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/base/time_unittest.cc b/base/time_unittest.cc
index 6ddf4d3..6c64b48 100644
--- a/base/time_unittest.cc
+++ b/base/time_unittest.cc
@@ -1,10 +1,10 @@
-// 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 <time.h>
 
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
 #include "base/time.h"
 #include "build/build_config.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -106,7 +106,7 @@
 TEST(TimeTicks, Deltas) {
   for (int index = 0; index < 50; index++) {
     TimeTicks ticks_start = TimeTicks::Now();
-    PlatformThread::Sleep(10);
+    base::PlatformThread::Sleep(10);
     TimeTicks ticks_stop = TimeTicks::Now();
     TimeDelta delta = ticks_stop - ticks_start;
     // Note:  Although we asked for a 10ms sleep, if the
diff --git a/base/timer_unittest.cc b/base/timer_unittest.cc
index 6453672..c2289c8 100644
--- a/base/timer_unittest.cc
+++ b/base/timer_unittest.cc
@@ -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.
 
@@ -267,7 +267,7 @@
 
   // When the timer is deleted, the DelayTimerFatalTarget should never be
   // called.
-  PlatformThread::Sleep(100);
+  base::PlatformThread::Sleep(100);
 }
 
 }  // namespace
diff --git a/base/tools_sanity_unittest.cc b/base/tools_sanity_unittest.cc
index 2824836..edb842d 100644
--- a/base/tools_sanity_unittest.cc
+++ b/base/tools_sanity_unittest.cc
@@ -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.
 
@@ -7,6 +7,8 @@
 #include "base/thread.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
+namespace base {
+
 namespace {
 
 // We use caps here just to ensure that the method name doesn't interfere with
@@ -136,3 +138,5 @@
   delete thread1;
   delete thread2;
 }
+
+}  // namespace base
diff --git a/base/waitable_event_unittest.cc b/base/waitable_event_unittest.cc
index b2590a8..b4f1991 100644
--- a/base/waitable_event_unittest.cc
+++ b/base/waitable_event_unittest.cc
@@ -1,10 +1,10 @@
-// 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/time.h"
 #include "base/waitable_event.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 using base::TimeDelta;
@@ -74,7 +74,7 @@
     delete ev[i];
 }
 
-class WaitableEventSignaler : public PlatformThread::Delegate {
+class WaitableEventSignaler : public base::PlatformThread::Delegate {
  public:
   WaitableEventSignaler(double seconds, WaitableEvent* ev)
       : seconds_(seconds),
@@ -82,7 +82,7 @@
   }
 
   void ThreadMain() {
-    PlatformThread::Sleep(static_cast<int>(seconds_ * 1000));
+    base::PlatformThread::Sleep(static_cast<int>(seconds_ * 1000));
     ev_->Signal();
   }
 
@@ -97,12 +97,12 @@
     ev[i] = new WaitableEvent(false, false);
 
   WaitableEventSignaler signaler(0.1, ev[2]);
-  PlatformThreadHandle thread;
-  PlatformThread::Create(0, &signaler, &thread);
+  base::PlatformThreadHandle thread;
+  base::PlatformThread::Create(0, &signaler, &thread);
 
   EXPECT_EQ(WaitableEvent::WaitMany(ev, 5), 2u);
 
-  PlatformThread::Join(thread);
+  base::PlatformThread::Join(thread);
 
   for (unsigned i = 0; i < 5; ++i)
     delete ev[i];
diff --git a/base/waitable_event_watcher_unittest.cc b/base/waitable_event_watcher_unittest.cc
index e6a6ac0..6073861 100644
--- a/base/waitable_event_watcher_unittest.cc
+++ b/base/waitable_event_watcher_unittest.cc
@@ -1,9 +1,9 @@
-// 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/message_loop.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
 #include "base/waitable_event.h"
 #include "base/waitable_event_watcher.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -81,7 +81,7 @@
   event.Signal();
 
   // Let the background thread do its business
-  PlatformThread::Sleep(30);
+  base::PlatformThread::Sleep(30);
 
   watcher.StopWatching();