summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-31 20:02:16 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-31 20:02:16 +0000
commitce072a7181ea5d58133e33654133236f5d9f5551 (patch)
tree1b1c903fec3fd27038cd17cb4ae9ca17d3736e40
parenta8e2058011129cbef38bf89834ee01715556b392 (diff)
downloadchromium_src-ce072a7181ea5d58133e33654133236f5d9f5551.zip
chromium_src-ce072a7181ea5d58133e33654133236f5d9f5551.tar.gz
chromium_src-ce072a7181ea5d58133e33654133236f5d9f5551.tar.bz2
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
-rw-r--r--base/base.gyp4
-rw-r--r--base/base.gypi12
-rw-r--r--base/cancellation_flag.h4
-rw-r--r--base/condition_variable_unittest.cc6
-rw-r--r--base/debug/debugger.cc2
-rw-r--r--base/debug/trace_event.cc2
-rw-r--r--base/file_util_unittest.cc6
-rw-r--r--base/lazy_instance.cc4
-rw-r--r--base/lazy_instance_unittest.cc3
-rw-r--r--base/lock.cc3
-rw-r--r--base/lock.h4
-rw-r--r--base/lock_unittest.cc6
-rw-r--r--base/message_loop_unittest.cc3
-rw-r--r--base/message_pump_glib.cc8
-rw-r--r--base/message_pump_glib_unittest.cc1
-rw-r--r--base/metrics/stats_table.cc2
-rw-r--r--base/metrics/stats_table_unittest.cc2
-rw-r--r--base/non_thread_safe.h5
-rw-r--r--base/observer_list_unittest.cc8
-rw-r--r--base/platform_thread.h87
-rw-r--r--base/process_util_posix.cc4
-rw-r--r--base/process_util_unittest.cc6
-rw-r--r--base/shared_memory_posix.cc4
-rw-r--r--base/shared_memory_unittest.cc8
-rw-r--r--base/singleton.h4
-rw-r--r--base/spin_wait.h12
-rw-r--r--base/task.h6
-rw-r--r--base/thread.h4
-rw-r--r--base/thread_collision_warner.cc2
-rw-r--r--base/thread_collision_warner_unittest.cc10
-rw-r--r--base/thread_unittest.cc6
-rw-r--r--base/threading/platform_thread.h99
-rw-r--r--base/threading/platform_thread_mac.mm (renamed from base/platform_thread_mac.mm)8
-rw-r--r--base/threading/platform_thread_posix.cc (renamed from base/platform_thread_posix.cc)144
-rw-r--r--base/threading/platform_thread_unittest.cc (renamed from base/platform_thread_unittest.cc)14
-rw-r--r--base/threading/platform_thread_win.cc (renamed from base/platform_thread_win.cc)6
-rw-r--r--base/threading/simple_thread.cc2
-rw-r--r--base/threading/simple_thread.h2
-rw-r--r--base/threading/thread_checker.cc (renamed from base/thread_checker.cc)6
-rw-r--r--base/threading/thread_checker.h (renamed from base/thread_checker.h)12
-rw-r--r--base/threading/thread_checker_unittest.cc (renamed from base/thread_checker_unittest.cc)6
-rw-r--r--base/threading/watchdog.cc2
-rw-r--r--base/threading/watchdog.h2
-rw-r--r--base/threading/watchdog_unittest.cc2
-rw-r--r--base/threading/worker_pool_posix.cc2
-rw-r--r--base/threading/worker_pool_posix.h2
-rw-r--r--base/threading/worker_pool_posix_unittest.cc2
-rw-r--r--base/time_unittest.cc6
-rw-r--r--base/time_win_unittest.cc6
-rw-r--r--base/timer_unittest.cc4
-rw-r--r--base/tools_sanity_unittest.cc6
-rw-r--r--base/waitable_event_unittest.cc14
-rw-r--r--base/waitable_event_watcher_unittest.cc6
-rw-r--r--chrome/browser/browser_main_posix.cc11
-rw-r--r--chrome/browser/debugger/devtools_remote_listen_socket.cc4
-rw-r--r--chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc9
-rw-r--r--chrome/browser/errorpage_uitest.cc5
-rw-r--r--chrome/browser/geolocation/device_data_provider_unittest.cc5
-rw-r--r--chrome/browser/metrics/metrics_service.cc9
-rw-r--r--chrome/browser/printing/printing_layout_uitest.cc6
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc2
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_test.cc3
-rw-r--r--chrome/browser/ui/tests/browser_uitest.cc4
-rw-r--r--chrome/common/chrome_plugin_lib.cc16
-rw-r--r--chrome/gpu/gpu_main.cc3
-rw-r--r--chrome/nacl/nacl_main.cc5
-rw-r--r--chrome/plugin/plugin_main.cc3
-rw-r--r--chrome/ppapi_plugin/ppapi_plugin_main.cc3
-rw-r--r--chrome/profile_import/profile_import_main.cc3
-rw-r--r--chrome/service/service_main.cc3
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_test_interactive_test.cc15
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_tests.cc5
-rw-r--r--chrome/test/automation/autocomplete_edit_proxy.cc3
-rw-r--r--chrome/test/automation/automation_proxy.cc4
-rw-r--r--chrome/test/automation/automation_proxy.h9
-rw-r--r--chrome/test/automation/automation_proxy_uitest.cc2
-rw-r--r--chrome/test/automation/browser_proxy.cc4
-rw-r--r--chrome/test/automation/proxy_launcher.cc3
-rw-r--r--chrome/test/automation/tab_proxy.cc5
-rw-r--r--chrome/test/live_sync/live_sync_test.cc4
-rw-r--r--chrome/test/memory_test/memory_test.cc7
-rw-r--r--chrome/test/mini_installer_test/chrome_mini_installer.cc14
-rw-r--r--chrome/test/mini_installer_test/mini_installer_test_util.cc10
-rw-r--r--chrome/test/reliability/page_load_test.cc5
-rw-r--r--chrome/test/tab_switching/tab_switching_test.cc4
-rw-r--r--chrome/test/ui/run_all_unittests.cc6
-rw-r--r--chrome/test/ui/ui_test.cc8
-rw-r--r--chrome/test/webdriver/commands/find_element_commands.cc3
-rw-r--r--chrome/test/webdriver/server.cc3
-rw-r--r--chrome/utility/utility_main.cc5
-rw-r--r--chrome/worker/worker_main.cc5
-rw-r--r--chrome/worker/worker_uitest.cc5
-rw-r--r--chrome_frame/bind_status_callback_impl.cc25
-rw-r--r--chrome_frame/cfproxy_private.h2
-rw-r--r--chrome_frame/chrome_frame_automation.cc28
-rw-r--r--chrome_frame/chrome_frame_automation.h8
-rw-r--r--chrome_frame/test/mock_ie_event_sink_actions.h6
-rw-r--r--chrome_frame/test/perf/chrome_frame_perftest.cc10
-rw-r--r--chrome_frame/test/run_all_unittests.cc5
-rw-r--r--chrome_frame/urlmon_bind_status_callback.cc10
-rw-r--r--chrome_frame/urlmon_url_request.cc31
-rw-r--r--chrome_frame/urlmon_url_request_private.h3
-rw-r--r--net/base/listen_socket.cc5
-rw-r--r--net/disk_cache/block_files.cc4
-rw-r--r--net/disk_cache/block_files.h4
-rw-r--r--net/http/http_auth_controller.cc6
-rw-r--r--net/ocsp/nss_ocsp.cc4
-rw-r--r--net/proxy/multi_threaded_proxy_resolver_unittest.cc5
-rw-r--r--net/socket/tcp_client_socket_pool_unittest.cc10
-rw-r--r--remoting/base/tracer.cc3
-rw-r--r--webkit/tools/test_shell/simple_database_system.cc3
111 files changed, 545 insertions, 441 deletions
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 @@ TEST_F(FileUtilTest, FLAKY_CountFilesCreatedAfter) {
// 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 ConstructAndDestructLogger {
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 @@ class Lock {
// 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 @@ void MessagePumpForUI::RunWithDispatcher(Delegate* delegate,
#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 @@ class NonThreadSafe {
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 @@ static void ThreadSafeObserverHarness(int num_threads,
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 @@ bool WaitForProcessesToExit(const FilePath::StringType& executable_name,
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 @@ const int kMaxWaitTimeMs = TestTimeouts::action_max_timeout_ms();
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 @@ base::TerminationStatus WaitForChildTermination(base::ProcessHandle handle,
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 6716159..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 @@ void SharedMemory::LockOrUnlockCommon(int function) {
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 @@ TEST(SharedMemoryTest, AnonymousPrivate) {
// 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 @@ const char* const SharedMemoryProcessTest::s_test_name_ = "MPMem";
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 @@ class Singleton {
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 @@ template <class T>
struct RunnableMethodTraits {
RunnableMethodTraits() {
#ifndef NDEBUG
- origin_thread_id_ = PlatformThread::CurrentId();
+ origin_thread_id_ = base::PlatformThread::CurrentId();
#endif
}
@@ -236,7 +236,7 @@ struct RunnableMethodTraits {
#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 @@ struct RunnableMethodTraits {
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..be68bc5f 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 e563036b..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 @@ TEST(ThreadCollisionTest, MTScopedBookCriticalSectionTest) {
void push(int value) {
DFAKE_SCOPED_LOCK(push_pop_);
- PlatformThread::Sleep(5000);
+ base::PlatformThread::Sleep(5000);
}
int pop() {
@@ -248,7 +248,7 @@ TEST(ThreadCollisionTest, MTSynchedScopedBookCriticalSectionTest) {
void push(int value) {
DFAKE_SCOPED_LOCK(push_pop_);
- PlatformThread::Sleep(2000);
+ base::PlatformThread::Sleep(2000);
}
int pop() {
@@ -318,7 +318,7 @@ TEST(ThreadCollisionTest, MTSynchedScopedRecursiveBookCriticalSectionTest) {
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 @@ class SleepSome : public Task {
explicit SleepSome(int msec) : msec_(msec) {
}
virtual void Run() {
- PlatformThread::Sleep(msec_);
+ base::PlatformThread::Sleep(msec_);
}
private:
int msec_;
@@ -47,7 +47,7 @@ class SleepInsideInitThread : public Thread {
virtual ~SleepInsideInitThread() { }
virtual void Init() {
- PlatformThread::Sleep(500);
+ base::PlatformThread::Sleep(500);
init_called_ = true;
}
bool InitCalled() { return init_called_; }
@@ -178,7 +178,7 @@ TEST_F(ThreadTest, StartWithOptions_StackSize) {
// 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..0a3c75d7
--- /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_mac.mm b/base/threading/platform_thread_mac.mm
index 36e08be..d77307c5 100644
--- a/base/platform_thread_mac.mm
+++ b/base/threading/platform_thread_mac.mm
@@ -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"
#import <Foundation/Foundation.h>
#include <dlfcn.h>
@@ -32,8 +32,6 @@ void InitThreading() {
}
}
-} // namespace base
-
// static
void PlatformThread::SetName(const char* name) {
// pthread_setname_np is only available in 10.6 or later, so test
@@ -52,3 +50,5 @@ void PlatformThread::SetName(const char* name) {
// See http://crbug.com/47058
dynamic_pthread_setname_np(shortened_name.c_str());
}
+
+} // namespace base
diff --git a/base/platform_thread_posix.cc b/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 @@ struct ThreadParams {
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 @@ static void* ThreadFunc(void* params) {
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 @@ void PlatformThread::SetName(const char* name) {
}
#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 @@ void PlatformThread::Join(PlatformThreadHandle thread_handle) {
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
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 @@ class TrivialThread : public PlatformThread::Delegate {
DISALLOW_COPY_AND_ASSIGN(TrivialThread);
};
-TEST_F(PlatformThreadTest, Trivial) {
+TEST(PlatformThreadTest, Trivial) {
TrivialThread thread;
PlatformThreadHandle handle = kNullThreadHandle;
@@ -36,7 +36,7 @@ TEST_F(PlatformThreadTest, Trivial) {
ASSERT_TRUE(thread.did_run());
}
-TEST_F(PlatformThreadTest, TrivialTimesTen) {
+TEST(PlatformThreadTest, TrivialTimesTen) {
TrivialThread thread[10];
PlatformThreadHandle handle[arraysize(thread)];
@@ -72,7 +72,7 @@ class FunctionTestThread : public TrivialThread {
DISALLOW_COPY_AND_ASSIGN(FunctionTestThread);
};
-TEST_F(PlatformThreadTest, Function) {
+TEST(PlatformThreadTest, Function) {
PlatformThreadId main_thread_id = PlatformThread::CurrentId();
FunctionTestThread thread;
@@ -85,7 +85,7 @@ TEST_F(PlatformThreadTest, Function) {
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 @@ TEST_F(PlatformThreadTest, FunctionTimesTen) {
EXPECT_NE(thread[n].thread_id(), main_thread_id);
}
}
+
+} // namespace base
diff --git a/base/platform_thread_win.cc b/base/threading/platform_thread_win.cc
index ac8a5db..10f3011 100644
--- a/base/platform_thread_win.cc
+++ b/base/threading/platform_thread_win.cc
@@ -2,12 +2,14 @@
// 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 "base/logging.h"
#include "base/thread_restrictions.h"
#include "base/win/windows_version.h"
+namespace base {
+
namespace {
// The information on how to set the thread name comes from
@@ -141,3 +143,5 @@ void PlatformThread::Join(PlatformThreadHandle thread_handle) {
CloseHandle(thread_handle);
}
+
+} // 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
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 @@ void ThreadChecker::EnsureThreadIdAssigned() const {
valid_thread_id_ = PlatformThread::CurrentId();
}
+} // namespace base
+
#endif // NDEBUG
diff --git a/base/thread_checker.h b/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 @@ class ThreadChecker {
};
#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
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 @@ TEST(ThreadCheckerDeathTest, DetachFromThread) {
#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(Time, LocalMidnight) {
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/time_win_unittest.cc b/base/time_win_unittest.cc
index 4389e7a..3a96b91 100644
--- a/base/time_win_unittest.cc
+++ b/base/time_win_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.
@@ -6,7 +6,7 @@
#include <mmsystem.h>
#include <process.h>
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#include "base/time.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -220,7 +220,7 @@ TEST(TimeTicks, Drift) {
// Sleep for a few milliseconds (note that it means 1000 microseconds).
// If we check the drift too frequently, it's going to increase
// monotonically, making our measurement less realistic.
- PlatformThread::Sleep((i % 2 == 0) ? 1 : 2);
+ base::PlatformThread::Sleep((i % 2 == 0) ? 1 : 2);
total_drift += drift_microseconds;
}
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 @@ void RunTest_DelayTimer_Deleted(MessageLoop::Type message_loop_type) {
// 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 @@ TEST(ToolsSanityTest, DataRace) {
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 @@ TEST(WaitableEventTest, WaitManyShortcut) {
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 @@ class WaitableEventSignaler : public PlatformThread::Delegate {
}
void ThreadMain() {
- PlatformThread::Sleep(static_cast<int>(seconds_ * 1000));
+ base::PlatformThread::Sleep(static_cast<int>(seconds_ * 1000));
ev_->Signal();
}
@@ -97,12 +97,12 @@ TEST(WaitableEventTest, WaitMany) {
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 @@ void RunTest_CancelAfterSet(MessageLoop::Type message_loop_type) {
event.Signal();
// Let the background thread do its business
- PlatformThread::Sleep(30);
+ base::PlatformThread::Sleep(30);
watcher.StopWatching();
diff --git a/chrome/browser/browser_main_posix.cc b/chrome/browser/browser_main_posix.cc
index 9736c66..02319c7 100644
--- a/chrome/browser/browser_main_posix.cc
+++ b/chrome/browser/browser_main_posix.cc
@@ -12,6 +12,7 @@
#include "base/eintr_wrapper.h"
#include "base/logging.h"
#include "base/string_number_conversions.h"
+#include "base/threading/platform_thread.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/common/chrome_switches.h"
@@ -70,7 +71,7 @@ void SIGTERMHandler(int signal) {
GracefulShutdownHandler(signal);
}
-class ShutdownDetector : public PlatformThread::Delegate {
+class ShutdownDetector : public base::PlatformThread::Delegate {
public:
explicit ShutdownDetector(int shutdown_fd);
@@ -88,7 +89,7 @@ ShutdownDetector::ShutdownDetector(int shutdown_fd)
}
void ShutdownDetector::ThreadMain() {
- PlatformThread::SetName("CrShutdownDetector");
+ base::PlatformThread::SetName("CrShutdownDetector");
int signal;
size_t bytes_read = 0;
@@ -211,9 +212,9 @@ void BrowserMainPartsPosix::PostMainMessageLoopStart() {
const size_t kShutdownDetectorThreadStackSize = 4096;
// TODO(viettrungluu,willchan): crbug.com/29675 - This currently leaks, so
// if you change this, you'll probably need to change the suppression.
- if (!PlatformThread::CreateNonJoinable(
- kShutdownDetectorThreadStackSize,
- new ShutdownDetector(g_shutdown_pipe_read_fd))) {
+ if (!base::PlatformThread::CreateNonJoinable(
+ kShutdownDetectorThreadStackSize,
+ new ShutdownDetector(g_shutdown_pipe_read_fd))) {
LOG(DFATAL) << "Failed to create shutdown detector task.";
}
}
diff --git a/chrome/browser/debugger/devtools_remote_listen_socket.cc b/chrome/browser/debugger/devtools_remote_listen_socket.cc
index 3ac15ae..c5804d5 100644
--- a/chrome/browser/debugger/devtools_remote_listen_socket.cc
+++ b/chrome/browser/debugger/devtools_remote_listen_socket.cc
@@ -22,8 +22,8 @@
#include "base/compiler_specific.h"
#include "base/eintr_wrapper.h"
-#include "base/platform_thread.h"
#include "base/string_number_conversions.h"
+#include "base/threading/platform_thread.h"
#include "chrome/browser/debugger/devtools_remote.h"
#include "chrome/browser/debugger/devtools_remote_message.h"
@@ -252,7 +252,7 @@ void DevToolsRemoteListenSocket::SendInternal(const char* bytes, int len) {
send_buf += sent;
len_left -= sent;
}
- PlatformThread::YieldCurrentThread();
+ base::PlatformThread::YieldCurrentThread();
}
}
diff --git a/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc b/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc
index 4c1884f..84cc4a6 100644
--- a/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc
+++ b/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc
@@ -11,6 +11,7 @@
#include "base/eintr_wrapper.h"
#include "base/test/test_timeouts.h"
+#include "base/threading/platform_thread.h"
#include "net/base/net_util.h"
#include "testing/platform_test.h"
@@ -160,7 +161,7 @@ bool DevToolsRemoteListenSocketTester::NextAction(int timeout) {
return false;
while (true) {
int result = sem_trywait(semaphore_);
- PlatformThread::Sleep(1); // 1MS sleep
+ base::PlatformThread::Sleep(1); // 1MS sleep
timeout--;
if (timeout <= 0)
return false;
@@ -193,7 +194,7 @@ int DevToolsRemoteListenSocketTester::ClearTestSocket() {
if (len == SOCKET_ERROR) {
if (errno == EWOULDBLOCK || errno == EAGAIN) {
#endif
- PlatformThread::Sleep(1);
+ base::PlatformThread::Sleep(1);
time_out++;
if (time_out > 10)
break;
@@ -261,7 +262,7 @@ void DevToolsRemoteListenSocketTester::TestClientSend() {
{
ASSERT_TRUE(Send(test_socket_, kSimpleMessagePart1));
// sleep for 10ms to test message split between \r and \n
- PlatformThread::Sleep(10);
+ base::PlatformThread::Sleep(10);
ASSERT_TRUE(Send(test_socket_, kSimpleMessagePart2));
ASSERT_TRUE(NextAction(TestTimeouts::action_timeout_ms()));
ASSERT_EQ(ACTION_READ_MESSAGE, last_action_.type());
@@ -312,7 +313,7 @@ void DevToolsRemoteListenSocketTester::TestServerSend() {
// of the time. I could fix this by making the socket blocking, but then
// this test might hang in the case of errors. It would be nice to do
// something that felt more reliable here.
- PlatformThread::Sleep(10); // sleep for 10ms
+ base::PlatformThread::Sleep(10); // sleep for 10ms
const int buf_len = 200;
char buf[buf_len+1];
int recv_len = HANDLE_EINTR(recv(test_socket_, buf, buf_len, 0));
diff --git a/chrome/browser/errorpage_uitest.cc b/chrome/browser/errorpage_uitest.cc
index 427f067..51b9754 100644
--- a/chrome/browser/errorpage_uitest.cc
+++ b/chrome/browser/errorpage_uitest.cc
@@ -1,8 +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/string_util.h"
+#include "base/threading/platform_thread.h"
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/ui/ui_test.h"
#include "chrome/browser/net/url_request_failed_dns_job.h"
@@ -15,7 +16,7 @@ class ErrorPageTest : public UITest {
for (int i = 0; i < 10; ++i) {
if (GetActiveTabTitle() == title)
return true;
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
}
EXPECT_EQ(title, GetActiveTabTitle());
return false;
diff --git a/chrome/browser/geolocation/device_data_provider_unittest.cc b/chrome/browser/geolocation/device_data_provider_unittest.cc
index f6e9d96..a361fc6 100644
--- a/chrome/browser/geolocation/device_data_provider_unittest.cc
+++ b/chrome/browser/geolocation/device_data_provider_unittest.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/geolocation/device_data_provider.h"
+#include "base/threading/platform_thread.h"
#include "chrome/browser/geolocation/wifi_data_provider_common.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -27,12 +28,12 @@ TEST(GeolocationDeviceDataProviderWifiData, CreateDestroy) {
for (int i = 0; i < 10; i++) {
DeviceDataProvider<WifiData>::Register(&listener);
for (int j = 0; j < 10; j++) {
- PlatformThread::Sleep(0);
+ base::PlatformThread::Sleep(0);
main_message_loop.RunAllPending(); // See comment above
}
DeviceDataProvider<WifiData>::Unregister(&listener);
for (int j = 0; j < 10; j++) {
- PlatformThread::Sleep(0);
+ base::PlatformThread::Sleep(0);
main_message_loop.RunAllPending(); // See comment above
}
}
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index 5e1af15..3669f5b 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-
//------------------------------------------------------------------------------
// Description of the life cycle of a instance of MetricsService.
//
@@ -164,6 +162,7 @@
#include "base/metrics/histogram.h"
#include "base/string_number_conversions.h"
#include "base/thread.h"
+#include "base/threading/platform_thread.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
@@ -1904,10 +1903,10 @@ void MetricsService::RecordCurrentState(PrefService* pref) {
}
static bool IsSingleThreaded() {
- static PlatformThreadId thread_id = 0;
+ static base::PlatformThreadId thread_id = 0;
if (!thread_id)
- thread_id = PlatformThread::CurrentId();
- return PlatformThread::CurrentId() == thread_id;
+ thread_id = base::PlatformThread::CurrentId();
+ return base::PlatformThread::CurrentId() == thread_id;
}
#if defined(OS_CHROMEOS)
diff --git a/chrome/browser/printing/printing_layout_uitest.cc b/chrome/browser/printing/printing_layout_uitest.cc
index 1198705..d2cdf9d 100644
--- a/chrome/browser/printing/printing_layout_uitest.cc
+++ b/chrome/browser/printing/printing_layout_uitest.cc
@@ -164,7 +164,7 @@ class PrintingLayoutTest : public PrintingTest<UITest> {
}
if (found_emf && found_prn)
break;
- PlatformThread::Sleep(100);
+ base::PlatformThread::Sleep(100);
}
EXPECT_TRUE(found_emf) << ".PRN file is: " << prn_file;
EXPECT_TRUE(found_prn) << ".EMF file is: " << emf_file;
@@ -256,13 +256,13 @@ class DismissTheWindow : public base::DelegateSimpleThread::Delegate {
break;
}
}
- PlatformThread::Sleep(10);
+ base::PlatformThread::Sleep(10);
}
// Now verify that it indeed closed itself.
while (IsWindow(dialog_window)) {
CloseDialogWindow(dialog_window);
- PlatformThread::Sleep(10);
+ base::PlatformThread::Sleep(10);
}
}
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc
index 48390f6..7732032 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc
@@ -216,7 +216,7 @@ TEST_F(ResourceDispatcherTest, CrossSiteAfterCrash) {
#endif
ASSERT_TRUE(tab->NavigateToURLAsync(GURL(chrome::kAboutCrashURL)));
// Wait for browser to notice the renderer crash.
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
// Navigate to a new cross-site page. The browser should not wait around for
// the old renderer's on{before}unload handlers to run.
diff --git a/chrome/browser/safe_browsing/safe_browsing_test.cc b/chrome/browser/safe_browsing/safe_browsing_test.cc
index 259d3ff..662eb5d 100644
--- a/chrome/browser/safe_browsing/safe_browsing_test.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_test.cc
@@ -25,6 +25,7 @@
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/string_split.h"
+#include "base/threading/platform_thread.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
@@ -452,7 +453,7 @@ class SafeBrowsingServiceTestHelper
// Wait and try again if last fetch was failed. The loop will hit the
// timeout in OutOfProcTestRunner if the fetch can not get success
// response.
- PlatformThread::Sleep(TestTimeouts::action_timeout_ms());
+ base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms());
}
}
diff --git a/chrome/browser/ui/tests/browser_uitest.cc b/chrome/browser/ui/tests/browser_uitest.cc
index 6b8c735..f3cfc78 100644
--- a/chrome/browser/ui/tests/browser_uitest.cc
+++ b/chrome/browser/ui/tests/browser_uitest.cc
@@ -166,7 +166,7 @@ TEST_F(BrowserTest, MAYBE_OtherRedirectsDontForkProcess) {
// Make sure that a new tab but not new process has been created.
ASSERT_TRUE(tab->NavigateToURLAsync(dont_fork_url));
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
ASSERT_EQ(orig_process_count, GetBrowserProcessCount());
int new_tab_count = -1;
ASSERT_TRUE(window->GetTabCount(&new_tab_count));
@@ -181,7 +181,7 @@ TEST_F(BrowserTest, MAYBE_OtherRedirectsDontForkProcess) {
// Make sure that no new process has been created.
ASSERT_TRUE(tab->NavigateToURLAsync(dont_fork_url2));
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
ASSERT_EQ(orig_process_count, GetBrowserProcessCount());
}
diff --git a/chrome/common/chrome_plugin_lib.cc b/chrome/common/chrome_plugin_lib.cc
index 1bd118b..b74dfad1 100644
--- a/chrome/common/chrome_plugin_lib.cc
+++ b/chrome/common/chrome_plugin_lib.cc
@@ -10,17 +10,19 @@
#include "base/metrics/histogram.h"
#include "base/path_service.h"
#include "base/perftimer.h"
-#include "base/thread.h"
-#if defined(OS_WIN)
-#include "base/win/registry.h"
-#endif
#include "base/string_util.h"
+#include "base/thread.h"
+#include "base/threading/platform_thread.h"
#include "chrome/common/chrome_counters.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/chrome_paths.h"
#include "webkit/plugins/npapi/plugin_list.h"
+#if defined(OS_WIN)
+#include "base/win/registry.h"
+#endif
+
using base::TimeDelta;
// TODO(port): revisit when plugins happier
@@ -39,7 +41,7 @@ static PluginMap* g_loaded_libs;
// The thread plugins are loaded and used in, lazily initialized upon
// the first creation call.
-static PlatformThreadId g_plugin_thread_id = 0;
+static base::PlatformThreadId g_plugin_thread_id = 0;
static MessageLoop* g_plugin_thread_loop = NULL;
static bool IsSingleProcessMode() {
@@ -58,7 +60,7 @@ ChromePluginLib* ChromePluginLib::Create(const FilePath& filename,
// Keep a map of loaded plugins to ensure we only load each library once.
if (!g_loaded_libs) {
g_loaded_libs = new PluginMap();
- g_plugin_thread_id = PlatformThread::CurrentId();
+ g_plugin_thread_id = base::PlatformThread::CurrentId();
g_plugin_thread_loop = MessageLoop::current();
}
DCHECK(IsPluginThread());
@@ -97,7 +99,7 @@ void ChromePluginLib::Destroy(const FilePath& filename) {
// static
bool ChromePluginLib::IsPluginThread() {
- return PlatformThread::CurrentId() == g_plugin_thread_id;
+ return base::PlatformThread::CurrentId() == g_plugin_thread_id;
}
// static
diff --git a/chrome/gpu/gpu_main.cc b/chrome/gpu/gpu_main.cc
index 2ef1b10..5c8f27f 100644
--- a/chrome/gpu/gpu_main.cc
+++ b/chrome/gpu/gpu_main.cc
@@ -10,6 +10,7 @@
#include "base/environment.h"
#include "base/message_loop.h"
#include "base/stringprintf.h"
+#include "base/threading/platform_thread.h"
#include "build/build_config.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
@@ -74,7 +75,7 @@ int GpuMain(const MainFunctionParams& parameters) {
#endif
MessageLoop main_message_loop(MessageLoop::TYPE_UI);
- PlatformThread::SetName("CrGpuMain");
+ base::PlatformThread::SetName("CrGpuMain");
#if defined(OS_WIN)
win_util::ScopedCOMInitializer com_initializer;
diff --git a/chrome/nacl/nacl_main.cc b/chrome/nacl/nacl_main.cc
index 4722b47..4d56143 100644
--- a/chrome/nacl/nacl_main.cc
+++ b/chrome/nacl/nacl_main.cc
@@ -12,6 +12,7 @@
#include "app/system_monitor.h"
#include "base/command_line.h"
#include "base/message_loop.h"
+#include "base/platform_thread.h"
#include "base/string_util.h"
#include "chrome/common/child_process.h"
#include "chrome/common/chrome_constants.h"
@@ -36,7 +37,7 @@
int NaClBrokerMain(const MainFunctionParams& parameters) {
// The main thread of the broker.
MessageLoopForIO main_message_loop;
- PlatformThread::SetName("CrNaClBrokerMain");
+ base::PlatformThread::SetName("CrNaClBrokerMain");
SystemMonitor system_monitor;
HighResolutionTimerManager hi_res_timer_manager;
@@ -100,7 +101,7 @@ int NaClMain(const MainFunctionParams& parameters) {
// The main thread of the plugin services IO.
MessageLoopForIO main_message_loop;
- PlatformThread::SetName("CrNaClMain");
+ base::PlatformThread::SetName("CrNaClMain");
SystemMonitor system_monitor;
HighResolutionTimerManager hi_res_timer_manager;
diff --git a/chrome/plugin/plugin_main.cc b/chrome/plugin/plugin_main.cc
index a59a5b5..dee171c 100644
--- a/chrome/plugin/plugin_main.cc
+++ b/chrome/plugin/plugin_main.cc
@@ -14,6 +14,7 @@
#include "base/command_line.h"
#include "base/message_loop.h"
#include "base/string_util.h"
+#include "base/threading/platform_thread.h"
#include "chrome/common/child_process.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
@@ -91,7 +92,7 @@ int PluginMain(const MainFunctionParams& parameters) {
InitializeChromeApplication();
#endif
MessageLoop main_message_loop(MessageLoop::TYPE_UI);
- PlatformThread::SetName("CrPluginMain");
+ base::PlatformThread::SetName("CrPluginMain");
SystemMonitor system_monitor;
HighResolutionTimerManager high_resolution_timer_manager;
diff --git a/chrome/ppapi_plugin/ppapi_plugin_main.cc b/chrome/ppapi_plugin/ppapi_plugin_main.cc
index 3f3ccfe..eb52a3f 100644
--- a/chrome/ppapi_plugin/ppapi_plugin_main.cc
+++ b/chrome/ppapi_plugin/ppapi_plugin_main.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/message_loop.h"
+#include "base/threading/platform_thread.h"
#include "build/build_config.h"
#include "chrome/common/child_process.h"
#include "chrome/common/chrome_switches.h"
@@ -17,7 +18,7 @@ int PpapiPluginMain(const MainFunctionParams& parameters) {
}
MessageLoop main_message_loop(MessageLoop::TYPE_UI);
- PlatformThread::SetName("CrPPAPIMain");
+ base::PlatformThread::SetName("CrPPAPIMain");
ChildProcess ppapi_process;
ppapi_process.set_main_thread(new PpapiThread());
diff --git a/chrome/profile_import/profile_import_main.cc b/chrome/profile_import/profile_import_main.cc
index ced62d5..a406dd8 100644
--- a/chrome/profile_import/profile_import_main.cc
+++ b/chrome/profile_import/profile_import_main.cc
@@ -5,6 +5,7 @@
#include "base/command_line.h"
#include "base/message_loop.h"
#include "base/string_util.h"
+#include "base/threading/platform_thread.h"
#include "chrome/common/child_process.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
@@ -16,7 +17,7 @@
int ProfileImportMain(const MainFunctionParams& parameters) {
// The main message loop of the profile import process.
MessageLoop main_message_loop;
- PlatformThread::SetName("CrProfileImportMain");
+ base::PlatformThread::SetName("CrProfileImportMain");
ChildProcess profile_import_process;
profile_import_process.set_main_thread(new ProfileImportThread());
diff --git a/chrome/service/service_main.cc b/chrome/service/service_main.cc
index 366021b..43c3c13 100644
--- a/chrome/service/service_main.cc
+++ b/chrome/service/service_main.cc
@@ -6,6 +6,7 @@
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/singleton.h"
+#include "base/threading/platform_thread.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/main_function_params.h"
@@ -25,7 +26,7 @@ int ServiceProcessMain(const MainFunctionParams& parameters) {
base::debug::WaitForDebugger(60, true);
}
- PlatformThread::SetName("CrServiceMain");
+ base::PlatformThread::SetName("CrServiceMain");
#if defined(OS_WIN)
sandbox::BrokerServices* broker_services =
diff --git a/chrome/test/automated_ui_tests/automated_ui_test_interactive_test.cc b/chrome/test/automated_ui_tests/automated_ui_test_interactive_test.cc
index c4c1eec..df4d33d 100644
--- a/chrome/test/automated_ui_tests/automated_ui_test_interactive_test.cc
+++ b/chrome/test/automated_ui_tests/automated_ui_test_interactive_test.cc
@@ -1,7 +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/threading/platform_thread.h"
#include "chrome/test/automated_ui_tests/automated_ui_test_base.h"
#include "chrome/test/automation/browser_proxy.h"
#include "chrome/test/automation/tab_proxy.h"
@@ -11,7 +12,7 @@ TEST_F(AutomatedUITestBase, DragOut) {
NewTab();
NewTab();
ASSERT_TRUE(active_browser()->WaitForTabCountToBecome(3));
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
ASSERT_TRUE(DragTabOut());
int window_count;
ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count));
@@ -24,7 +25,7 @@ TEST_F(AutomatedUITestBase, DragLeftRight) {
ASSERT_TRUE(active_browser()->WaitForTabCountToBecome(3));
// TODO(phajdan.jr): We need a WaitForTabstripAnimationsToEnd() function.
// Every sleep in this file should be replaced with it.
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
scoped_refptr<TabProxy> dragged_tab(active_browser()->GetActiveTab());
int tab_index;
@@ -34,13 +35,13 @@ TEST_F(AutomatedUITestBase, DragLeftRight) {
// Drag the active tab to left. Now it should be the middle tab.
ASSERT_TRUE(DragActiveTab(false));
// We wait for the animation to be over.
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
ASSERT_TRUE(dragged_tab->GetTabIndex(&tab_index));
EXPECT_EQ(1, tab_index);
// Drag the active tab to left. Now it should be the leftmost tab.
ASSERT_TRUE(DragActiveTab(false));
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
ASSERT_TRUE(dragged_tab->GetTabIndex(&tab_index));
EXPECT_EQ(0, tab_index);
@@ -50,13 +51,13 @@ TEST_F(AutomatedUITestBase, DragLeftRight) {
// Drag the active tab to right. Now it should be the middle tab.
ASSERT_TRUE(DragActiveTab(true));
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
ASSERT_TRUE(dragged_tab->GetTabIndex(&tab_index));
EXPECT_EQ(1, tab_index);
// Drag the active tab to right. Now it should be the rightmost tab.
ASSERT_TRUE(DragActiveTab(true));
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
ASSERT_TRUE(dragged_tab->GetTabIndex(&tab_index));
EXPECT_EQ(2, tab_index);
diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.cc b/chrome/test/automated_ui_tests/automated_ui_tests.cc
index 0b5d15b..e4293ce 100644
--- a/chrome/test/automated_ui_tests/automated_ui_tests.cc
+++ b/chrome/test/automated_ui_tests/automated_ui_tests.cc
@@ -16,6 +16,7 @@
#include "base/string_number_conversions.h"
#include "base/string_split.h"
#include "base/string_util.h"
+#include "base/threading/platform_thread.h"
#include "base/time.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/browser_process.h"
@@ -383,7 +384,7 @@ bool AutomatedUITest::DoAction(const std::string& action) {
did_complete_action = true;
} else if (LowerCaseEqualsASCII(action, "sleep")) {
// This is for debugging, it probably shouldn't be used real tests.
- PlatformThread::Sleep(kDebuggingTimeoutMsec);
+ base::PlatformThread::Sleep(kDebuggingTimeoutMsec);
did_complete_action = true;
} else if (LowerCaseEqualsASCII(action, "star")) {
did_complete_action = StarPage();
@@ -428,7 +429,7 @@ bool AutomatedUITest::DoAction(const std::string& action) {
xml_writer_.EndElement();
if (post_action_delay_)
- PlatformThread::Sleep(1000 * post_action_delay_);
+ base::PlatformThread::Sleep(1000 * post_action_delay_);
return did_complete_action;
}
diff --git a/chrome/test/automation/autocomplete_edit_proxy.cc b/chrome/test/automation/autocomplete_edit_proxy.cc
index 019326b..fd8061b 100644
--- a/chrome/test/automation/autocomplete_edit_proxy.cc
+++ b/chrome/test/automation/autocomplete_edit_proxy.cc
@@ -6,6 +6,7 @@
#include <vector>
+#include "base/threading/platform_thread.h"
#include "chrome/common/automation_constants.h"
#include "chrome/common/automation_messages.h"
#include "chrome/test/automation/automation_proxy.h"
@@ -66,7 +67,7 @@ bool AutocompleteEditProxy::WaitForQuery(int wait_timeout_ms) const {
while (TimeTicks::Now() - start < timeout) {
if (IsQueryInProgress(&query_in_progress) && !query_in_progress)
return true;
- PlatformThread::Sleep(automation::kSleepTime);
+ base::PlatformThread::Sleep(automation::kSleepTime);
}
// If we get here the query is still in progress.
return false;
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc
index cf9391d..1138cc4 100644
--- a/chrome/test/automation/automation_proxy.cc
+++ b/chrome/test/automation/automation_proxy.cc
@@ -10,7 +10,7 @@
#include "base/basictypes.h"
#include "base/logging.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#include "base/process_util.h"
#include "base/ref_counted.h"
#include "base/waitable_event.h"
@@ -105,7 +105,7 @@ AutomationProxy::AutomationProxy(int command_execution_timeout_ms,
// Zero also seems unreasonable, since we need to wait for IPC, but at
// least it is legal... ;-)
DCHECK_GE(command_execution_timeout_ms, 0);
- listener_thread_id_ = PlatformThread::CurrentId();
+ listener_thread_id_ = base::PlatformThread::CurrentId();
InitializeHandleTracker();
InitializeThread();
}
diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h
index ee77016..60677f7 100644
--- a/chrome/test/automation/automation_proxy.h
+++ b/chrome/test/automation/automation_proxy.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H__
-#define CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H__
+#ifndef CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H_
+#define CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H_
#pragma once
#include <string>
@@ -12,6 +12,7 @@
#include "app/message_box_flags.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/threading/platform_thread.h"
#include "base/process_util.h"
#include "base/scoped_ptr.h"
#include "base/time.h"
@@ -301,9 +302,9 @@ class AutomationProxy : public IPC::Channel::Listener,
// Delay to let the browser execute the command.
base::TimeDelta command_execution_timeout_;
- PlatformThreadId listener_thread_id_;
+ base::PlatformThreadId listener_thread_id_;
DISALLOW_COPY_AND_ASSIGN(AutomationProxy);
};
-#endif // CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H__
+#endif // CHROME_TEST_AUTOMATION_AUTOMATION_PROXY_H_
diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc
index 8568e5e..465b610 100644
--- a/chrome/test/automation/automation_proxy_uitest.cc
+++ b/chrome/test/automation/automation_proxy_uitest.cc
@@ -1556,7 +1556,7 @@ TEST_F(AutomationProxyTest5, TestLifetimeOfDomAutomationController) {
tab->NavigateToURL(net::FilePathToFileURL(filename)));
// Allow some time for the popup to show up and close.
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
std::wstring expected(L"string");
std::wstring jscript = CreateJSString(L"\"" + expected + L"\"");
diff --git a/chrome/test/automation/browser_proxy.cc b/chrome/test/automation/browser_proxy.cc
index ae18470..9ba3057 100644
--- a/chrome/test/automation/browser_proxy.cc
+++ b/chrome/test/automation/browser_proxy.cc
@@ -8,7 +8,7 @@
#include "base/json/json_reader.h"
#include "base/logging.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#include "base/time.h"
#include "chrome/common/automation_constants.h"
#include "chrome/common/automation_messages.h"
@@ -206,7 +206,7 @@ bool BrowserProxy::WaitForTabToBecomeActive(int tab,
const TimeTicks start = TimeTicks::Now();
const TimeDelta timeout = TimeDelta::FromMilliseconds(wait_timeout);
while (TimeTicks::Now() - start < timeout) {
- PlatformThread::Sleep(automation::kSleepTime);
+ base::PlatformThread::Sleep(automation::kSleepTime);
int active_tab;
if (GetActiveTabIndex(&active_tab) && active_tab == tab)
return true;
diff --git a/chrome/test/automation/proxy_launcher.cc b/chrome/test/automation/proxy_launcher.cc
index 2325958..1d1583c 100644
--- a/chrome/test/automation/proxy_launcher.cc
+++ b/chrome/test/automation/proxy_launcher.cc
@@ -4,6 +4,7 @@
#include "chrome/test/automation/proxy_launcher.h"
+#include "base/threading/platform_thread.h"
#include "chrome/common/automation_constants.h"
#include "chrome/common/logging_chrome.h"
#include "chrome/test/automation/automation_proxy.h"
@@ -37,7 +38,7 @@ void NamedProxyLauncher::InitializeConnection(UITestBase* ui_test_base) const {
// Wait for browser to be ready for connections.
struct stat file_info;
while (stat(kInterfacePath, &file_info))
- PlatformThread::Sleep(automation::kSleepTime);
+ base::PlatformThread::Sleep(automation::kSleepTime);
}
ui_test_base->ConnectToRunningBrowser();
diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc
index ce7ed16..bb8d9cc 100644
--- a/chrome/test/automation/tab_proxy.cc
+++ b/chrome/test/automation/tab_proxy.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/string16.h"
+#include "base/threading/platform_thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/automation_messages.h"
#include "chrome/common/json_value_serializer.h"
@@ -363,7 +364,7 @@ bool TabProxy::WaitForChildWindowCountToChange(int count, int* new_count,
int wait_timeout) {
int intervals = std::max(wait_timeout / automation::kSleepTime, 1);
for (int i = 0; i < intervals; ++i) {
- PlatformThread::Sleep(automation::kSleepTime);
+ base::PlatformThread::Sleep(automation::kSleepTime);
bool succeeded = GetConstrainedWindowCount(new_count);
if (!succeeded)
return false;
@@ -391,7 +392,7 @@ bool TabProxy::WaitForBlockedPopupCountToChangeTo(int target_count,
int wait_timeout) {
int intervals = std::max(wait_timeout / automation::kSleepTime, 1);
for (int i = 0; i < intervals; ++i) {
- PlatformThread::Sleep(automation::kSleepTime);
+ base::PlatformThread::Sleep(automation::kSleepTime);
int new_count = -1;
bool succeeded = GetBlockedPopupCount(&new_count);
if (!succeeded)
diff --git a/chrome/test/live_sync/live_sync_test.cc b/chrome/test/live_sync/live_sync_test.cc
index 9c287d2..9a3d125 100644
--- a/chrome/test/live_sync/live_sync_test.cc
+++ b/chrome/test/live_sync/live_sync_test.cc
@@ -11,10 +11,10 @@
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/path_service.h"
-#include "base/platform_thread.h"
#include "base/string_util.h"
#include "base/task.h"
#include "base/test/test_timeouts.h"
+#include "base/threading/platform_thread.h"
#include "base/values.h"
#include "base/waitable_event.h"
#include "chrome/browser/browser_thread.h"
@@ -398,7 +398,7 @@ bool LiveSyncTest::WaitForTestServerToStart(int time_ms, int intervals) {
for (int i = 0; i < intervals; ++i) {
if (IsTestServerRunning())
return true;
- PlatformThread::Sleep(time_ms / intervals);
+ base::PlatformThread::Sleep(time_ms / intervals);
}
return false;
}
diff --git a/chrome/test/memory_test/memory_test.cc b/chrome/test/memory_test/memory_test.cc
index 7b4d78f..29e7d27 100644
--- a/chrome/test/memory_test/memory_test.cc
+++ b/chrome/test/memory_test/memory_test.cc
@@ -9,6 +9,7 @@
#include "base/path_service.h"
#include "base/process_util.h"
#include "base/string_util.h"
+#include "base/threading/platform_thread.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
@@ -148,7 +149,7 @@ class MemoryTest : public UIPerfTest {
SCOPED_TRACE(url);
if (url == "<PAUSE>") { // Special command to delay on this page
- PlatformThread::Sleep(2000);
+ base::PlatformThread::Sleep(2000);
continue;
}
@@ -197,7 +198,7 @@ class MemoryTest : public UIPerfTest {
// A new window will not load a url if requested too soon. The window
// stays on the new tab page instead.
- PlatformThread::Sleep(200);
+ base::PlatformThread::Sleep(200);
active_window = window_count - 1;
window = automation()->GetBrowserWindow(active_window);
@@ -224,7 +225,7 @@ class MemoryTest : public UIPerfTest {
// TODO(mbelshe): Bug 2953
// The automation crashes periodically if we cycle too quickly.
// To make these tests more reliable, slowing them down a bit.
- PlatformThread::Sleep(100);
+ base::PlatformThread::Sleep(100);
}
size_t stop_size = base::GetSystemCommitCharge();
diff --git a/chrome/test/mini_installer_test/chrome_mini_installer.cc b/chrome/test/mini_installer_test/chrome_mini_installer.cc
index 5e7aae1..20edf54 100644
--- a/chrome/test/mini_installer_test/chrome_mini_installer.cc
+++ b/chrome/test/mini_installer_test/chrome_mini_installer.cc
@@ -7,11 +7,11 @@
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/path_service.h"
-#include "base/platform_thread.h"
#include "base/process.h"
#include "base/process_util.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
+#include "base/threading/platform_thread.h"
#include "base/win/registry.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/google_update_constants.h"
@@ -307,7 +307,7 @@ bool ChromeMiniInstaller::CloseUninstallWindow() {
window_name = mini_installer_constants::kChromeUninstallDialogName;
while (hndl == NULL && timer < 5000) {
hndl = FindWindow(NULL, window_name.c_str());
- PlatformThread::Sleep(200);
+ base::PlatformThread::Sleep(200);
timer = timer + 200;
}
@@ -338,7 +338,7 @@ bool ChromeMiniInstaller::CloseChromeBrowser() {
while (!handle && timer < 10000) {
handle = FindWindowEx(NULL, handle, L"Chrome_WidgetWin_0", NULL);
if (!handle) {
- PlatformThread::Sleep(100);
+ base::PlatformThread::Sleep(100);
timer = timer + 100;
}
}
@@ -348,7 +348,7 @@ bool ChromeMiniInstaller::CloseChromeBrowser() {
LRESULT _result = SendMessage(handle, WM_CLOSE, 1, 0);
if (_result != 0)
return false;
- PlatformThread::Sleep(1000);
+ base::PlatformThread::Sleep(1000);
timer = timer + 1000;
}
if (base::GetProcessCount(installer::kChromeExe, NULL) > 0) {
@@ -382,7 +382,7 @@ bool ChromeMiniInstaller::CheckRegistryKeyOnUninstall(
int timer = 0;
while ((key.Open(GetRootRegistryKey(), key_path.c_str(), KEY_ALL_ACCESS)) &&
(timer < 20000)) {
- PlatformThread::Sleep(200);
+ base::PlatformThread::Sleep(200);
timer = timer + 200;
}
return CheckRegistryKey(key_path);
@@ -601,7 +601,7 @@ void ChromeMiniInstaller::VerifyInstall(bool over_install) {
MiniInstallerTestUtil::VerifyProcessLaunch(
installer::kChromeExe, true);
}
- PlatformThread::Sleep(800);
+ base::PlatformThread::Sleep(800);
FindChromeShortcut();
LaunchAndCloseChrome(over_install);
}
@@ -645,7 +645,7 @@ void ChromeMiniInstaller::LaunchBrowser(const std::wstring& launch_path,
bool expected_status) {
base::LaunchApp(L"\"" + launch_path + L"\"" + L" " + launch_args,
false, false, NULL);
- PlatformThread::Sleep(1000);
+ base::PlatformThread::Sleep(1000);
MiniInstallerTestUtil::VerifyProcessLaunch(process_name.c_str(),
expected_status);
}
diff --git a/chrome/test/mini_installer_test/mini_installer_test_util.cc b/chrome/test/mini_installer_test/mini_installer_test_util.cc
index a07ada5..7c0dddd 100644
--- a/chrome/test/mini_installer_test/mini_installer_test_util.cc
+++ b/chrome/test/mini_installer_test/mini_installer_test_util.cc
@@ -6,10 +6,10 @@
#include "base/file_util.h"
#include "base/path_service.h"
-#include "base/platform_thread.h"
#include "base/process_util.h"
#include "base/string_util.h"
#include "base/test/test_timeouts.h"
+#include "base/threading/platform_thread.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/installer/util/logging_installer.h"
@@ -36,7 +36,7 @@ void MiniInstallerTestUtil::CloseProcesses(
while ((base::GetProcessCount(executable_name, NULL) > 0) &&
(timer < 20000)) {
base::KillProcesses(executable_name, 1, NULL);
- PlatformThread::Sleep(200);
+ base::PlatformThread::Sleep(200);
timer = timer + 200;
}
ASSERT_EQ(0, base::GetProcessCount(executable_name, NULL));
@@ -49,7 +49,7 @@ bool MiniInstallerTestUtil::CloseWindow(const wchar_t* window_name,
HWND hndl = FindWindow(NULL, window_name);
while (hndl == NULL && (timer < 60000)) {
hndl = FindWindow(NULL, window_name);
- PlatformThread::Sleep(200);
+ base::PlatformThread::Sleep(200);
timer = timer + 200;
}
if (hndl != NULL) {
@@ -274,7 +274,7 @@ void MiniInstallerTestUtil::VerifyProcessLaunch(
while ((base::GetProcessCount(process_name, NULL) == 0) &&
(timer < wait_time)) {
- PlatformThread::Sleep(200);
+ base::PlatformThread::Sleep(200);
timer = timer + 200;
}
@@ -291,7 +291,7 @@ bool MiniInstallerTestUtil::VerifyProcessClose(
VLOG(1) << "Waiting for this process to end: " << process_name;
while ((base::GetProcessCount(process_name, NULL) > 0) &&
(timer < TestTimeouts::large_test_timeout_ms())) {
- PlatformThread::Sleep(200);
+ base::PlatformThread::Sleep(200);
timer = timer + 200;
}
} else {
diff --git a/chrome/test/reliability/page_load_test.cc b/chrome/test/reliability/page_load_test.cc
index ffa6190..2aeb0a7a 100644
--- a/chrome/test/reliability/page_load_test.cc
+++ b/chrome/test/reliability/page_load_test.cc
@@ -46,6 +46,7 @@
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/test/test_file_util.h"
+#include "base/threading/platform_thread.h"
#include "base/time.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/prefs/pref_service.h"
@@ -214,9 +215,9 @@ class PageLoadTest : public UITest {
// This used to be settable but the flag went away.
int sleep_time_ms = 2000;
window->SimulateOSKeyPress(app::VKEY_NEXT, 0);
- PlatformThread::Sleep(sleep_time_ms);
+ base::PlatformThread::Sleep(sleep_time_ms);
window->SimulateOSKeyPress(app::VKEY_NEXT, 0);
- PlatformThread::Sleep(sleep_time_ms);
+ base::PlatformThread::Sleep(sleep_time_ms);
}
}
}
diff --git a/chrome/test/tab_switching/tab_switching_test.cc b/chrome/test/tab_switching/tab_switching_test.cc
index 29776fd..68b97fa 100644
--- a/chrome/test/tab_switching/tab_switching_test.cc
+++ b/chrome/test/tab_switching/tab_switching_test.cc
@@ -7,8 +7,8 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/path_service.h"
-#include "base/platform_thread.h"
#include "base/scoped_ptr.h"
+#include "base/threading/platform_thread.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
@@ -112,7 +112,7 @@ class TabSwitchingUITest : public UIPerfTest {
log_has_been_dumped = file_util::ReadFileToString(log_file_name_,
&contents);
if (!log_has_been_dumped)
- PlatformThread::Sleep(100);
+ base::PlatformThread::Sleep(100);
} while (!log_has_been_dumped && max_tries--);
ASSERT_TRUE(log_has_been_dumped) << "Failed to read the log file";
diff --git a/chrome/test/ui/run_all_unittests.cc b/chrome/test/ui/run_all_unittests.cc
index 7745bcaf..42aefa0 100644
--- a/chrome/test/ui/run_all_unittests.cc
+++ b/chrome/test/ui/run_all_unittests.cc
@@ -1,11 +1,11 @@
-// 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 "chrome/test/ui/ui_test_suite.h"
int main(int argc, char **argv) {
- PlatformThread::SetName("Tests_Main");
+ base::PlatformThread::SetName("Tests_Main");
return UITestSuite(argc, argv).Run();
}
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index 1d50fe5..9ef3ae6 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -21,13 +21,13 @@
#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/scoped_ptr.h"
#include "base/scoped_temp_dir.h"
#include "base/string_number_conversions.h"
#include "base/string_split.h"
#include "base/test/test_file_util.h"
+#include "base/threading/platform_thread.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
@@ -212,7 +212,7 @@ void UITestBase::WaitForBrowserLaunch() {
if (wait_for_initial_loads_)
ASSERT_TRUE(automation_proxy_->WaitForInitialLoads());
else
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
EXPECT_TRUE(automation()->SetFilteredInet(ShouldFilterInet()));
}
@@ -1021,7 +1021,7 @@ bool UITest::EvictFileFromSystemCacheWrapper(const FilePath& path) {
for (int i = 0; i < 10; i++) {
if (file_util::EvictFileFromSystemCache(path))
return true;
- PlatformThread::Sleep(sleep_timeout_ms() / 10);
+ base::PlatformThread::Sleep(sleep_timeout_ms() / 10);
}
return false;
}
@@ -1046,7 +1046,7 @@ void UITest::WaitForGeneratedFileAndCheck(
file_util::GetFileInfo(generated_file, &previous);
exist = true;
}
- PlatformThread::Sleep(sleep_timeout_ms() / kCycles);
+ base::PlatformThread::Sleep(sleep_timeout_ms() / kCycles);
}
EXPECT_TRUE(exist);
diff --git a/chrome/test/webdriver/commands/find_element_commands.cc b/chrome/test/webdriver/commands/find_element_commands.cc
index acda1393..d208a00 100644
--- a/chrome/test/webdriver/commands/find_element_commands.cc
+++ b/chrome/test/webdriver/commands/find_element_commands.cc
@@ -8,6 +8,7 @@
#include <string>
#include "base/string_number_conversions.h"
+#include "base/threading/platform_thread.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "third_party/webdriver/atoms.h"
@@ -100,7 +101,7 @@ void FindElementCommand::ExecutePost(Response* const response) {
int64 elapsed_time = (base::Time::Now() - start_time).InMilliseconds();
done = done || elapsed_time > session_->implicit_wait();
- PlatformThread::Sleep(50); // Prevent a busy loop that eats the cpu.
+ base::PlatformThread::Sleep(50); // Prevent a busy loop that eats the cpu.
}
response->set_value(result);
diff --git a/chrome/test/webdriver/server.cc b/chrome/test/webdriver/server.cc
index 4760928..6409524 100644
--- a/chrome/test/webdriver/server.cc
+++ b/chrome/test/webdriver/server.cc
@@ -19,6 +19,7 @@
#include "base/logging.h"
#include "base/scoped_ptr.h"
#include "base/string_util.h"
+#include "base/threading/platform_thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/test/webdriver/dispatch.h"
@@ -129,7 +130,7 @@ int main(int argc, char *argv[]) {
std::cout << "Starting server on port: " << port << std::endl;
// The default behavior is to run this service forever.
while (true)
- PlatformThread::Sleep(3600);
+ base::PlatformThread::Sleep(3600);
// We should not reach here since the service should never quit.
// TODO(jmikhail): register a listener for SIGTERM and break the
diff --git a/chrome/utility/utility_main.cc b/chrome/utility/utility_main.cc
index 0fa6777..2abdd52 100644
--- a/chrome/utility/utility_main.cc
+++ b/chrome/utility/utility_main.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.
@@ -10,6 +10,7 @@
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/string_util.h"
+#include "base/threading/platform_thread.h"
#include "chrome/common/child_process.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
@@ -28,7 +29,7 @@
int UtilityMain(const MainFunctionParams& parameters) {
// The main message loop of the utility process.
MessageLoop main_message_loop;
- PlatformThread::SetName("CrUtilityMain");
+ base::PlatformThread::SetName("CrUtilityMain");
SystemMonitor system_monitor;
HighResolutionTimerManager hi_res_timer_manager;
diff --git a/chrome/worker/worker_main.cc b/chrome/worker/worker_main.cc
index 82d0eca..0ba0e87 100644
--- a/chrome/worker/worker_main.cc
+++ b/chrome/worker/worker_main.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,7 @@
#include "base/command_line.h"
#include "base/message_loop.h"
#include "base/string_util.h"
+#include "base/threading/platform_thread.h"
#include "chrome/common/child_process.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
@@ -23,7 +24,7 @@
int WorkerMain(const MainFunctionParams& parameters) {
// The main message loop of the worker process.
MessageLoop main_message_loop;
- PlatformThread::SetName("CrWorkerMain");
+ base::PlatformThread::SetName("CrWorkerMain");
SystemMonitor system_monitor;
HighResolutionTimerManager hi_res_timer_manager;
diff --git a/chrome/worker/worker_uitest.cc b/chrome/worker/worker_uitest.cc
index 6b788b5..3babc78 100644
--- a/chrome/worker/worker_uitest.cc
+++ b/chrome/worker/worker_uitest.cc
@@ -1,9 +1,10 @@
-// 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/file_path.h"
#include "base/string_util.h"
+#include "base/threading/platform_thread.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/worker_host/worker_service.h"
#include "chrome/common/chrome_switches.h"
@@ -95,7 +96,7 @@ class WorkerTest : public UILayoutTest {
if (cur_process_count == number_of_processes)
return true;
- PlatformThread::Sleep(sleep_timeout_ms() / 10);
+ base::PlatformThread::Sleep(sleep_timeout_ms() / 10);
}
EXPECT_EQ(number_of_processes, cur_process_count);
diff --git a/chrome_frame/bind_status_callback_impl.cc b/chrome_frame/bind_status_callback_impl.cc
index c85825d2..9e535e5 100644
--- a/chrome_frame/bind_status_callback_impl.cc
+++ b/chrome_frame/bind_status_callback_impl.cc
@@ -7,6 +7,7 @@
#include "base/logging.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
+#include "base/threading/platform_thread.h"
BSCBImpl::BSCBImpl() {
DVLOG(1) << __FUNCTION__ << me();
@@ -76,7 +77,7 @@ HRESULT BSCBImpl::QueryService(REFGUID service, REFIID iid, void** object) {
// IBindStatusCallback
HRESULT BSCBImpl::OnStartBinding(DWORD reserved, IBinding* binding) {
DVLOG(1) << __FUNCTION__ << me()
- << base::StringPrintf(" tid=%i", PlatformThread::CurrentId());
+ << base::StringPrintf(" tid=%i", base::PlatformThread::CurrentId());
HRESULT hr = S_OK;
if (delegate_)
hr = delegate_->OnStartBinding(reserved, binding);
@@ -85,7 +86,7 @@ HRESULT BSCBImpl::OnStartBinding(DWORD reserved, IBinding* binding) {
HRESULT BSCBImpl::GetPriority(LONG* priority) {
DVLOG(1) << __FUNCTION__ << me()
- << base::StringPrintf(" tid=%i", PlatformThread::CurrentId());
+ << base::StringPrintf(" tid=%i", base::PlatformThread::CurrentId());
HRESULT hr = S_OK;
if (delegate_)
hr = delegate_->GetPriority(priority);
@@ -94,7 +95,7 @@ HRESULT BSCBImpl::GetPriority(LONG* priority) {
HRESULT BSCBImpl::OnLowResource(DWORD reserved) {
DVLOG(1) << __FUNCTION__ << me()
- << base::StringPrintf(" tid=%i", PlatformThread::CurrentId());
+ << base::StringPrintf(" tid=%i", base::PlatformThread::CurrentId());
HRESULT hr = S_OK;
if (delegate_)
hr = delegate_->OnLowResource(reserved);
@@ -105,7 +106,8 @@ HRESULT BSCBImpl::OnProgress(ULONG progress, ULONG progress_max,
ULONG status_code, LPCWSTR status_text) {
DVLOG(1) << __FUNCTION__ << me()
<< base::StringPrintf(" status=%i tid=%i %ls", status_code,
- PlatformThread::CurrentId(), status_text);
+ base::PlatformThread::CurrentId(),
+ status_text);
HRESULT hr = S_OK;
if (delegate_)
delegate_->OnProgress(progress, progress_max, status_code, status_text);
@@ -115,7 +117,7 @@ HRESULT BSCBImpl::OnProgress(ULONG progress, ULONG progress_max,
HRESULT BSCBImpl::OnStopBinding(HRESULT hresult, LPCWSTR error) {
DVLOG(1) << __FUNCTION__ << me()
<< base::StringPrintf(" hr=0x%08X '%ls' tid=%i", hresult, error,
- PlatformThread::CurrentId());
+ base::PlatformThread::CurrentId());
HRESULT hr = S_OK;
if (delegate_)
delegate_->OnStopBinding(hresult, error);
@@ -124,7 +126,7 @@ HRESULT BSCBImpl::OnStopBinding(HRESULT hresult, LPCWSTR error) {
HRESULT BSCBImpl::GetBindInfo(DWORD* bindf, BINDINFO* bind_info) {
DVLOG(1) << __FUNCTION__ << me()
- << base::StringPrintf(" tid=%i", PlatformThread::CurrentId());
+ << base::StringPrintf(" tid=%i", base::PlatformThread::CurrentId());
HRESULT hr = S_OK;
if (delegate_)
delegate_->GetBindInfo(bindf, bind_info);
@@ -134,7 +136,7 @@ HRESULT BSCBImpl::GetBindInfo(DWORD* bindf, BINDINFO* bind_info) {
HRESULT BSCBImpl::OnDataAvailable(DWORD bscf, DWORD size,
FORMATETC* format_etc, STGMEDIUM* stgmed) {
DVLOG(1) << __FUNCTION__ << me()
- << base::StringPrintf(" tid=%i", PlatformThread::CurrentId());
+ << base::StringPrintf(" tid=%i", base::PlatformThread::CurrentId());
HRESULT hr = S_OK;
if (delegate_)
hr = delegate_->OnDataAvailable(bscf, size, format_etc, stgmed);
@@ -143,7 +145,7 @@ HRESULT BSCBImpl::OnDataAvailable(DWORD bscf, DWORD size,
HRESULT BSCBImpl::OnObjectAvailable(REFIID iid, IUnknown* unk) {
DVLOG(1) << __FUNCTION__ << me()
- << base::StringPrintf(" tid=%i", PlatformThread::CurrentId());
+ << base::StringPrintf(" tid=%i", base::PlatformThread::CurrentId());
HRESULT hr = S_OK;
if (delegate_)
delegate_->OnObjectAvailable(iid, unk);
@@ -154,7 +156,7 @@ HRESULT BSCBImpl::OnObjectAvailable(REFIID iid, IUnknown* unk) {
HRESULT BSCBImpl::GetBindInfoEx(DWORD* bindf, BINDINFO* bind_info,
DWORD* bindf2, DWORD* reserved) {
DVLOG(1) << __FUNCTION__ << me()
- << base::StringPrintf(" tid=%i", PlatformThread::CurrentId());
+ << base::StringPrintf(" tid=%i", base::PlatformThread::CurrentId());
HRESULT hr = S_OK;
if (delegate_) {
ScopedComPtr<IBindStatusCallbackEx> bscbex;
@@ -169,7 +171,7 @@ HRESULT BSCBImpl::BeginningTransaction(LPCWSTR url, LPCWSTR headers,
DWORD reserved,
LPWSTR* additional_headers) {
DVLOG(1) << __FUNCTION__ << me()
- << base::StringPrintf(" tid=%i", PlatformThread::CurrentId());
+ << base::StringPrintf(" tid=%i", base::PlatformThread::CurrentId());
HRESULT hr = S_OK;
if (delegate_) {
@@ -189,7 +191,7 @@ HRESULT BSCBImpl::OnResponse(DWORD response_code, LPCWSTR response_headers,
LPCWSTR request_headers,
LPWSTR* additional_headers) {
DVLOG(1) << __FUNCTION__ << me()
- << base::StringPrintf(" tid=%i", PlatformThread::CurrentId());
+ << base::StringPrintf(" tid=%i", base::PlatformThread::CurrentId());
HRESULT hr = S_OK;
if (delegate_) {
@@ -229,4 +231,3 @@ HRESULT BSCBImpl::GetSerializedClientCertContext(BYTE** cert,
}
return hr;
}
-
diff --git a/chrome_frame/cfproxy_private.h b/chrome_frame/cfproxy_private.h
index 165e231..796ed4a 100644
--- a/chrome_frame/cfproxy_private.h
+++ b/chrome_frame/cfproxy_private.h
@@ -168,7 +168,7 @@ class CFProxy : public Interface2IPCMessage,
virtual void OnChannelError();
bool CalledOnIpcThread() const {
- return PlatformThread::CurrentId() == ipc_thread_.thread_id();
+ return base::PlatformThread::CurrentId() == ipc_thread_.thread_id();
}
base::Thread ipc_thread_;
diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc
index 72dae1e..dc17a6b 100644
--- a/chrome_frame/chrome_frame_automation.cc
+++ b/chrome_frame/chrome_frame_automation.cc
@@ -256,7 +256,7 @@ void AutomationProxyCacheEntry::StartSendUmaInterval(
void AutomationProxyCacheEntry::CreateProxy(ChromeFrameLaunchParams* params,
LaunchDelegate* delegate) {
- DCHECK(IsSameThread(PlatformThread::CurrentId()));
+ DCHECK(IsSameThread(base::PlatformThread::CurrentId()));
DCHECK(delegate);
DCHECK(params);
DCHECK(proxy_.get() == NULL);
@@ -378,7 +378,7 @@ void AutomationProxyCacheEntry::CreateProxy(ChromeFrameLaunchParams* params,
void AutomationProxyCacheEntry::RemoveDelegate(LaunchDelegate* delegate,
base::WaitableEvent* done,
bool* was_last_delegate) {
- DCHECK(IsSameThread(PlatformThread::CurrentId()));
+ DCHECK(IsSameThread(base::PlatformThread::CurrentId()));
DCHECK(delegate);
DCHECK(done);
DCHECK(was_last_delegate);
@@ -412,7 +412,7 @@ void AutomationProxyCacheEntry::RemoveDelegate(LaunchDelegate* delegate,
}
void AutomationProxyCacheEntry::AddDelegate(LaunchDelegate* delegate) {
- DCHECK(IsSameThread(PlatformThread::CurrentId()));
+ DCHECK(IsSameThread(base::PlatformThread::CurrentId()));
DCHECK(std::find(launch_delegates_.begin(),
launch_delegates_.end(),
delegate) == launch_delegates_.end())
@@ -424,7 +424,7 @@ void AutomationProxyCacheEntry::AddDelegate(LaunchDelegate* delegate) {
}
void AutomationProxyCacheEntry::OnChannelError() {
- DCHECK(IsSameThread(PlatformThread::CurrentId()));
+ DCHECK(IsSameThread(base::PlatformThread::CurrentId()));
launch_result_ = AUTOMATION_SERVER_CRASHED;
LaunchDelegates::const_iterator it = launch_delegates_.begin();
for (; it != launch_delegates_.end(); ++it) {
@@ -433,7 +433,7 @@ void AutomationProxyCacheEntry::OnChannelError() {
}
void AutomationProxyCacheEntry::SendUMAData() {
- DCHECK(IsSameThread(PlatformThread::CurrentId()));
+ DCHECK(IsSameThread(base::PlatformThread::CurrentId()));
DCHECK(snapshots_);
// IE uses the chrome frame provided UMA data uploading scheme. NPAPI
// continues to use Chrome to upload UMA data.
@@ -509,7 +509,7 @@ void ProxyFactory::GetAutomationServer(
}
DCHECK(automation_server_id != NULL);
- DCHECK(!entry->IsSameThread(PlatformThread::CurrentId()));
+ DCHECK(!entry->IsSameThread(base::PlatformThread::CurrentId()));
*automation_server_id = entry;
}
@@ -530,7 +530,7 @@ bool ProxyFactory::ReleaseAutomationServer(void* server_id,
proxies_.container().end(),
entry);
DCHECK(it != proxies_.container().end());
- DCHECK(!entry->IsSameThread(PlatformThread::CurrentId()));
+ DCHECK(!entry->IsSameThread(base::PlatformThread::CurrentId()));
lock_.Release();
#endif
@@ -613,7 +613,7 @@ bool ChromeFrameAutomationClient::Initialize(
chrome_launch_params_ = chrome_launch_params;
- ui_thread_id_ = PlatformThread::CurrentId();
+ ui_thread_id_ = base::PlatformThread::CurrentId();
#ifndef NDEBUG
// In debug mode give more time to work with a debugger.
if (IsDebuggerPresent()) {
@@ -868,7 +868,7 @@ void ChromeFrameAutomationClient::InstallExtensionComplete(
const FilePath& crx_path,
void* user_data,
AutomationMsg_ExtensionResponseValues res) {
- DCHECK_EQ(PlatformThread::CurrentId(), ui_thread_id_);
+ DCHECK_EQ(base::PlatformThread::CurrentId(), ui_thread_id_);
if (chrome_frame_delegate_) {
chrome_frame_delegate_->OnExtensionInstalled(crx_path, user_data, res);
@@ -894,7 +894,7 @@ void ChromeFrameAutomationClient::GetEnabledExtensions(void* user_data) {
void ChromeFrameAutomationClient::GetEnabledExtensionsComplete(
void* user_data,
std::vector<FilePath>* extension_directories) {
- DCHECK_EQ(PlatformThread::CurrentId(), ui_thread_id_);
+ DCHECK_EQ(base::PlatformThread::CurrentId(), ui_thread_id_);
if (chrome_frame_delegate_) {
chrome_frame_delegate_->OnGetEnabledExtensionsComplete(
@@ -1064,7 +1064,7 @@ void ChromeFrameAutomationClient::AutomationServerDied() {
void ChromeFrameAutomationClient::InitializeComplete(
AutomationLaunchResult result) {
- DCHECK_EQ(PlatformThread::CurrentId(), ui_thread_id_);
+ DCHECK_EQ(base::PlatformThread::CurrentId(), ui_thread_id_);
if (result != AUTOMATION_SUCCESS) {
DLOG(WARNING) << "InitializeComplete: failure " << result;
ReleaseAutomationServer();
@@ -1197,14 +1197,14 @@ void ChromeFrameAutomationClient::OnChannelError(TabProxy* tab) {
void ChromeFrameAutomationClient::OnMessageReceivedUIThread(
const IPC::Message& msg) {
- DCHECK_EQ(PlatformThread::CurrentId(), ui_thread_id_);
+ DCHECK_EQ(base::PlatformThread::CurrentId(), ui_thread_id_);
// Forward to the delegate.
if (chrome_frame_delegate_)
chrome_frame_delegate_->OnMessageReceived(msg);
}
void ChromeFrameAutomationClient::OnChannelErrorUIThread() {
- DCHECK_EQ(PlatformThread::CurrentId(), ui_thread_id_);
+ DCHECK_EQ(base::PlatformThread::CurrentId(), ui_thread_id_);
// Report a metric that something went wrong unexpectedly.
CrashMetricsReporter::GetInstance()->IncrementMetric(
@@ -1221,7 +1221,7 @@ void ChromeFrameAutomationClient::ReportNavigationError(
if (!chrome_frame_delegate_)
return;
- if (ui_thread_id_ == PlatformThread::CurrentId()) {
+ if (ui_thread_id_ == base::PlatformThread::CurrentId()) {
chrome_frame_delegate_->OnLoadFailed(error_code, url);
} else {
PostTask(FROM_HERE, NewRunnableMethod(this,
diff --git a/chrome_frame/chrome_frame_automation.h b/chrome_frame/chrome_frame_automation.h
index 5b7ec85..73d4f1d 100644
--- a/chrome_frame/chrome_frame_automation.h
+++ b/chrome_frame/chrome_frame_automation.h
@@ -16,8 +16,8 @@
#include "base/scoped_handle.h"
#include "base/stack_container.h"
#include "base/task.h"
-#include "base/timer.h"
#include "base/thread.h"
+#include "base/timer.h"
#include "chrome/common/page_zoom.h"
#include "chrome/test/automation/automation_proxy.h"
#include "chrome/test/automation/tab_proxy.h"
@@ -251,12 +251,12 @@ class AutomationProxyCacheEntry
return thread_->message_loop();
}
- bool IsSameThread(PlatformThreadId id) const {
+ bool IsSameThread(base::PlatformThreadId id) const {
return thread_->thread_id() == id;
}
ChromeFrameAutomationProxyImpl* proxy() const {
- DCHECK(IsSameThread(PlatformThread::CurrentId()));
+ DCHECK(IsSameThread(base::PlatformThread::CurrentId()));
return proxy_.get();
}
@@ -509,7 +509,7 @@ class ChromeFrameAutomationClient
}
HWND parent_window_;
- PlatformThreadId ui_thread_id_;
+ base::PlatformThreadId ui_thread_id_;
void* automation_server_id_;
ChromeFrameAutomationProxy* automation_server_;
diff --git a/chrome_frame/test/mock_ie_event_sink_actions.h b/chrome_frame/test/mock_ie_event_sink_actions.h
index 9e9dc3b..a3dc60c 100644
--- a/chrome_frame/test/mock_ie_event_sink_actions.h
+++ b/chrome_frame/test/mock_ie_event_sink_actions.h
@@ -9,7 +9,7 @@
#include <string>
#include "base/basictypes.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#include "base/time.h"
#include "chrome/common/chrome_switches.h"
#include "chrome_frame/test/chrome_frame_test_utils.h"
@@ -341,7 +341,7 @@ ACTION_P(VerifySelectedText, expected_text) {
ACTION_P3(CloseWhenFileSaved, mock, file, timeout_ms) {
base::Time start = base::Time::Now();
while (!file_util::PathExists(file)) {
- PlatformThread::Sleep(200);
+ base::PlatformThread::Sleep(200);
if ((base::Time::Now() - start).InMilliseconds() > timeout_ms) {
ADD_FAILURE() << "File was not saved within timeout";
break;
@@ -353,7 +353,7 @@ ACTION_P3(CloseWhenFileSaved, mock, file, timeout_ms) {
ACTION_P2(WaitForFileSave, file, timeout_ms) {
base::Time start = base::Time::Now();
while (!file_util::PathExists(file)) {
- PlatformThread::Sleep(200);
+ base::PlatformThread::Sleep(200);
if ((base::Time::Now() - start).InMilliseconds() > timeout_ms) {
ADD_FAILURE() << "File was not saved within timeout";
break;
diff --git a/chrome_frame/test/perf/chrome_frame_perftest.cc b/chrome_frame/test/perf/chrome_frame_perftest.cc
index 67220aa..f589146 100644
--- a/chrome_frame/test/perf/chrome_frame_perftest.cc
+++ b/chrome_frame/test/perf/chrome_frame_perftest.cc
@@ -11,6 +11,7 @@
#include "chrome_tab.h" // Generated from chrome_tab.idl.
+#include "base/debug/trace_event_win.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/path_service.h"
@@ -18,11 +19,11 @@
#include "base/scoped_ptr.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
+#include "base/threading/platform_thread.h"
#include "base/time.h"
-#include "base/debug/trace_event_win.h"
#include "base/utf_string_conversions.h"
-#include "base/win/event_trace_controller.h"
#include "base/win/event_trace_consumer.h"
+#include "base/win/event_trace_controller.h"
#include "base/win/registry.h"
#include "base/win/scoped_bstr.h"
#include "base/win/scoped_comptr.h"
@@ -32,7 +33,6 @@
#include "chrome/common/chrome_paths_internal.h"
#include "chrome/test/chrome_process_util.h"
#include "chrome/test/ui/ui_perf_test.h"
-
#include "chrome_frame/test_utils.h"
#include "chrome_frame/utils.h"
@@ -343,7 +343,7 @@ class ChromeFrameStartupTest : public ChromeFramePerfTestBase {
// TODO(beng): Can't shut down so quickly. Figure out why, and fix. If we
// do, we crash.
- PlatformThread::Sleep(50);
+ base::PlatformThread::Sleep(50);
}
std::string times;
@@ -810,7 +810,7 @@ class ChromeFrameActiveXMemoryTest : public MemoryTestBase {
PrintResults(test_name_.c_str());
CoFreeUnusedLibraries();
- PlatformThread::Sleep(100);
+ base::PlatformThread::Sleep(100);
}
void NavigateImpl(const std::string& url) {
diff --git a/chrome_frame/test/run_all_unittests.cc b/chrome_frame/test/run_all_unittests.cc
index 92edb2f..694c6c0 100644
--- a/chrome_frame/test/run_all_unittests.cc
+++ b/chrome_frame/test/run_all_unittests.cc
@@ -4,9 +4,10 @@
#include <atlbase.h>
+#include "base/command_line.h"
#include "base/process_util.h"
#include "base/test/test_suite.h"
-#include "base/command_line.h"
+#include "base/threading/platform_thread.h"
#include "chrome/common/chrome_paths.h"
#include "chrome_frame/test/chrome_frame_test_utils.h"
#include "chrome_frame/test/chrome_frame_ui_test_utils.h"
@@ -32,7 +33,7 @@ void PureCall() {
int main(int argc, char **argv) {
base::EnableTerminationOnHeapCorruption();
- PlatformThread::SetName("ChromeFrame tests");
+ base::PlatformThread::SetName("ChromeFrame tests");
_set_purecall_handler(PureCall);
diff --git a/chrome_frame/urlmon_bind_status_callback.cc b/chrome_frame/urlmon_bind_status_callback.cc
index 474f8f3..34520ef 100644
--- a/chrome_frame/urlmon_bind_status_callback.cc
+++ b/chrome_frame/urlmon_bind_status_callback.cc
@@ -10,6 +10,7 @@
#include "base/logging.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
+#include "base/threading/platform_thread.h"
#include "base/utf_string_conversions.h"
#include "chrome_frame/bind_context_info.h"
#include "chrome_frame/exception_barrier.h"
@@ -213,7 +214,7 @@ BSCBStorageBind::~BSCBStorageBind() {
HRESULT BSCBStorageBind::Initialize(IMoniker* moniker, IBindCtx* bind_ctx) {
DVLOG(1) << __FUNCTION__ << me()
- << base::StringPrintf(" tid=%i", PlatformThread::CurrentId());
+ << base::StringPrintf(" tid=%i", base::PlatformThread::CurrentId());
std::wstring url = GetActualUrlFromMoniker(moniker, bind_ctx,
std::wstring());
@@ -239,7 +240,8 @@ STDMETHODIMP BSCBStorageBind::OnProgress(ULONG progress, ULONG progress_max,
ULONG status_code, LPCWSTR status_text) {
DVLOG(1) << __FUNCTION__ << me()
<< base::StringPrintf(" status=%i tid=%i %ls", status_code,
- PlatformThread::CurrentId(), status_text);
+ base::PlatformThread::CurrentId(),
+ status_text);
// Report all crashes in the exception handler if we wrap the callback.
// Note that this avoids having the VEH report a crash if an SEH earlier in
// the chain handles the exception.
@@ -273,7 +275,7 @@ STDMETHODIMP BSCBStorageBind::OnDataAvailable(DWORD flags, DWORD size,
FORMATETC* format_etc,
STGMEDIUM* stgmed) {
DVLOG(1) << __FUNCTION__
- << base::StringPrintf(" tid=%i", PlatformThread::CurrentId());
+ << base::StringPrintf(" tid=%i", base::PlatformThread::CurrentId());
// Report all crashes in the exception handler if we wrap the callback.
// Note that this avoids having the VEH report a crash if an SEH earlier in
// the chain handles the exception.
@@ -316,7 +318,7 @@ STDMETHODIMP BSCBStorageBind::OnDataAvailable(DWORD flags, DWORD size,
STDMETHODIMP BSCBStorageBind::OnStopBinding(HRESULT hresult, LPCWSTR error) {
DVLOG(1) << __FUNCTION__
- << base::StringPrintf(" tid=%i", PlatformThread::CurrentId());
+ << base::StringPrintf(" tid=%i", base::PlatformThread::CurrentId());
// Report all crashes in the exception handler if we wrap the callback.
// Note that this avoids having the VEH report a crash if an SEH earlier in
// the chain handles the exception.
diff --git a/chrome_frame/urlmon_url_request.cc b/chrome_frame/urlmon_url_request.cc
index d191515..7f3c8e9 100644
--- a/chrome_frame/urlmon_url_request.cc
+++ b/chrome_frame/urlmon_url_request.cc
@@ -12,6 +12,7 @@
#include "base/scoped_ptr.h"
#include "base/string_number_conversions.h"
#include "base/stringprintf.h"
+#include "base/threading/platform_thread.h"
#include "base/utf_string_conversions.h"
#include "chrome_frame/bind_context_info.h"
#include "chrome_frame/chrome_frame_activex_base.h"
@@ -47,8 +48,8 @@ std::string UrlmonUrlRequest::me() const {
bool UrlmonUrlRequest::Start() {
DVLOG(1) << __FUNCTION__ << me() << url();
- DCHECK(thread_ == 0 || thread_ == PlatformThread::CurrentId());
- thread_ = PlatformThread::CurrentId();
+ DCHECK(thread_ == 0 || thread_ == base::PlatformThread::CurrentId());
+ thread_ = base::PlatformThread::CurrentId();
status_.Start();
// The UrlmonUrlRequest instance can get destroyed in the context of
// StartAsyncDownload if BindToStorage finishes synchronously with an error.
@@ -64,7 +65,7 @@ bool UrlmonUrlRequest::Start() {
}
void UrlmonUrlRequest::Stop() {
- DCHECK_EQ(thread_, PlatformThread::CurrentId());
+ DCHECK_EQ(thread_, base::PlatformThread::CurrentId());
DCHECK((status_.get_state() != Status::DONE) == (binding_ != NULL));
Status::State state = status_.get_state();
delegate_ = NULL;
@@ -92,7 +93,7 @@ void UrlmonUrlRequest::Stop() {
}
bool UrlmonUrlRequest::Read(int bytes_to_read) {
- DCHECK_EQ(thread_, PlatformThread::CurrentId());
+ DCHECK_EQ(thread_, base::PlatformThread::CurrentId());
DCHECK_GE(bytes_to_read, 0);
DCHECK_EQ(0, calling_delegate_);
DVLOG(1) << __FUNCTION__ << me();
@@ -136,8 +137,8 @@ HRESULT UrlmonUrlRequest::InitPending(const GURL& url, IMoniker* moniker,
DCHECK(bind_context_ == NULL);
DCHECK(moniker_ == NULL);
DCHECK(cache_ == NULL);
- DCHECK(thread_ == 0 || thread_ == PlatformThread::CurrentId());
- thread_ = PlatformThread::CurrentId();
+ DCHECK(thread_ == 0 || thread_ == base::PlatformThread::CurrentId());
+ thread_ = base::PlatformThread::CurrentId();
bind_context_ = bind_context;
moniker_ = moniker;
enable_frame_busting_ = enable_frame_busting;
@@ -156,7 +157,7 @@ HRESULT UrlmonUrlRequest::InitPending(const GURL& url, IMoniker* moniker,
}
void UrlmonUrlRequest::TerminateBind(TerminateBindCallback* callback) {
- DCHECK_EQ(thread_, PlatformThread::CurrentId());
+ DCHECK_EQ(thread_, base::PlatformThread::CurrentId());
DVLOG(1) << __FUNCTION__ << me();
cleanup_transaction_ = false;
if (status_.get_state() == Status::DONE) {
@@ -190,7 +191,7 @@ void UrlmonUrlRequest::TerminateBind(TerminateBindCallback* callback) {
}
size_t UrlmonUrlRequest::SendDataToDelegate(size_t bytes_to_read) {
- DCHECK_EQ(thread_, PlatformThread::CurrentId());
+ DCHECK_EQ(thread_, base::PlatformThread::CurrentId());
DCHECK_NE(id(), -1);
DCHECK_GT(bytes_to_read, 0U);
size_t bytes_copied = 0;
@@ -242,7 +243,7 @@ size_t UrlmonUrlRequest::SendDataToDelegate(size_t bytes_to_read) {
STDMETHODIMP UrlmonUrlRequest::OnStartBinding(DWORD reserved,
IBinding* binding) {
- DCHECK_EQ(thread_, PlatformThread::CurrentId());
+ DCHECK_EQ(thread_, base::PlatformThread::CurrentId());
binding_ = binding;
if (pending_) {
response_headers_ = GetHttpHeadersFromBinding(binding_);
@@ -264,7 +265,7 @@ STDMETHODIMP UrlmonUrlRequest::OnLowResource(DWORD reserved) {
STDMETHODIMP UrlmonUrlRequest::OnProgress(ULONG progress, ULONG max_progress,
ULONG status_code, LPCWSTR status_text) {
- DCHECK_EQ(thread_, PlatformThread::CurrentId());
+ DCHECK_EQ(thread_, base::PlatformThread::CurrentId());
if (status_.get_state() != Status::WORKING)
return S_OK;
@@ -341,7 +342,7 @@ STDMETHODIMP UrlmonUrlRequest::OnProgress(ULONG progress, ULONG max_progress,
}
STDMETHODIMP UrlmonUrlRequest::OnStopBinding(HRESULT result, LPCWSTR error) {
- DCHECK_EQ(thread_, PlatformThread::CurrentId());
+ DCHECK_EQ(thread_, base::PlatformThread::CurrentId());
DVLOG(1) << __FUNCTION__ << me()
<< "- Request stopped, Result: " << std::hex << result;
DCHECK(status_.get_state() == Status::WORKING ||
@@ -485,7 +486,7 @@ STDMETHODIMP UrlmonUrlRequest::GetBindInfo(DWORD* bind_flags,
STDMETHODIMP UrlmonUrlRequest::OnDataAvailable(DWORD flags, DWORD size,
FORMATETC* formatetc,
STGMEDIUM* storage) {
- DCHECK_EQ(thread_, PlatformThread::CurrentId());
+ DCHECK_EQ(thread_, base::PlatformThread::CurrentId());
DVLOG(1) << __FUNCTION__ << me() << "bytes available: " << size;
if (terminate_requested()) {
@@ -538,7 +539,7 @@ STDMETHODIMP UrlmonUrlRequest::OnObjectAvailable(REFIID iid, IUnknown* object) {
STDMETHODIMP UrlmonUrlRequest::BeginningTransaction(const wchar_t* url,
const wchar_t* current_headers, DWORD reserved,
wchar_t** additional_headers) {
- DCHECK_EQ(thread_, PlatformThread::CurrentId());
+ DCHECK_EQ(thread_, base::PlatformThread::CurrentId());
if (!additional_headers) {
NOTREACHED();
return E_POINTER;
@@ -614,7 +615,7 @@ STDMETHODIMP UrlmonUrlRequest::BeginningTransaction(const wchar_t* url,
STDMETHODIMP UrlmonUrlRequest::OnResponse(DWORD dwResponseCode,
const wchar_t* response_headers, const wchar_t* request_headers,
wchar_t** additional_headers) {
- DCHECK_EQ(thread_, PlatformThread::CurrentId());
+ DCHECK_EQ(thread_, base::PlatformThread::CurrentId());
DVLOG(1) << __FUNCTION__ << me() << "headers: \n" << response_headers;
if (!delegate_) {
@@ -829,7 +830,7 @@ HRESULT UrlmonUrlRequest::StartAsyncDownload() {
}
void UrlmonUrlRequest::NotifyDelegateAndDie() {
- DCHECK_EQ(thread_, PlatformThread::CurrentId());
+ DCHECK_EQ(thread_, base::PlatformThread::CurrentId());
DVLOG(1) << __FUNCTION__ << me();
PluginUrlRequestDelegate* delegate = delegate_;
diff --git a/chrome_frame/urlmon_url_request_private.h b/chrome_frame/urlmon_url_request_private.h
index cdd5419..ebe027c 100644
--- a/chrome_frame/urlmon_url_request_private.h
+++ b/chrome_frame/urlmon_url_request_private.h
@@ -10,6 +10,7 @@
#include <string>
#include "base/callback.h"
+#include "base/threading/platform_thread.h"
#include "net/base/net_errors.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request_status.h"
@@ -233,7 +234,7 @@ class UrlmonUrlRequest
ScopedComPtr<IStream> pending_data_;
size_t pending_read_size_;
- PlatformThreadId thread_;
+ base::PlatformThreadId thread_;
HWND parent_window_;
bool headers_received_;
int calling_delegate_; // re-entrancy protection.
diff --git a/net/base/listen_socket.cc b/net/base/listen_socket.cc
index c964ec9..445d57d 100644
--- a/net/base/listen_socket.cc
+++ b/net/base/listen_socket.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.
@@ -22,6 +22,7 @@
#endif
#include "base/eintr_wrapper.h"
+#include "base/threading/platform_thread.h"
#include "net/base/net_util.h"
#include "net/base/listen_socket.h"
@@ -231,7 +232,7 @@ void ListenSocket::SendInternal(const char* bytes, int len) {
send_buf += sent;
len_left -= sent;
}
- PlatformThread::YieldCurrentThread();
+ base::PlatformThread::YieldCurrentThread();
}
}
diff --git a/net/disk_cache/block_files.cc b/net/disk_cache/block_files.cc
index 9d5de62..3eb4e35 100644
--- a/net/disk_cache/block_files.cc
+++ b/net/disk_cache/block_files.cc
@@ -8,7 +8,7 @@
#include "base/metrics/histogram.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
-#include "base/thread_checker.h"
+#include "base/threading/thread_checker.h"
#include "base/time.h"
#include "net/disk_cache/cache_util.h"
#include "net/disk_cache/file_lock.h"
@@ -201,7 +201,7 @@ bool BlockFiles::Init(bool create_files) {
if (init_)
return false;
- thread_checker_.reset(new ThreadChecker);
+ thread_checker_.reset(new base::ThreadChecker);
block_files_.resize(kFirstAdditionalBlockFile);
for (int i = 0; i < kFirstAdditionalBlockFile; i++) {
diff --git a/net/disk_cache/block_files.h b/net/disk_cache/block_files.h
index 5427a58..d677ba3 100644
--- a/net/disk_cache/block_files.h
+++ b/net/disk_cache/block_files.h
@@ -16,7 +16,9 @@
#include "net/disk_cache/addr.h"
#include "net/disk_cache/mapped_file.h"
+namespace base {
class ThreadChecker;
+}
namespace disk_cache {
@@ -87,7 +89,7 @@ class BlockFiles {
char* zero_buffer_; // Buffer to speed-up cleaning deleted entries.
FilePath path_; // Path to the backing folder.
std::vector<MappedFile*> block_files_; // The actual files.
- scoped_ptr<ThreadChecker> thread_checker_;
+ scoped_ptr<base::ThreadChecker> thread_checker_;
FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_ZeroSizeFile);
FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_InvalidFile);
diff --git a/net/http/http_auth_controller.cc b/net/http/http_auth_controller.cc
index e97d06e..ddd0bdb 100644
--- a/net/http/http_auth_controller.cc
+++ b/net/http/http_auth_controller.cc
@@ -6,6 +6,7 @@
#include "base/metrics/histogram.h"
#include "base/string_util.h"
+#include "base/threading/platform_thread.h"
#include "base/utf_string_conversions.h"
#include "net/base/auth.h"
#include "net/base/host_resolver.h"
@@ -90,8 +91,9 @@ void HistogramAuthEvent(HttpAuthHandler* handler, AuthEvent auth_event) {
// used on the same thread, in which case there are no race conditions. If
// there are race conditions (say, a read completes during a partial write),
// the DCHECK will correctly fail.
- static PlatformThreadId first_thread = PlatformThread::CurrentId();
- DCHECK_EQ(first_thread, PlatformThread::CurrentId());
+ static base::PlatformThreadId first_thread =
+ base::PlatformThread::CurrentId();
+ DCHECK_EQ(first_thread, base::PlatformThread::CurrentId());
#endif
HttpAuthHandler::AuthScheme auth_scheme = handler->auth_scheme();
diff --git a/net/ocsp/nss_ocsp.cc b/net/ocsp/nss_ocsp.cc
index 02edd05..c35c572 100644
--- a/net/ocsp/nss_ocsp.cc
+++ b/net/ocsp/nss_ocsp.cc
@@ -25,7 +25,7 @@
#include "base/stl_util-inl.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
-#include "base/thread_checker.h"
+#include "base/threading/thread_checker.h"
#include "base/time.h"
#include "googleurl/src/gurl.h"
#include "net/base/io_buffer.h"
@@ -80,7 +80,7 @@ class OCSPIOLoop {
bool used_; // Protected by |lock_|.
// This should not be modified after |used_|.
MessageLoopForIO* io_loop_; // Protected by |lock_|.
- ThreadChecker thread_checker_;
+ base::ThreadChecker thread_checker_;
DISALLOW_COPY_AND_ASSIGN(OCSPIOLoop);
};
diff --git a/net/proxy/multi_threaded_proxy_resolver_unittest.cc b/net/proxy/multi_threaded_proxy_resolver_unittest.cc
index a18804f..8f787f4 100644
--- a/net/proxy/multi_threaded_proxy_resolver_unittest.cc
+++ b/net/proxy/multi_threaded_proxy_resolver_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,7 @@
#include "base/stl_util-inl.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
+#include "base/threading/platform_thread.h"
#include "base/utf_string_conversions.h"
#include "base/waitable_event.h"
#include "googleurl/src/gurl.h"
@@ -40,7 +41,7 @@ class MockProxyResolver : public ProxyResolver {
RequestHandle* request,
const BoundNetLog& net_log) {
if (resolve_latency_ms_)
- PlatformThread::Sleep(resolve_latency_ms_);
+ base::PlatformThread::Sleep(resolve_latency_ms_);
CheckIsOnWorkerThread();
diff --git a/net/socket/tcp_client_socket_pool_unittest.cc b/net/socket/tcp_client_socket_pool_unittest.cc
index 454f5b8..bd1b8bd 100644
--- a/net/socket/tcp_client_socket_pool_unittest.cc
+++ b/net/socket/tcp_client_socket_pool_unittest.cc
@@ -7,6 +7,7 @@
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/message_loop.h"
+#include "base/threading/platform_thread.h"
#include "net/base/mock_host_resolver.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
@@ -758,7 +759,8 @@ TEST_F(TCPClientSocketPoolTest, BackupSocketConnect) {
MessageLoop::current()->RunAllPending();
// Wait for the backup socket timer to fire.
- PlatformThread::Sleep(ClientSocketPool::kMaxConnectRetryIntervalMs * 2);
+ base::PlatformThread::Sleep(
+ ClientSocketPool::kMaxConnectRetryIntervalMs * 2);
// Let the appropriate socket connect.
MessageLoop::current()->RunAllPending();
@@ -800,7 +802,7 @@ TEST_F(TCPClientSocketPoolTest, BackupSocketCancel) {
if (index == CANCEL_AFTER_WAIT) {
// Wait for the backup socket timer to fire.
- PlatformThread::Sleep(ClientSocketPool::kMaxConnectRetryIntervalMs);
+ base::PlatformThread::Sleep(ClientSocketPool::kMaxConnectRetryIntervalMs);
}
// Let the appropriate socket connect.
@@ -843,7 +845,7 @@ TEST_F(TCPClientSocketPoolTest, BackupSocketFailAfterStall) {
MessageLoop::current()->RunAllPending();
// Wait for the backup socket timer to fire.
- PlatformThread::Sleep(ClientSocketPool::kMaxConnectRetryIntervalMs);
+ base::PlatformThread::Sleep(ClientSocketPool::kMaxConnectRetryIntervalMs);
// Let the second connect be synchronous. Otherwise, the emulated
// host resolution takes an extra trip through the message loop.
@@ -888,7 +890,7 @@ TEST_F(TCPClientSocketPoolTest, BackupSocketFailAfterDelay) {
MessageLoop::current()->RunAllPending();
// Wait for the backup socket timer to fire.
- PlatformThread::Sleep(ClientSocketPool::kMaxConnectRetryIntervalMs);
+ base::PlatformThread::Sleep(ClientSocketPool::kMaxConnectRetryIntervalMs);
// Let the second connect be synchronous. Otherwise, the emulated
// host resolution takes an extra trip through the message loop.
diff --git a/remoting/base/tracer.cc b/remoting/base/tracer.cc
index e7b8b0e..86aec23 100644
--- a/remoting/base/tracer.cc
+++ b/remoting/base/tracer.cc
@@ -10,6 +10,7 @@
#include "base/condition_variable.h"
#include "base/lazy_instance.h"
#include "base/message_loop.h"
+#include "base/platform_thread.h"
#include "base/rand_util.h"
#include "base/ref_counted.h"
#include "base/stl_util-inl.h"
@@ -135,7 +136,7 @@ void Tracer::PrintString(const std::string& s) {
// Take the pointer for the current messageloop as identifying for the
// current thread.
- record->set_thread_id(static_cast<uint64>(PlatformThread::CurrentId()));
+ record->set_thread_id(static_cast<uint64>(base::PlatformThread::CurrentId()));
}
Tracer::~Tracer() {
diff --git a/webkit/tools/test_shell/simple_database_system.cc b/webkit/tools/test_shell/simple_database_system.cc
index 28b89d1..c5a573e 100644
--- a/webkit/tools/test_shell/simple_database_system.cc
+++ b/webkit/tools/test_shell/simple_database_system.cc
@@ -7,6 +7,7 @@
#include "base/auto_reset.h"
#include "base/file_util.h"
#include "base/message_loop.h"
+#include "base/platform_thread.h"
#include "base/utf_string_conversions.h"
#include "third_party/sqlite/sqlite3.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDatabase.h"
@@ -66,7 +67,7 @@ int SimpleDatabaseSystem::DeleteFile(
error_code = VfsBackend::DeleteFile(file_name, sync_dir);
} while ((++num_retries < kNumDeleteRetries) &&
(error_code == SQLITE_IOERR_DELETE) &&
- (PlatformThread::Sleep(10), 1));
+ (base::PlatformThread::Sleep(10), 1));
return error_code;
}