Commit 5387fdd2 authored by tedvessenes@gmail.com's avatar tedvessenes@gmail.com

Fix CleanupProcesses() interface to use TimeDelta.

BUG=108171


Review URL: https://chromiumcodereview.appspot.com/10821062

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149312 0039d316-1c4b-4281-b951-d872f2087c98
parent 80b08346
......@@ -532,7 +532,7 @@ BASE_EXPORT bool WaitForSingleProcess(ProcessHandle handle,
// any processes needed to be killed, true if they all exited cleanly within
// the wait_milliseconds delay.
BASE_EXPORT bool CleanupProcesses(const FilePath::StringType& executable_name,
int64 wait_milliseconds,
base::TimeDelta wait,
int exit_code,
const ProcessFilter* filter);
......
......@@ -1227,14 +1227,10 @@ bool WaitForProcessesToExit(const FilePath::StringType& executable_name,
}
bool CleanupProcesses(const FilePath::StringType& executable_name,
int64 wait_milliseconds,
base::TimeDelta wait,
int exit_code,
const ProcessFilter* filter) {
bool exited_cleanly =
WaitForProcessesToExit(
executable_name,
base::TimeDelta::FromMilliseconds(wait_milliseconds),
filter);
bool exited_cleanly = WaitForProcessesToExit(executable_name, wait, filter);
if (!exited_cleanly)
KillProcesses(executable_name, exit_code, filter);
return exited_cleanly;
......
......@@ -619,13 +619,10 @@ bool WaitForSingleProcess(ProcessHandle handle, base::TimeDelta wait) {
}
bool CleanupProcesses(const FilePath::StringType& executable_name,
int64 wait_milliseconds,
base::TimeDelta wait,
int exit_code,
const ProcessFilter* filter) {
bool exited_cleanly = WaitForProcessesToExit(
executable_name,
base::TimeDelta::FromMilliseconds(wait_milliseconds),
filter);
bool exited_cleanly = WaitForProcessesToExit(executable_name, wait, filter);
if (!exited_cleanly)
KillProcesses(executable_name, exit_code, filter);
return exited_cleanly;
......
......@@ -187,9 +187,9 @@ void CloseAllChromeProcesses() {
window = FindWindowEx(NULL, window, wnd_class.c_str(), NULL);
if (!SendMessageTimeout(tmpWnd, WM_CLOSE, 0, 0, SMTO_BLOCK, 3000, NULL) &&
(GetLastError() == ERROR_TIMEOUT)) {
base::CleanupProcesses(installer::kChromeExe, 0,
base::CleanupProcesses(installer::kChromeExe, base::TimeDelta(),
content::RESULT_CODE_HUNG, NULL);
base::CleanupProcesses(installer::kNaClExe, 0,
base::CleanupProcesses(installer::kNaClExe, base::TimeDelta(),
content::RESULT_CODE_HUNG, NULL);
return;
}
......@@ -199,9 +199,11 @@ void CloseAllChromeProcesses() {
// If asking politely didn't work, wait for 15 seconds and then kill all
// chrome.exe. This check is just in case Chrome is ignoring WM_CLOSE
// messages.
base::CleanupProcesses(installer::kChromeExe, 15000,
base::CleanupProcesses(installer::kChromeExe,
base::TimeDelta::FromSeconds(15),
content::RESULT_CODE_HUNG, NULL);
base::CleanupProcesses(installer::kNaClExe, 15000,
base::CleanupProcesses(installer::kNaClExe,
base::TimeDelta::FromSeconds(15),
content::RESULT_CODE_HUNG, NULL);
}
......@@ -236,7 +238,7 @@ void CloseChromeFrameHelperProcess() {
if (kill) {
VLOG(1) << installer::kChromeFrameHelperExe << " hung. Killing.";
base::CleanupProcesses(installer::kChromeFrameHelperExe, 0,
base::CleanupProcesses(installer::kChromeFrameHelperExe, base::TimeDelta(),
content::RESULT_CODE_HUNG, NULL);
}
}
......
......@@ -179,7 +179,7 @@ bool Install(const FilePath& installer, const SwitchBuilder& switches) {
}
bool LaunchChrome(bool close_after_launch, bool system_level) {
base::CleanupProcesses(installer::kChromeExe, 0,
base::CleanupProcesses(installer::kChromeExe, base::TimeDelta(),
content::RESULT_CODE_HUNG, NULL);
FilePath install_path;
if (!GetChromeInstallDirectory(
......@@ -218,9 +218,9 @@ bool LaunchIE(const std::string& url) {
}
bool UninstallAll() {
base::CleanupProcesses(installer::kChromeExe, 0,
base::CleanupProcesses(installer::kChromeExe, base::TimeDelta(),
content::RESULT_CODE_HUNG, NULL);
base::CleanupProcesses(installer::kChromeFrameHelperExe, 0,
base::CleanupProcesses(installer::kChromeFrameHelperExe, base::TimeDelta(),
content::RESULT_CODE_HUNG, NULL);
std::vector<installer_test::InstalledProduct> installed;
if (!GetInstalledProducts(&installed)) {
......@@ -273,7 +273,8 @@ bool Uninstall(bool system_level,
LOG(INFO) << "Uninstall command: " << uninstall_cmd.GetCommandLineString();
bool ret_val = RunAndWaitForCommandToFinish(uninstall_cmd);
// Close IE notification when uninstalling Chrome Frame.
base::CleanupProcesses(mini_installer_constants::kIEProcessName, 0,
base::CleanupProcesses(mini_installer_constants::kIEProcessName,
base::TimeDelta(),
content::RESULT_CODE_HUNG, NULL);
return ret_val;
}
......
......@@ -204,7 +204,7 @@ TEST_F(MiniInstallTest, RepairFolderOnFullUser) {
full_installer_, SwitchBuilder().AddChrome()));
ASSERT_TRUE(installer_test::ValidateInstall(false,
InstallationValidator::CHROME_SINGLE, provider_->GetCurrentBuild()));
base::CleanupProcesses(installer::kChromeExe, 0,
base::CleanupProcesses(installer::kChromeExe, base::TimeDelta(),
content::RESULT_CODE_HUNG, NULL);
ASSERT_TRUE(installer_test::DeleteInstallDirectory(
false, // system level
......@@ -220,7 +220,7 @@ TEST_F(MiniInstallTest, RepairFolderOnFullSys) {
SwitchBuilder().AddChrome().AddSystemInstall()));
ASSERT_TRUE(installer_test::ValidateInstall(true,
InstallationValidator::CHROME_SINGLE, provider_->GetCurrentBuild()));
base::CleanupProcesses(installer::kChromeExe, 0,
base::CleanupProcesses(installer::kChromeExe, base::TimeDelta(),
content::RESULT_CODE_HUNG, NULL);
ASSERT_TRUE(installer_test::DeleteInstallDirectory(
true, // system level
......@@ -237,7 +237,7 @@ TEST_F(MiniInstallTest, RepairRegistryOnFullUser) {
full_installer_, SwitchBuilder().AddChrome()));
ASSERT_TRUE(installer_test::ValidateInstall(false,
InstallationValidator::CHROME_SINGLE, provider_->GetCurrentBuild()));
base::CleanupProcesses(installer::kChromeExe, 0,
base::CleanupProcesses(installer::kChromeExe, base::TimeDelta(),
content::RESULT_CODE_HUNG, NULL);
ASSERT_TRUE(installer_test::DeleteRegistryKey(
false, // system level
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment