diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-02 06:05:39 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-02 06:05:39 +0000 |
commit | 44f9c950c66c18b205f1dd56a793693899b5057a (patch) | |
tree | 4d742f4838732d42bd7f536f8440df7aa0bbbcbf /base | |
parent | f2bcc90abc6c33292592b17351973600b51e9b62 (diff) | |
download | chromium_src-44f9c950c66c18b205f1dd56a793693899b5057a.zip chromium_src-44f9c950c66c18b205f1dd56a793693899b5057a.tar.gz chromium_src-44f9c950c66c18b205f1dd56a793693899b5057a.tar.bz2 |
Move CancellationFlag and WaitableEvent to the synchronization subdirectory.
TEST=it compiles
BUG=none
Review URL: http://codereview.chromium.org/5977010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70369 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
21 files changed, 63 insertions, 65 deletions
diff --git a/base/base.gyp b/base/base.gyp index 50a19ee..6dc450c 100644 --- a/base/base.gyp +++ b/base/base.gyp @@ -65,7 +65,6 @@ 'base64_unittest.cc', 'bits_unittest.cc', 'callback_unittest.cc', - 'cancellation_flag_unittest.cc', 'command_line_unittest.cc', 'crypto/encryptor_unittest.cc', 'crypto/rsa_private_key_unittest.cc', @@ -130,8 +129,11 @@ 'string_util_unittest.cc', 'stringize_macros_unittest.cc', 'stringprintf_unittest.cc', + 'synchronization/cancellation_flag_unittest.cc', 'synchronization/condition_variable_unittest.cc', 'synchronization/lock_unittest.cc', + 'synchronization/waitable_event_unittest.cc', + 'synchronization/waitable_event_watcher_unittest.cc', 'sys_info_unittest.cc', 'sys_string_conversions_mac_unittest.mm', 'sys_string_conversions_unittest.cc', @@ -159,8 +161,6 @@ 'values_unittest.cc', 'version_unittest.cc', 'vlog_unittest.cc', - 'waitable_event_unittest.cc', - 'waitable_event_watcher_unittest.cc', 'weak_ptr_unittest.cc', 'win/event_trace_consumer_unittest.cc', 'win/event_trace_controller_unittest.cc', diff --git a/base/base.gypi b/base/base.gypi index 4147e68..3d650dc 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -39,8 +39,6 @@ 'bits.h', 'bzip2_error_handler.cc', 'callback.h', - 'cancellation_flag.cc', - 'cancellation_flag.h', 'command_line.cc', 'command_line.h', 'compiler_specific.h', @@ -209,6 +207,8 @@ 'stringize_macros.h', 'stringprintf.cc', 'stringprintf.h', + 'synchronization/cancellation_flag.cc', + 'synchronization/cancellation_flag.h', 'synchronization/condition_variable.h', 'synchronization/condition_variable_posix.cc', 'synchronization/condition_variable_win.cc', @@ -217,6 +217,12 @@ 'synchronization/lock_impl.h', 'synchronization/lock_impl_posix.cc', 'synchronization/lock_impl_win.cc', + 'synchronization/waitable_event.h', + 'synchronization/waitable_event_posix.cc', + 'synchronization/waitable_event_watcher.h', + 'synchronization/waitable_event_watcher_posix.cc', + 'synchronization/waitable_event_watcher_win.cc', + 'synchronization/waitable_event_win.cc', 'sys_info.h', 'sys_info_chromeos.cc', 'sys_info_freebsd.cc', @@ -286,12 +292,6 @@ 'version.h', 'vlog.cc', 'vlog.h', - 'waitable_event.h', - 'waitable_event_posix.cc', - 'waitable_event_watcher.h', - 'waitable_event_watcher_posix.cc', - 'waitable_event_watcher_win.cc', - 'waitable_event_win.cc', 'weak_ptr.cc', 'weak_ptr.h', 'win/i18n.cc', diff --git a/base/message_pump_default.h b/base/message_pump_default.h index 3dfbf1c..5030aa9 100644 --- a/base/message_pump_default.h +++ b/base/message_pump_default.h @@ -8,7 +8,7 @@ #include "base/message_pump.h" #include "base/time.h" -#include "base/waitable_event.h" +#include "base/synchronization/waitable_event.h" namespace base { diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc index c5cc8c3..9d0ba58 100644 --- a/base/process_util_posix.cc +++ b/base/process_util_posix.cc @@ -25,10 +25,10 @@ #include "base/process_util.h" #include "base/scoped_ptr.h" #include "base/stringprintf.h" +#include "base/synchronization/waitable_event.h" #include "base/threading/platform_thread.h" #include "base/threading/thread_restrictions.h" #include "base/time.h" -#include "base/waitable_event.h" #if defined(OS_MACOSX) #include <crt_externs.h> diff --git a/base/cancellation_flag.cc b/base/synchronization/cancellation_flag.cc index 50e30ec..ad3b551 100644 --- a/base/cancellation_flag.cc +++ b/base/synchronization/cancellation_flag.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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/cancellation_flag.h" +#include "base/synchronization/cancellation_flag.h" #include "base/logging.h" diff --git a/base/cancellation_flag.h b/base/synchronization/cancellation_flag.h index b4fddb2..29ecd89 100644 --- a/base/cancellation_flag.h +++ b/base/synchronization/cancellation_flag.h @@ -1,9 +1,9 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef BASE_CANCELLATION_FLAG_H_ -#define BASE_CANCELLATION_FLAG_H_ +#ifndef BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_ +#define BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_ #pragma once #include "base/atomicops.h" @@ -40,4 +40,4 @@ class CancellationFlag { } // namespace base -#endif // BASE_CANCELLATION_FLAG_H_ +#endif // BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_ diff --git a/base/cancellation_flag_unittest.cc b/base/synchronization/cancellation_flag_unittest.cc index 9c9ffd7..c405c79 100644 --- a/base/cancellation_flag_unittest.cc +++ b/base/synchronization/cancellation_flag_unittest.cc @@ -1,10 +1,10 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. // Tests of CancellationFlag class. -#include "base/cancellation_flag.h" +#include "base/synchronization/cancellation_flag.h" #include "base/logging.h" #include "base/message_loop.h" @@ -14,9 +14,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" -using base::CancellationFlag; -using base::TimeDelta; -using base::Thread; +namespace base { namespace { @@ -65,3 +63,5 @@ TEST(CancellationFlagTest, SetOnDifferentThreadDeathTest) { } } // namespace + +} // namespace base diff --git a/base/waitable_event.h b/base/synchronization/waitable_event.h index 081ad66..70b9da0 100644 --- a/base/waitable_event.h +++ b/base/synchronization/waitable_event.h @@ -1,9 +1,9 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef BASE_WAITABLE_EVENT_H_ -#define BASE_WAITABLE_EVENT_H_ +#ifndef BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_ +#define BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_ #pragma once #include "base/basictypes.h" @@ -176,4 +176,4 @@ class WaitableEvent { } // namespace base -#endif // BASE_WAITABLE_EVENT_H_ +#endif // BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_ diff --git a/base/waitable_event_posix.cc b/base/synchronization/waitable_event_posix.cc index f6a6aab..9cbc03a 100644 --- a/base/waitable_event_posix.cc +++ b/base/synchronization/waitable_event_posix.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/waitable_event.h" +#include "base/synchronization/waitable_event.h" #include "base/synchronization/condition_variable.h" #include "base/synchronization/lock.h" diff --git a/base/waitable_event_unittest.cc b/base/synchronization/waitable_event_unittest.cc index b4f1991..47e7ff7 100644 --- a/base/waitable_event_unittest.cc +++ b/base/synchronization/waitable_event_unittest.cc @@ -1,18 +1,13 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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/synchronization/waitable_event.h" #include "base/threading/platform_thread.h" #include "testing/gtest/include/gtest/gtest.h" -using base::TimeDelta; -using base::WaitableEvent; - -namespace { -typedef testing::Test WaitableEventTest; -} +namespace base { TEST(WaitableEventTest, ManualBasics) { WaitableEvent event(true, false); @@ -74,7 +69,7 @@ TEST(WaitableEventTest, WaitManyShortcut) { delete ev[i]; } -class WaitableEventSignaler : public base::PlatformThread::Delegate { +class WaitableEventSignaler : public PlatformThread::Delegate { public: WaitableEventSignaler(double seconds, WaitableEvent* ev) : seconds_(seconds), @@ -82,7 +77,7 @@ class WaitableEventSignaler : public base::PlatformThread::Delegate { } void ThreadMain() { - base::PlatformThread::Sleep(static_cast<int>(seconds_ * 1000)); + PlatformThread::Sleep(static_cast<int>(seconds_ * 1000)); ev_->Signal(); } @@ -97,13 +92,15 @@ TEST(WaitableEventTest, WaitMany) { ev[i] = new WaitableEvent(false, false); WaitableEventSignaler signaler(0.1, ev[2]); - base::PlatformThreadHandle thread; - base::PlatformThread::Create(0, &signaler, &thread); + PlatformThreadHandle thread; + PlatformThread::Create(0, &signaler, &thread); EXPECT_EQ(WaitableEvent::WaitMany(ev, 5), 2u); - base::PlatformThread::Join(thread); + PlatformThread::Join(thread); for (unsigned i = 0; i < 5; ++i) delete ev[i]; } + +} // namespace base diff --git a/base/waitable_event_watcher.h b/base/synchronization/waitable_event_watcher.h index c54419e..e396368 100644 --- a/base/waitable_event_watcher.h +++ b/base/synchronization/waitable_event_watcher.h @@ -1,9 +1,9 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef BASE_WAITABLE_EVENT_WATCHER_H_ -#define BASE_WAITABLE_EVENT_WATCHER_H_ +#ifndef BASE_SYNCHRONIZATION_WAITABLE_EVENT_WATCHER_H_ +#define BASE_SYNCHRONIZATION_WAITABLE_EVENT_WATCHER_H_ #pragma once #include "build/build_config.h" @@ -12,7 +12,7 @@ #include "base/win/object_watcher.h" #else #include "base/message_loop.h" -#include "base/waitable_event.h" +#include "base/synchronization/waitable_event.h" #endif namespace base { @@ -159,4 +159,4 @@ class WaitableEventWatcher } // namespace base -#endif // BASE_WAITABLE_EVENT_WATCHER_H_ +#endif // BASE_SYNCHRONIZATION_WAITABLE_EVENT_WATCHER_H_ diff --git a/base/waitable_event_watcher_posix.cc b/base/synchronization/waitable_event_watcher_posix.cc index 148caaa..048bbd0 100644 --- a/base/waitable_event_watcher_posix.cc +++ b/base/synchronization/waitable_event_watcher_posix.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/waitable_event_watcher.h" +#include "base/synchronization/waitable_event_watcher.h" #include "base/message_loop.h" #include "base/synchronization/lock.h" -#include "base/waitable_event.h" +#include "base/synchronization/waitable_event.h" namespace base { diff --git a/base/waitable_event_watcher_unittest.cc b/base/synchronization/waitable_event_watcher_unittest.cc index 6073861..1715dff 100644 --- a/base/waitable_event_watcher_unittest.cc +++ b/base/synchronization/waitable_event_watcher_unittest.cc @@ -1,15 +1,14 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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/synchronization/waitable_event.h" +#include "base/synchronization/waitable_event_watcher.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" -using base::WaitableEvent; -using base::WaitableEventWatcher; +namespace base { namespace { @@ -162,3 +161,5 @@ TEST(WaitableEventWatcherTest, MAYBE_DeleteUnder) { RunTest_DeleteUnder(MessageLoop::TYPE_IO); RunTest_DeleteUnder(MessageLoop::TYPE_UI); } + +} // namespace base diff --git a/base/waitable_event_watcher_win.cc b/base/synchronization/waitable_event_watcher_win.cc index d1fb5d2..9c02a4c 100644 --- a/base/waitable_event_watcher_win.cc +++ b/base/synchronization/waitable_event_watcher_win.cc @@ -1,11 +1,11 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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/waitable_event_watcher.h" +#include "base/synchronization/waitable_event_watcher.h" #include "base/compiler_specific.h" -#include "base/waitable_event.h" +#include "base/synchronization/waitable_event.h" #include "base/win/object_watcher.h" namespace base { diff --git a/base/waitable_event_win.cc b/base/synchronization/waitable_event_win.cc index 3d0eb14..0fcf488 100644 --- a/base/waitable_event_win.cc +++ b/base/synchronization/waitable_event_win.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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/waitable_event.h" +#include "base/synchronization/waitable_event.h" #include <math.h> #include <windows.h> diff --git a/base/threading/simple_thread.h b/base/threading/simple_thread.h index c401e01..b107e9c 100644 --- a/base/threading/simple_thread.h +++ b/base/threading/simple_thread.h @@ -48,7 +48,7 @@ #include "base/basictypes.h" #include "base/lock.h" #include "base/threading/platform_thread.h" -#include "base/waitable_event.h" +#include "base/synchronization/waitable_event.h" namespace base { diff --git a/base/threading/simple_thread_unittest.cc b/base/threading/simple_thread_unittest.cc index 56aed6b..4014d70 100644 --- a/base/threading/simple_thread_unittest.cc +++ b/base/threading/simple_thread_unittest.cc @@ -5,7 +5,7 @@ #include "base/atomic_sequence_num.h" #include "base/string_number_conversions.h" #include "base/threading/simple_thread.h" -#include "base/waitable_event.h" +#include "base/synchronization/waitable_event.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { diff --git a/base/threading/thread.cc b/base/threading/thread.cc index 5772d32..09f8847 100644 --- a/base/threading/thread.cc +++ b/base/threading/thread.cc @@ -7,7 +7,7 @@ #include "base/lazy_instance.h" #include "base/third_party/dynamic_annotations/dynamic_annotations.h" #include "base/threading/thread_local.h" -#include "base/waitable_event.h" +#include "base/synchronization/waitable_event.h" namespace base { diff --git a/base/threading/thread_local_unittest.cc b/base/threading/thread_local_unittest.cc index f6bdd78..ba12898 100644 --- a/base/threading/thread_local_unittest.cc +++ b/base/threading/thread_local_unittest.cc @@ -5,7 +5,7 @@ #include "base/logging.h" #include "base/threading/simple_thread.h" #include "base/threading/thread_local.h" -#include "base/waitable_event.h" +#include "base/synchronization/waitable_event.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { diff --git a/base/threading/worker_pool_posix_unittest.cc b/base/threading/worker_pool_posix_unittest.cc index 9be82c0..332c55e 100644 --- a/base/threading/worker_pool_posix_unittest.cc +++ b/base/threading/worker_pool_posix_unittest.cc @@ -10,7 +10,7 @@ #include "base/synchronization/condition_variable.h" #include "base/task.h" #include "base/threading/platform_thread.h" -#include "base/waitable_event.h" +#include "base/synchronization/waitable_event.h" #include "testing/gtest/include/gtest/gtest.h" namespace base { diff --git a/base/threading/worker_pool_unittest.cc b/base/threading/worker_pool_unittest.cc index cf8e0e8..f044e10 100644 --- a/base/threading/worker_pool_unittest.cc +++ b/base/threading/worker_pool_unittest.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "base/task.h" -#include "base/waitable_event.h" +#include "base/synchronization/waitable_event.h" #include "base/threading/worker_pool.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" |