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

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 {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment