summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-09 16:32:20 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-09 16:32:20 +0000
commitb90d7e80c20c7c20831bedfe3fa6028ddab1ae95 (patch)
tree308e927055c27a533019d329a9677ce8e7c53e33 /base
parentd716d4178136a223e9e79b3508c755a71108a068 (diff)
downloadchromium_src-b90d7e80c20c7c20831bedfe3fa6028ddab1ae95.zip
chromium_src-b90d7e80c20c7c20831bedfe3fa6028ddab1ae95.tar.gz
chromium_src-b90d7e80c20c7c20831bedfe3fa6028ddab1ae95.tar.bz2
Reland "Remove base/scoped_handle_win.h."
Fixed the problem with rlz library. Now should be fine to land this again. This reverts commit 3620d9501af7bff688862c54fdd60f7eb41797f3. Original Review URL: http://codereview.chromium.org/6126002/ BUG=None TEST=trybots Review URL: http://codereview.chromium.org/6110005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70861 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, 51 insertions, 55 deletions
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc
index bbd888a..6ea94e4 100644
--- a/base/file_util_unittest.cc
+++ b/base/file_util_unittest.cc
@@ -1,4 +1,4 @@
-// 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.
@@ -19,7 +19,6 @@
#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"
@@ -27,6 +26,10 @@
#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)
@@ -471,7 +474,7 @@ TEST_F(FileUtilTest, NormalizeFilePathReparsePoints) {
FilePath to_sub_a = base_b.Append(FPL("to_sub_a"));
ASSERT_TRUE(file_util::CreateDirectory(to_sub_a));
- ScopedHandle reparse_to_sub_a(
+ base::win::ScopedHandle reparse_to_sub_a(
::CreateFile(to_sub_a.value().c_str(),
FILE_ALL_ACCESS,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
@@ -484,7 +487,7 @@ TEST_F(FileUtilTest, NormalizeFilePathReparsePoints) {
FilePath to_base_b = base_b.Append(FPL("to_base_b"));
ASSERT_TRUE(file_util::CreateDirectory(to_base_b));
- ScopedHandle reparse_to_base_b(
+ base::win::ScopedHandle reparse_to_base_b(
::CreateFile(to_base_b.value().c_str(),
FILE_ALL_ACCESS,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
@@ -497,7 +500,7 @@ TEST_F(FileUtilTest, NormalizeFilePathReparsePoints) {
FilePath to_sub_long = base_b.Append(FPL("to_sub_long"));
ASSERT_TRUE(file_util::CreateDirectory(to_sub_long));
- ScopedHandle reparse_to_sub_long(
+ base::win::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 e926c57..c471e38 100644
--- a/base/message_loop_unittest.cc
+++ b/base/message_loop_unittest.cc
@@ -1,4 +1,4 @@
-// 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.
@@ -15,7 +15,7 @@
#if defined(OS_WIN)
#include "base/message_pump_win.h"
-#include "base/scoped_handle.h"
+#include "base/win/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;
- ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL));
+ base::win::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;
- ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL));
+ base::win::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_;
- ScopedHandle file_;
+ base::win::ScopedHandle file_;
bool wait_;
};
@@ -1235,12 +1235,12 @@ class IOHandlerTask : public Task {
};
void RunTest_IOHandler() {
- ScopedHandle callback_called(CreateEvent(NULL, TRUE, FALSE, NULL));
+ base::win::ScopedHandle callback_called(CreateEvent(NULL, TRUE, FALSE, NULL));
ASSERT_TRUE(callback_called.IsValid());
const wchar_t* kPipeName = L"\\\\.\\pipe\\iohandler_pipe";
- ScopedHandle server(CreateNamedPipe(kPipeName, PIPE_ACCESS_OUTBOUND, 0, 1,
- 0, 0, 0, NULL));
+ base::win::ScopedHandle server(
+ CreateNamedPipe(kPipeName, PIPE_ACCESS_OUTBOUND, 0, 1, 0, 0, 0, NULL));
ASSERT_TRUE(server.IsValid());
Thread thread("IOHandler test");
@@ -1267,17 +1267,19 @@ void RunTest_IOHandler() {
}
void RunTest_WaitForIO() {
- ScopedHandle callback1_called(CreateEvent(NULL, TRUE, FALSE, NULL));
- ScopedHandle callback2_called(CreateEvent(NULL, TRUE, FALSE, NULL));
+ base::win::ScopedHandle callback1_called(
+ CreateEvent(NULL, TRUE, FALSE, NULL));
+ base::win::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";
- 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));
+ 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));
ASSERT_TRUE(server1.IsValid());
ASSERT_TRUE(server2.IsValid());
diff --git a/base/message_pump_win.h b/base/message_pump_win.h
index ea7dd39..af97530 100644
--- a/base/message_pump_win.h
+++ b/base/message_pump_win.h
@@ -1,4 +1,4 @@
-// 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,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.
- ScopedHandle port_;
+ win::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 43ee975..90cb5d5 100644
--- a/base/scoped_handle.h
+++ b/base/scoped_handle.h
@@ -1,4 +1,4 @@
-// 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.
@@ -10,10 +10,6 @@
#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
deleted file mode 100644
index a7c4b2e..0000000
--- a/base/scoped_handle_win.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// 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 0917570..7ca7e84 100644
--- a/base/test/test_file_util_win.cc
+++ b/base/test/test_file_util_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 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.
@@ -12,7 +12,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/scoped_handle.h"
+#include "base/win/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.
- ScopedHandle file_handle(
+ base::win::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 f11f459..efbfdf9 100644
--- a/base/win/event_trace_consumer_unittest.cc
+++ b/base/win/event_trace_consumer_unittest.cc
@@ -4,14 +4,16 @@
//
// 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/scoped_handle.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 - has to be last
@@ -63,14 +65,14 @@ class TestConsumer: public EtwTraceConsumerBase<TestConsumer> {
::SetEvent(sank_event_.Get());
}
- static ScopedHandle sank_event_;
+ static base::win::ScopedHandle sank_event_;
static EventQueue events_;
private:
DISALLOW_COPY_AND_ASSIGN(TestConsumer);
};
-ScopedHandle TestConsumer::sank_event_;
+base::win::ScopedHandle TestConsumer::sank_event_;
EventQueue TestConsumer::events_;
const wchar_t* const kTestSessionName = L"TestLogSession";
@@ -175,8 +177,8 @@ class EtwTraceConsumerRealtimeTest: public testing::Test {
}
TestConsumer consumer_;
- ScopedHandle consumer_ready_;
- ScopedHandle consumer_thread_;
+ base::win::ScopedHandle consumer_ready_;
+ base::win::ScopedHandle consumer_thread_;
};
} // namespace
diff --git a/base/win/event_trace_controller_unittest.cc b/base/win/event_trace_controller_unittest.cc
index 2b3cd66..8eab40a 100644
--- a/base/win/event_trace_controller_unittest.cc
+++ b/base/win/event_trace_controller_unittest.cc
@@ -1,17 +1,19 @@
-// 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.
//
// Unit tests for event trace controller.
-#include "base/win/event_trace_controller.h"
-#include "base/win/event_trace_provider.h"
+
+#include <initguid.h> // NOLINT.
+
#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 {
@@ -50,7 +52,7 @@ class TestingProvider: public EtwTraceProvider {
::SetEvent(callback_event_.Get());
}
- ScopedHandle callback_event_;
+ base::win::ScopedHandle callback_event_;
DISALLOW_COPY_AND_ASSIGN(TestingProvider);
};
diff --git a/base/win/win_util.cc b/base/win/win_util.cc
index afd16f4..87905ea 100644
--- a/base/win/win_util.cc
+++ b/base/win/win_util.cc
@@ -1,4 +1,4 @@
-// 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.
@@ -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;
- ScopedHandle token_scoped(token);
+ base::win::ScopedHandle token_scoped(token);
DWORD size = sizeof(TOKEN_USER) + SECURITY_MAX_SID_SIZE;
scoped_array<BYTE> user_bytes(new BYTE[size]);