Skip to content

Commit

Permalink
Move CancellationFlag and WaitableEvent to the synchronization subdir…
Browse files Browse the repository at this point in the history
…ectory.

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
  • Loading branch information
brettw@chromium.org committed Jan 2, 2011
1 parent f2bcc90 commit 44f9c95
Show file tree
Hide file tree
Showing 114 changed files with 163 additions and 166 deletions.
6 changes: 3 additions & 3 deletions base/base.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
16 changes: 8 additions & 8 deletions base/base.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion base/message_pump_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

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

Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -40,4 +40,4 @@ class CancellationFlag {

} // namespace base

#endif // BASE_CANCELLATION_FLAG_H_
#endif // BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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 {

Expand Down Expand Up @@ -65,3 +63,5 @@ TEST(CancellationFlagTest, SetOnDifferentThreadDeathTest) {
}

} // namespace

} // namespace base
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -176,4 +176,4 @@ class WaitableEvent {

} // namespace base

#endif // BASE_WAITABLE_EVENT_H_
#endif // BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down Expand Up @@ -74,15 +69,15 @@ 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),
ev_(ev) {
}

void ThreadMain() {
base::PlatformThread::Sleep(static_cast<int>(seconds_ * 1000));
PlatformThread::Sleep(static_cast<int>(seconds_ * 1000));
ev_->Signal();
}

Expand All @@ -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
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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 {
Expand Down Expand Up @@ -159,4 +159,4 @@ class WaitableEventWatcher

} // namespace base

#endif // BASE_WAITABLE_EVENT_WATCHER_H_
#endif // BASE_SYNCHRONIZATION_WAITABLE_EVENT_WATCHER_H_
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down Expand Up @@ -162,3 +161,5 @@ TEST(WaitableEventWatcherTest, MAYBE_DeleteUnder) {
RunTest_DeleteUnder(MessageLoop::TYPE_IO);
RunTest_DeleteUnder(MessageLoop::TYPE_UI);
}

} // namespace base
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
2 changes: 1 addition & 1 deletion base/threading/simple_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

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

Expand Down
2 changes: 1 addition & 1 deletion base/threading/thread_local_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion base/threading/worker_pool_posix_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion base/threading/worker_pool_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/aeropeek_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading

0 comments on commit 44f9c95

Please sign in to comment.