diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-01 18:26:16 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-01 18:26:16 +0000 |
commit | a8d1ebbe43f3de3c5aa44ebc1579f5352339f5eb (patch) | |
tree | 2ed96a278f2d3082db68f361992d054a08cc915d /base | |
parent | 0378bf4edc40686bac06c8e14bd25fdb3f9cfb28 (diff) | |
download | chromium_src-a8d1ebbe43f3de3c5aa44ebc1579f5352339f5eb.zip chromium_src-a8d1ebbe43f3de3c5aa44ebc1579f5352339f5eb.tar.gz chromium_src-a8d1ebbe43f3de3c5aa44ebc1579f5352339f5eb.tar.bz2 |
move base/object_watcher into base/win and add the win namespace. Fixup callers.
TEST=it compiles
BUG=none
Review URL: http://codereview.chromium.org/5971008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70360 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/base.gyp | 3 | ||||
-rw-r--r-- | base/base.gypi | 5 | ||||
-rw-r--r-- | base/waitable_event_watcher.h | 6 | ||||
-rw-r--r-- | base/waitable_event_watcher_win.cc | 2 | ||||
-rw-r--r-- | base/win/object_watcher.cc (renamed from base/object_watcher.cc) | 6 | ||||
-rw-r--r-- | base/win/object_watcher.h (renamed from base/object_watcher.h) | 8 | ||||
-rw-r--r-- | base/win/object_watcher_unittest.cc (renamed from base/object_watcher_unittest.cc) | 26 |
7 files changed, 32 insertions, 24 deletions
diff --git a/base/base.gyp b/base/base.gyp index 6e62c84..a86bca0 100644 --- a/base/base.gyp +++ b/base/base.gyp @@ -106,7 +106,6 @@ 'metrics/field_trial_unittest.cc', 'metrics/histogram_unittest.cc', 'metrics/stats_table_unittest.cc', - 'object_watcher_unittest.cc', 'observer_list_unittest.cc', 'path_service_unittest.cc', 'pickle_unittest.cc', @@ -167,6 +166,7 @@ 'win/event_trace_controller_unittest.cc', 'win/event_trace_provider_unittest.cc', 'win/i18n_unittest.cc', + 'win/object_watcher_unittest.cc', 'win/pe_image_unittest.cc', 'win/registry_unittest.cc', 'win/scoped_bstr_unittest.cc', @@ -224,7 +224,6 @@ ['exclude', '^win/'], ], 'sources!': [ - 'object_watcher_unittest.cc', 'system_monitor_unittest.cc', 'time_win_unittest.cc', 'trace_event_win_unittest.cc', diff --git a/base/base.gypi b/base/base.gypi index ee794fd..ce533cb 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -150,8 +150,6 @@ 'native_library_linux.cc', 'native_library_mac.mm', 'native_library_win.cc', - 'object_watcher.cc', - 'object_watcher.h', 'observer_list.h', 'observer_list_threadsafe.h', 'path_service.cc', @@ -297,6 +295,8 @@ 'weak_ptr.h', 'win/i18n.cc', 'win/i18n.h', + 'win/object_watcher.cc', + 'win/object_watcher.h', 'win/pe_image.cc', 'win/event_trace_consumer.h', 'win/event_trace_controller.cc', @@ -513,7 +513,6 @@ 'debug_on_start.cc', 'event_recorder.cc', 'file_version_info.cc', - 'object_watcher.cc', 'pe_image.cc', 'registry.cc', 'resource_util.cc', diff --git a/base/waitable_event_watcher.h b/base/waitable_event_watcher.h index 04aa8cf..c54419e 100644 --- a/base/waitable_event_watcher.h +++ b/base/waitable_event_watcher.h @@ -9,7 +9,7 @@ #include "build/build_config.h" #if defined(OS_WIN) -#include "base/object_watcher.h" +#include "base/win/object_watcher.h" #else #include "base/message_loop.h" #include "base/waitable_event.h" @@ -124,7 +124,7 @@ class WaitableEventWatcher // called Delegate (at least on Windows). Thus this object exists to proxy // the callback function // --------------------------------------------------------------------------- - class ObjectWatcherHelper : public ObjectWatcher::Delegate { + class ObjectWatcherHelper : public win::ObjectWatcher::Delegate { public: ObjectWatcherHelper(WaitableEventWatcher* watcher); @@ -140,7 +140,7 @@ class WaitableEventWatcher void OnObjectSignaled(); ObjectWatcherHelper helper_; - ObjectWatcher watcher_; + win::ObjectWatcher watcher_; #else // --------------------------------------------------------------------------- // Implementation of MessageLoop::DestructionObserver diff --git a/base/waitable_event_watcher_win.cc b/base/waitable_event_watcher_win.cc index 7619aa4..d1fb5d2 100644 --- a/base/waitable_event_watcher_win.cc +++ b/base/waitable_event_watcher_win.cc @@ -5,8 +5,8 @@ #include "base/waitable_event_watcher.h" #include "base/compiler_specific.h" -#include "base/object_watcher.h" #include "base/waitable_event.h" +#include "base/win/object_watcher.h" namespace base { diff --git a/base/object_watcher.cc b/base/win/object_watcher.cc index a15234b..4f5e7ab 100644 --- a/base/object_watcher.cc +++ b/base/win/object_watcher.cc @@ -1,12 +1,13 @@ -// 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/object_watcher.h" +#include "base/win/object_watcher.h" #include "base/logging.h" namespace base { +namespace win { //----------------------------------------------------------------------------- @@ -135,4 +136,5 @@ void ObjectWatcher::WillDestroyCurrentMessageLoop() { StopWatching(); } +} // namespace win } // namespace base diff --git a/base/object_watcher.h b/base/win/object_watcher.h index e05ceac..16534c2 100644 --- a/base/object_watcher.h +++ b/base/win/object_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_OBJECT_WATCHER_H_ -#define BASE_OBJECT_WATCHER_H_ +#ifndef BASE_WIN_OBJECT_WATCHER_H_ +#define BASE_WIN_OBJECT_WATCHER_H_ #pragma once #include <windows.h> @@ -11,6 +11,7 @@ #include "base/message_loop.h" namespace base { +namespace win { // A class that provides a means to asynchronously wait for a Windows object to // become signaled. It is an abstraction around RegisterWaitForSingleObject @@ -87,6 +88,7 @@ class ObjectWatcher : public MessageLoop::DestructionObserver { DISALLOW_COPY_AND_ASSIGN(ObjectWatcher); }; +} // namespace win } // namespace base #endif // BASE_OBJECT_WATCHER_H_ diff --git a/base/object_watcher_unittest.cc b/base/win/object_watcher_unittest.cc index 3605dbb..fe151d9 100644 --- a/base/object_watcher_unittest.cc +++ b/base/win/object_watcher_unittest.cc @@ -1,23 +1,26 @@ -// 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 <process.h> #include "base/message_loop.h" -#include "base/object_watcher.h" +#include "base/win/object_watcher.h" #include "testing/gtest/include/gtest/gtest.h" +namespace base { +namespace win { + namespace { -class QuitDelegate : public base::ObjectWatcher::Delegate { +class QuitDelegate : public ObjectWatcher::Delegate { public: virtual void OnObjectSignaled(HANDLE object) { MessageLoop::current()->Quit(); } }; -class DecrementCountDelegate : public base::ObjectWatcher::Delegate { +class DecrementCountDelegate : public ObjectWatcher::Delegate { public: explicit DecrementCountDelegate(int* counter) : counter_(counter) { } @@ -28,12 +31,10 @@ class DecrementCountDelegate : public base::ObjectWatcher::Delegate { int* counter_; }; -} // namespace - void RunTest_BasicSignal(MessageLoop::Type message_loop_type) { MessageLoop message_loop(message_loop_type); - base::ObjectWatcher watcher; + ObjectWatcher watcher; EXPECT_EQ(NULL, watcher.GetWatchedObject()); // A manual-reset event that is not yet signaled. @@ -55,7 +56,7 @@ void RunTest_BasicSignal(MessageLoop::Type message_loop_type) { void RunTest_BasicCancel(MessageLoop::Type message_loop_type) { MessageLoop message_loop(message_loop_type); - base::ObjectWatcher watcher; + ObjectWatcher watcher; // A manual-reset event that is not yet signaled. HANDLE event = CreateEvent(NULL, TRUE, FALSE, NULL); @@ -73,7 +74,7 @@ void RunTest_BasicCancel(MessageLoop::Type message_loop_type) { void RunTest_CancelAfterSet(MessageLoop::Type message_loop_type) { MessageLoop message_loop(message_loop_type); - base::ObjectWatcher watcher; + ObjectWatcher watcher; int counter = 1; DecrementCountDelegate delegate(&counter); @@ -105,7 +106,7 @@ void RunTest_OutlivesMessageLoop(MessageLoop::Type message_loop_type) { // people use the Singleton pattern or atexit. HANDLE event = CreateEvent(NULL, TRUE, FALSE, NULL); // not signaled { - base::ObjectWatcher watcher; + ObjectWatcher watcher; { MessageLoop message_loop(message_loop_type); @@ -116,6 +117,8 @@ void RunTest_OutlivesMessageLoop(MessageLoop::Type message_loop_type) { CloseHandle(event); } +} // namespace + //----------------------------------------------------------------------------- TEST(ObjectWatcherTest, BasicSignal) { @@ -141,3 +144,6 @@ TEST(ObjectWatcherTest, OutlivesMessageLoop) { RunTest_OutlivesMessageLoop(MessageLoop::TYPE_IO); RunTest_OutlivesMessageLoop(MessageLoop::TYPE_UI); } + +} // namespace win +} // namespace base |