Skip to content

Commit

Permalink
Move platform_thread to base/threading and put in the base namespace.…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
brettw@chromium.org committed Dec 31, 2010
1 parent a8e2058 commit ce072a7
Show file tree
Hide file tree
Showing 111 changed files with 545 additions and 441 deletions.
4 changes: 2 additions & 2 deletions base/base.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
12 changes: 6 additions & 6 deletions base/base.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions base/cancellation_flag.h
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -7,7 +7,7 @@
#pragma once

#include "base/atomicops.h"
#include "base/platform_thread.h"
#include "base/threading/platform_thread.h"

namespace base {

Expand Down
6 changes: 4 additions & 2 deletions base/condition_variable_unittest.cc
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion base/debug/debugger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "base/debug/debugger.h"

#include "base/platform_thread.h"
#include "base/threading/platform_thread.h"

namespace base {
namespace debug {
Expand Down
2 changes: 1 addition & 1 deletion base/debug/trace_event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
6 changes: 3 additions & 3 deletions base/file_util_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions base/lazy_instance.cc
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion base/lazy_instance_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions base/lock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions base/lock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 5 additions & 1 deletion base/lock_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 ----------
Expand Down
3 changes: 2 additions & 1 deletion base/message_loop_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -21,6 +21,7 @@
#include "base/message_pump_libevent.h"
#endif

using base::PlatformThread;
using base::Thread;
using base::Time;
using base::TimeDelta;
Expand Down
8 changes: 4 additions & 4 deletions base/message_pump_glib.cc
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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 {

Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion base/message_pump_glib_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion base/metrics/stats_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion base/metrics/stats_table_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 2 additions & 3 deletions base/non_thread_safe.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -43,7 +42,7 @@ class NonThreadSafe {
void DetachFromThread();

private:
ThreadChecker thread_checker_;
base::ThreadChecker thread_checker_;
};
#else
// Do nothing in release mode.
Expand Down
8 changes: 3 additions & 5 deletions base/observer_list_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
Loading

0 comments on commit ce072a7

Please sign in to comment.