summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/extensions/api/messaging/native_process_launcher_win.cc7
-rw-r--r--chrome/browser/first_run/upgrade_util_win.cc3
-rw-r--r--chrome/installer/setup/setup_util.cc4
-rw-r--r--chrome/installer/setup/setup_util_unittest.cc6
-rw-r--r--chrome/installer/test/alternate_version_generator.cc5
-rw-r--r--chrome/installer/util/google_update_util.cc6
-rw-r--r--chrome/test/ui/ui_test_suite.cc4
7 files changed, 19 insertions, 16 deletions
diff --git a/chrome/browser/extensions/api/messaging/native_process_launcher_win.cc b/chrome/browser/extensions/api/messaging/native_process_launcher_win.cc
index fd7345c..31fbdc8 100644
--- a/chrome/browser/extensions/api/messaging/native_process_launcher_win.cc
+++ b/chrome/browser/extensions/api/messaging/native_process_launcher_win.cc
@@ -136,7 +136,7 @@ bool NativeProcessLauncher::LaunchNativeProcess(
base::LaunchOptions options;
options.start_hidden = true;
- base::ProcessHandle cmd_handle;
+ base::win::ScopedHandle cmd_handle;
if (!base::LaunchProcess(command.c_str(), options, &cmd_handle)) {
LOG(ERROR) << "Error launching process "
<< command_line.GetProgram().MaybeAsASCII();
@@ -148,14 +148,13 @@ bool NativeProcessLauncher::LaunchNativeProcess(
bool stdin_connected = ConnectNamedPipe(stdin_pipe.Get(), NULL) ?
TRUE : GetLastError() == ERROR_PIPE_CONNECTED;
if (!stdout_connected || !stdin_connected) {
- base::KillProcess(cmd_handle, 0, false);
- base::CloseProcessHandle(cmd_handle);
+ base::KillProcess(cmd_handle.Get(), 0, false);
LOG(ERROR) << "Failed to connect IO pipes when starting "
<< command_line.GetProgram().MaybeAsASCII();
return false;
}
- *process_handle = cmd_handle;
+ *process_handle = cmd_handle.Take();
*read_file = stdout_pipe.Take();
*write_file = stdin_pipe.Take();
diff --git a/chrome/browser/first_run/upgrade_util_win.cc b/chrome/browser/first_run/upgrade_util_win.cc
index 729bfcb..244773f 100644
--- a/chrome/browser/first_run/upgrade_util_win.cc
+++ b/chrome/browser/first_run/upgrade_util_win.cc
@@ -252,14 +252,13 @@ bool SwapNewChromeExeIfPresent() {
std::wstring rename_cmd;
if (key.ReadValue(google_update::kRegRenameCmdField,
&rename_cmd) == ERROR_SUCCESS) {
- base::ProcessHandle handle;
+ base::win::ScopedHandle handle;
base::LaunchOptions options;
options.wait = true;
options.start_hidden = true;
if (base::LaunchProcess(rename_cmd, options, &handle)) {
DWORD exit_code;
::GetExitCodeProcess(handle, &exit_code);
- ::CloseHandle(handle);
if (exit_code == installer::RENAME_SUCCESSFUL)
return true;
}
diff --git a/chrome/installer/setup/setup_util.cc b/chrome/installer/setup/setup_util.cc
index 611c53c..da46e4f 100644
--- a/chrome/installer/setup/setup_util.cc
+++ b/chrome/installer/setup/setup_util.cc
@@ -452,11 +452,13 @@ bool IsUninstallSuccess(InstallStatus install_status) {
ScopedTokenPrivilege::ScopedTokenPrivilege(const wchar_t* privilege_name)
: is_enabled_(false) {
+ HANDLE temp_handle;
if (!::OpenProcessToken(::GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
- token_.Receive())) {
+ &temp_handle)) {
return;
}
+ token_.Set(temp_handle);
LUID privilege_luid;
if (!::LookupPrivilegeValue(NULL, privilege_name, &privilege_luid)) {
diff --git a/chrome/installer/setup/setup_util_unittest.cc b/chrome/installer/setup/setup_util_unittest.cc
index 647d90f..389cc1e 100644
--- a/chrome/installer/setup/setup_util_unittest.cc
+++ b/chrome/installer/setup/setup_util_unittest.cc
@@ -55,13 +55,15 @@ static const wchar_t kTestedPrivilege[] = SE_RESTORE_NAME;
// Returns true if the current process' token has privilege |privilege_name|
// enabled.
bool CurrentProcessHasPrivilege(const wchar_t* privilege_name) {
- base::win::ScopedHandle token;
+ HANDLE temp_handle;
if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY,
- token.Receive())) {
+ &temp_handle)) {
ADD_FAILURE();
return false;
}
+ base::win::ScopedHandle token(temp_handle);
+
// First get the size of the buffer needed for |privileges| below.
DWORD size;
EXPECT_FALSE(::GetTokenInformation(token, TokenPrivileges, NULL, 0, &size));
diff --git a/chrome/installer/test/alternate_version_generator.cc b/chrome/installer/test/alternate_version_generator.cc
index 886ff06..d00da4f 100644
--- a/chrome/installer/test/alternate_version_generator.cc
+++ b/chrome/installer/test/alternate_version_generator.cc
@@ -210,13 +210,13 @@ bool MappedFile::Initialize(base::PlatformFile file) {
bool RunProcessAndWait(const wchar_t* exe_path, const std::wstring& cmdline,
int* exit_code) {
bool result = true;
- base::ProcessHandle process;
+ base::win::ScopedHandle process;
base::LaunchOptions options;
options.wait = true;
options.start_hidden = true;
if (base::LaunchProcess(cmdline, options, &process)) {
if (exit_code) {
- if (!GetExitCodeProcess(process,
+ if (!GetExitCodeProcess(process.Get(),
reinterpret_cast<DWORD*>(exit_code))) {
PLOG(DFATAL) << "Failed getting the exit code for \""
<< cmdline << "\".";
@@ -229,7 +229,6 @@ bool RunProcessAndWait(const wchar_t* exe_path, const std::wstring& cmdline,
result = false;
}
- CloseHandle(process);
return result;
}
diff --git a/chrome/installer/util/google_update_util.cc b/chrome/installer/util/google_update_util.cc
index 2448ba4..630cd0f 100644
--- a/chrome/installer/util/google_update_util.cc
+++ b/chrome/installer/util/google_update_util.cc
@@ -95,9 +95,9 @@ bool LaunchProcessAndWaitWithTimeout(const string16& cmd_string,
bool success = false;
base::win::ScopedHandle process;
int exit_code = 0;
- LOG(INFO) << "Launching: " << cmd_string;
+ VLOG(0) << "Launching: " << cmd_string;
if (!base::LaunchProcess(cmd_string, base::LaunchOptions(),
- process.Receive())) {
+ &process)) {
PLOG(ERROR) << "Failed to launch (" << cmd_string << ")";
} else if (!base::WaitForExitCodeWithTimeout(process, &exit_code, timeout)) {
// The GetExitCodeProcess failed or timed-out.
@@ -174,7 +174,7 @@ bool GetGoogleUpdateUntrustedData(
} // namespace
bool EnsureUserLevelGoogleUpdatePresent() {
- LOG(INFO) << "Ensuring Google Update is present at user-level.";
+ VLOG(0) << "Ensuring Google Update is present at user-level.";
bool success = false;
if (IsGoogleUpdatePresent(false)) {
diff --git a/chrome/test/ui/ui_test_suite.cc b/chrome/test/ui/ui_test_suite.cc
index 50cd2d5..1d02df5 100644
--- a/chrome/test/ui/ui_test_suite.cc
+++ b/chrome/test/ui/ui_test_suite.cc
@@ -70,11 +70,13 @@ void UITestSuite::LoadCrashService() {
base::LaunchOptions launch_options;
launch_options.job_handle = job_handle_.Get();
base::FilePath crash_service = exe_dir.Append(L"crash_service.exe");
+ base::win::ScopedHandle crash_service_handle;
if (!base::LaunchProcess(crash_service.value(), base::LaunchOptions(),
- &crash_service_)) {
+ &crash_service_handle)) {
LOG(ERROR) << "Couldn't start crash_service.exe, so this ui_tests run "
<< "won't tell you if any test crashes!";
return;
}
+ crash_service_ = crash_service_handle.Take();
}
#endif