Commit 44f9c950 authored by brettw@chromium.org's avatar brettw@chromium.org

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
parent f2bcc90a
......@@ -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',
......
......@@ -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',
......
......@@ -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 {
......
......@@ -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>
......
// 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"
......
// 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_
// 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
// 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_
......@@ -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"
......
// 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
// 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_
......@@ -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 {
......
// 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
// 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 {
......
// 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>
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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"
......
......@@ -14,7 +14,7 @@
#include "base/scoped_comptr_win.h"
#include "base/scoped_handle_win.h"
#include "base/scoped_native_library.h"
#include "base/waitable_event.h"
#include "base/synchronization/waitable_event.h"
#include "base/win/scoped_gdi_object.h"
#include "base/win/scoped_hdc.h"
#include "base/win/windows_version.h"
......
......@@ -23,7 +23,7 @@
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "base/waitable_event.h"
#include "base/synchronization/waitable_event.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/autofill/autofill_manager.h"
#include "chrome/browser/automation/automation_autocomplete_edit_tracker.h"
......
......@@ -15,7 +15,7 @@
#include "base/lock.h"
#include "base/observer_list.h"
#include "base/string16.h"
#include "base/waitable_event.h"
#include "base/synchronization/waitable_event.h"
#include "chrome/browser/bookmarks/bookmark_model_observer.h"
#include "chrome/browser/bookmarks/bookmark_service.h"
#include "chrome/browser/cancelable_request.h"
......
......@@ -14,7 +14,7 @@
#include "base/task.h"
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
#include "base/waitable_event.h"
#include "base/synchronization/waitable_event.h"
#include "chrome/browser/appcache/chrome_appcache_service.h"
#include "chrome/browser/automation/automation_provider_list.h"
#include "chrome/browser/browser_child_process_host.h"
......
// 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.
......@@ -13,7 +13,7 @@ CancelableRequestProvider::~CancelableRequestProvider() {
// deleted, or do other bad things. This can occur on shutdown (or profile
// destruction) when a request is scheduled, completed (but not dispatched),
// then the Profile is deleted.
AutoLock lock(pending_request_lock_);
base::AutoLock lock(pending_request_lock_);
while (!pending_requests_.empty())
CancelRequestLocked(pending_requests_.begin());
}
......@@ -23,7 +23,7 @@ CancelableRequestProvider::Handle CancelableRequestProvider::AddRequest(
CancelableRequestConsumerBase* consumer) {
Handle handle;
{
AutoLock lock(pending_request_lock_);
base::AutoLock lock(pending_request_lock_);
handle = next_handle_;
pending_requests_[next_handle_] = request;
......@@ -37,7 +37,7 @@ CancelableRequestProvider::Handle CancelableRequestProvider::AddRequest(
}
void CancelableRequestProvider::CancelRequest(Handle handle) {
AutoLock lock(pending_request_lock_);
base::AutoLock lock(pending_request_lock_);
CancelRequestLocked(pending_requests_.find(handle));
}
......@@ -57,7 +57,7 @@ void CancelableRequestProvider::CancelRequestLocked(
void CancelableRequestProvider::RequestCompleted(Handle handle) {
CancelableRequestConsumerBase* consumer = NULL;
{
AutoLock lock(pending_request_lock_);
base::AutoLock lock(pending_request_lock_);
CancelableRequestMap::iterator i = pending_requests_.find(handle);
if (i == pending_requests_.end()) {
......
......@@ -92,12 +92,12 @@
#include "base/basictypes.h"
#include "base/callback.h"
#include "base/cancellation_flag.h"
#include "base/lock.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "base/synchronization/cancellation_flag.h"
#include "base/task.h"
#include "build/build_config.h"
......@@ -148,7 +148,7 @@ class CancelableRequestProvider {
friend class CancelableRequestBase;
Lock pending_request_lock_;
base::Lock pending_request_lock_;
// Lists all outstanding requests. Protected by the |lock_|.
CancelableRequestMap pending_requests_;
......
......@@ -51,7 +51,7 @@
#if defined(OS_CHROMEOS)
#include "base/file_util.h"
#include "base/path_service.h"
#include "base/waitable_event.h"
#include "base/synchronization/waitable_event.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/cros/syslogs_library.h"
#include "chrome/browser/chromeos/login/user_manager.h"
......
......@@ -10,7 +10,7 @@
#include "base/ref_counted_memory.h"
#include "base/task.h"
#include "base/threading/thread.h"
#include "base/waitable_event.h"
#include "base/synchronization/waitable_event.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/url_constants.h"
......
......@@ -15,7 +15,7 @@
#include "base/scoped_temp_dir.h"
#include "base/string_util.h"
#include "base/stl_util-inl.h"
#include "base/waitable_event.h"
#include "base/synchronization/waitable_event.h"
#include "testing/gtest/include/gtest/gtest.h"
#if defined(OS_MACOSX)
......
......@@ -7,7 +7,7 @@
#pragma once
#include "base/ref_counted.h"
#include "base/waitable_event.h"
#include "base/synchronization/waitable_event.h"
#include "chrome/browser/utility_process_host.h"
class IndexedDBKey;
......
......@@ -4,7 +4,7 @@
#include "chrome/browser/net/chrome_net_log.h"
#include "base/waitable_event.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/simple_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
......
......@@ -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 "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
......
......@@ -13,7 +13,7 @@
#include "base/string_number_conversions.h"
#include "base/threading/thread.h"
#include "base/values.h"
#include "base/waitable_event.h"
#include "base/synchronization/waitable_event.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/io_thread.h"
......
......@@ -6,7 +6,7 @@
#include "base/message_loop.h"
#include "base/ref_counted.h"
#include "base/waitable_event.h"
#include "base/synchronization/waitable_event.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/notifications/notifications_prefs_cache.h"
#include "chrome/browser/prefs/pref_service.h"
......
......@@ -17,7 +17,7 @@
#include "base/string_util.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "base/waitable_event.h"
#include "base/synchronization/waitable_event.h"
#include "chrome/browser/browser_thread.h"
using webkit_glue::PasswordForm;
......
......@@ -8,7 +8,7 @@
#include "base/scoped_temp_dir.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "base/waitable_event.h"
#include "base/synchronization/waitable_event.h"
#include "chrome/browser/password_manager/password_store_change.h"
#include "chrome/browser/password_manager/password_store_default.h"
#include "chrome/browser/password_manager/password_form_data.h"
......
......@@ -12,7 +12,7 @@
#include "base/scoped_temp_dir.h"
#include "base/stl_util-inl.h"
#include "base/time.h"
#include "base/waitable_event.h"
#include "base/synchronization/waitable_event.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/password_manager/password_form_data.h"
#include "chrome/browser/password_manager/password_store_win.h"
......
......@@ -7,7 +7,7 @@
#include "base/stl_util-inl.h"
#include "base/string_util.h"
#include "base/time.h"
#include "base/waitable_event.h"
#include "base/synchronization/waitable_event.h"
#include "chrome/browser/password_manager/password_form_data.h"
#include "chrome/browser/password_manager/password_store_change.h"
#include "chrome/browser/password_manager/password_store_x.h"
......
......@@ -12,7 +12,7 @@
#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "base/waitable_event.h"
#include "base/synchronization/waitable_event.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/chrome_plugin_host.h"
......
......@@ -15,7 +15,7 @@
#include "base/file_path.h"
#include "base/hash_tables.h"