summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-07 23:21:55 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-07 23:21:55 +0000
commit15d96941d9694b696f14ce4beaada3907828edc5 (patch)
tree5c5c8d3eb5cee2388fdd2f26de859e84ddfb6657 /base
parentff81c190a987065d3d3f394af4c1a591417cb5ab (diff)
downloadchromium_src-15d96941d9694b696f14ce4beaada3907828edc5.zip
chromium_src-15d96941d9694b696f14ce4beaada3907828edc5.tar.gz
chromium_src-15d96941d9694b696f14ce4beaada3907828edc5.tar.bz2
Revert "Remove base/scoped_handle_win.h stub and fix up all callers to use the new location and namespace."
This reverts r 70795, it broke the build. TBR=vandebo git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70802 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/file_util_unittest.cc13
-rw-r--r--base/message_loop_unittest.cc30
-rw-r--r--base/message_pump_win.h6
-rw-r--r--base/scoped_handle.h6
-rw-r--r--base/scoped_handle_win.h9
-rw-r--r--base/test/test_file_util_win.cc6
-rw-r--r--base/win/event_trace_consumer_unittest.cc16
-rw-r--r--base/win/event_trace_controller_unittest.cc14
-rw-r--r--base/win/win_util.cc6
9 files changed, 55 insertions, 51 deletions
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc
index 6ea94e4..bbd888a 100644
--- a/base/file_util_unittest.cc
+++ b/base/file_util_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -19,6 +19,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/path_service.h"
+#include "base/scoped_handle.h"
#include "base/scoped_temp_dir.h"
#include "base/threading/platform_thread.h"
#include "base/time.h"
@@ -26,10 +27,6 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
-#if defined(OS_WIN)
-#include "base/win/scoped_handle.h"
-#endif
-
// This macro helps avoid wrapped lines in the test structs.
#define FPL(x) FILE_PATH_LITERAL(x)
@@ -474,7 +471,7 @@ TEST_F(FileUtilTest, NormalizeFilePathReparsePoints) {
FilePath to_sub_a = base_b.Append(FPL("to_sub_a"));
ASSERT_TRUE(file_util::CreateDirectory(to_sub_a));
- base::win::ScopedHandle reparse_to_sub_a(
+ ScopedHandle reparse_to_sub_a(
::CreateFile(to_sub_a.value().c_str(),
FILE_ALL_ACCESS,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
@@ -487,7 +484,7 @@ TEST_F(FileUtilTest, NormalizeFilePathReparsePoints) {
FilePath to_base_b = base_b.Append(FPL("to_base_b"));
ASSERT_TRUE(file_util::CreateDirectory(to_base_b));
- base::win::ScopedHandle reparse_to_base_b(
+ ScopedHandle reparse_to_base_b(
::CreateFile(to_base_b.value().c_str(),
FILE_ALL_ACCESS,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
@@ -500,7 +497,7 @@ TEST_F(FileUtilTest, NormalizeFilePathReparsePoints) {
FilePath to_sub_long = base_b.Append(FPL("to_sub_long"));
ASSERT_TRUE(file_util::CreateDirectory(to_sub_long));
- base::win::ScopedHandle reparse_to_sub_long(
+ ScopedHandle reparse_to_sub_long(
::CreateFile(to_sub_long.value().c_str(),
FILE_ALL_ACCESS,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
diff --git a/base/message_loop_unittest.cc b/base/message_loop_unittest.cc
index c471e38..e926c57 100644
--- a/base/message_loop_unittest.cc
+++ b/base/message_loop_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -15,7 +15,7 @@
#if defined(OS_WIN)
#include "base/message_pump_win.h"
-#include "base/win/scoped_handle.h"
+#include "base/scoped_handle.h"
#endif
#if defined(OS_POSIX)
#include "base/message_pump_libevent.h"
@@ -937,7 +937,7 @@ void RunTest_RecursiveDenial2(MessageLoop::Type message_loop_type) {
options.message_loop_type = message_loop_type;
ASSERT_EQ(true, worker.StartWithOptions(options));
TaskList order;
- base::win::ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL));
+ ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL));
worker.message_loop()->PostTask(FROM_HERE,
new Recursive2Tasks(MessageLoop::current(),
event,
@@ -980,7 +980,7 @@ void RunTest_RecursiveSupport2(MessageLoop::Type message_loop_type) {
options.message_loop_type = message_loop_type;
ASSERT_EQ(true, worker.StartWithOptions(options));
TaskList order;
- base::win::ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL));
+ ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL));
worker.message_loop()->PostTask(FROM_HERE,
new Recursive2Tasks(MessageLoop::current(),
event,
@@ -1187,7 +1187,7 @@ class TestIOHandler : public MessageLoopForIO::IOHandler {
char buffer_[48];
MessageLoopForIO::IOContext context_;
HANDLE signal_;
- base::win::ScopedHandle file_;
+ ScopedHandle file_;
bool wait_;
};
@@ -1235,12 +1235,12 @@ class IOHandlerTask : public Task {
};
void RunTest_IOHandler() {
- base::win::ScopedHandle callback_called(CreateEvent(NULL, TRUE, FALSE, NULL));
+ ScopedHandle callback_called(CreateEvent(NULL, TRUE, FALSE, NULL));
ASSERT_TRUE(callback_called.IsValid());
const wchar_t* kPipeName = L"\\\\.\\pipe\\iohandler_pipe";
- base::win::ScopedHandle server(
- CreateNamedPipe(kPipeName, PIPE_ACCESS_OUTBOUND, 0, 1, 0, 0, 0, NULL));
+ ScopedHandle server(CreateNamedPipe(kPipeName, PIPE_ACCESS_OUTBOUND, 0, 1,
+ 0, 0, 0, NULL));
ASSERT_TRUE(server.IsValid());
Thread thread("IOHandler test");
@@ -1267,19 +1267,17 @@ void RunTest_IOHandler() {
}
void RunTest_WaitForIO() {
- base::win::ScopedHandle callback1_called(
- CreateEvent(NULL, TRUE, FALSE, NULL));
- base::win::ScopedHandle callback2_called(
- CreateEvent(NULL, TRUE, FALSE, NULL));
+ ScopedHandle callback1_called(CreateEvent(NULL, TRUE, FALSE, NULL));
+ ScopedHandle callback2_called(CreateEvent(NULL, TRUE, FALSE, NULL));
ASSERT_TRUE(callback1_called.IsValid());
ASSERT_TRUE(callback2_called.IsValid());
const wchar_t* kPipeName1 = L"\\\\.\\pipe\\iohandler_pipe1";
const wchar_t* kPipeName2 = L"\\\\.\\pipe\\iohandler_pipe2";
- base::win::ScopedHandle server1(
- CreateNamedPipe(kPipeName1, PIPE_ACCESS_OUTBOUND, 0, 1, 0, 0, 0, NULL));
- base::win::ScopedHandle server2(
- CreateNamedPipe(kPipeName2, PIPE_ACCESS_OUTBOUND, 0, 1, 0, 0, 0, NULL));
+ ScopedHandle server1(CreateNamedPipe(kPipeName1, PIPE_ACCESS_OUTBOUND, 0, 1,
+ 0, 0, 0, NULL));
+ ScopedHandle server2(CreateNamedPipe(kPipeName2, PIPE_ACCESS_OUTBOUND, 0, 1,
+ 0, 0, 0, NULL));
ASSERT_TRUE(server1.IsValid());
ASSERT_TRUE(server2.IsValid());
diff --git a/base/message_pump_win.h b/base/message_pump_win.h
index af97530..ea7dd39 100644
--- a/base/message_pump_win.h
+++ b/base/message_pump_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-2008 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,8 +13,8 @@
#include "base/basictypes.h"
#include "base/message_pump.h"
#include "base/observer_list.h"
+#include "base/scoped_handle.h"
#include "base/time.h"
-#include "base/win/scoped_handle.h"
namespace base {
@@ -356,7 +356,7 @@ class MessagePumpForIO : public MessagePumpWin {
void DidProcessIOEvent();
// The completion port associated with this thread.
- win::ScopedHandle port_;
+ ScopedHandle port_;
// This list will be empty almost always. It stores IO completions that have
// not been delivered yet because somebody was doing cleanup.
std::list<IOItem> completed_io_;
diff --git a/base/scoped_handle.h b/base/scoped_handle.h
index 90cb5d5..43ee975 100644
--- a/base/scoped_handle.h
+++ b/base/scoped_handle.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -10,6 +10,10 @@
#include "base/basictypes.h"
+#if defined(OS_WIN)
+#include "base/scoped_handle_win.h"
+#endif
+
class ScopedStdioHandle {
public:
ScopedStdioHandle()
diff --git a/base/scoped_handle_win.h b/base/scoped_handle_win.h
new file mode 100644
index 0000000..a7c4b2e
--- /dev/null
+++ b/base/scoped_handle_win.h
@@ -0,0 +1,9 @@
+// Copyright (c) 2010 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.
+
+// TODO(brettw) remove this file when all callers are converted to using the
+// new location/namespace
+#include "base/win/scoped_handle.h"
+
+using base::win::ScopedHandle;
diff --git a/base/test/test_file_util_win.cc b/base/test/test_file_util_win.cc
index 7ca7e84..0917570 100644
--- a/base/test/test_file_util_win.cc
+++ b/base/test/test_file_util_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2008 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.
@@ -12,7 +12,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/win/scoped_handle.h"
+#include "base/scoped_handle.h"
#include "base/threading/platform_thread.h"
namespace file_util {
@@ -39,7 +39,7 @@ bool DieFileDie(const FilePath& file, bool recurse) {
bool EvictFileFromSystemCache(const FilePath& file) {
// Request exclusive access to the file and overwrite it with no buffering.
- base::win::ScopedHandle file_handle(
+ ScopedHandle file_handle(
CreateFile(file.value().c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL));
if (!file_handle)
diff --git a/base/win/event_trace_consumer_unittest.cc b/base/win/event_trace_consumer_unittest.cc
index efbfdf9..f11f459 100644
--- a/base/win/event_trace_consumer_unittest.cc
+++ b/base/win/event_trace_consumer_unittest.cc
@@ -4,16 +4,14 @@
//
// Unit tests for event trace consumer_ base class.
#include "base/win/event_trace_consumer.h"
-
#include <list>
-
#include "base/basictypes.h"
+#include "base/win/event_trace_controller.h"
+#include "base/win/event_trace_provider.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/win/event_trace_controller.h"
-#include "base/win/event_trace_provider.h"
-#include "base/win/scoped_handle.h"
+#include "base/scoped_handle.h"
#include "testing/gtest/include/gtest/gtest.h"
#include <initguid.h> // NOLINT - has to be last
@@ -65,14 +63,14 @@ class TestConsumer: public EtwTraceConsumerBase<TestConsumer> {
::SetEvent(sank_event_.Get());
}
- static base::win::ScopedHandle sank_event_;
+ static ScopedHandle sank_event_;
static EventQueue events_;
private:
DISALLOW_COPY_AND_ASSIGN(TestConsumer);
};
-base::win::ScopedHandle TestConsumer::sank_event_;
+ScopedHandle TestConsumer::sank_event_;
EventQueue TestConsumer::events_;
const wchar_t* const kTestSessionName = L"TestLogSession";
@@ -177,8 +175,8 @@ class EtwTraceConsumerRealtimeTest: public testing::Test {
}
TestConsumer consumer_;
- base::win::ScopedHandle consumer_ready_;
- base::win::ScopedHandle consumer_thread_;
+ ScopedHandle consumer_ready_;
+ ScopedHandle consumer_thread_;
};
} // namespace
diff --git a/base/win/event_trace_controller_unittest.cc b/base/win/event_trace_controller_unittest.cc
index 8eab40a..2b3cd66 100644
--- a/base/win/event_trace_controller_unittest.cc
+++ b/base/win/event_trace_controller_unittest.cc
@@ -1,19 +1,17 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
//
// Unit tests for event trace controller.
-
-#include <initguid.h> // NOLINT.
-
+#include "base/win/event_trace_controller.h"
+#include "base/win/event_trace_provider.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
+#include "base/scoped_handle.h"
#include "base/sys_info.h"
-#include "base/win/event_trace_controller.h"
-#include "base/win/event_trace_provider.h"
-#include "base/win/scoped_handle.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include <initguid.h> // NOLINT - must be last.
namespace {
@@ -52,7 +50,7 @@ class TestingProvider: public EtwTraceProvider {
::SetEvent(callback_event_.Get());
}
- base::win::ScopedHandle callback_event_;
+ ScopedHandle callback_event_;
DISALLOW_COPY_AND_ASSIGN(TestingProvider);
};
diff --git a/base/win/win_util.cc b/base/win/win_util.cc
index 87905ea..afd16f4 100644
--- a/base/win/win_util.cc
+++ b/base/win/win_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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,11 +13,11 @@
#include "base/logging.h"
#include "base/win/registry.h"
+#include "base/scoped_handle.h"
#include "base/scoped_ptr.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/threading/thread_restrictions.h"
-#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
namespace base {
@@ -47,7 +47,7 @@ bool GetUserSidString(std::wstring* user_sid) {
HANDLE token = NULL;
if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token))
return false;
- base::win::ScopedHandle token_scoped(token);
+ ScopedHandle token_scoped(token);
DWORD size = sizeof(TOKEN_USER) + SECURITY_MAX_SID_SIZE;
scoped_array<BYTE> user_bytes(new BYTE[size]);