Commit 24bdf98c authored by Findit's avatar Findit

Revert "Kill the software_reporter_tool process if the browser exits early"

This reverts commit 71d76ec9.

Reason for revert:

Findit (https://goo.gl/kROfz5) identified CL at revision 715997 as the
culprit for failures in the build cycles as shown on:
https://analysis.chromium.org/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyRAsSDVdmU3VzcGVjdGVkQ0wiMWNocm9taXVtLzcxZDc2ZWM5MTFhNDE1ZWM0ZjE5OTE4MzA0NzY2NGY0Yjg4NDgxZWEM

Sample Failed Build: https://ci.chromium.org/b/8896663695938427904

Sample Failed Step: unit_tests

Original change's description:
> Kill the software_reporter_tool process if the browser exits early
> 
> Assign the software_reporter_tool process to a job object with the
> KILL_ON_JOB_CLOSE flag, so that the process will automatically be killed
> if it's still running when the browser exits.
> 
> R=proberge
> 
> Bug: 1016939
> Change-Id: I87dfc907cc853add1721f80c589051896ed4e857
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1918106
> Commit-Queue: Joe Mason <joenotcharles@chromium.org>
> Reviewed-by: proberge <proberge@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#715997}


Change-Id: I98cf8ae8502f965ab438b7bfa47fe5be8b31ec48
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1016939
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1920319
Cr-Commit-Position: refs/heads/master@{#716005}
parent 55ac3065
......@@ -32,8 +32,6 @@
#include "base/task/task_traits.h"
#include "base/task_runner_util.h"
#include "base/win/registry.h"
#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
#include "chrome/browser/profiles/profile.h"
......@@ -1006,26 +1004,6 @@ int LaunchAndWaitForExit(const SwReporterInvocation& invocation) {
base::LaunchOptions launch_options;
launch_options.current_directory = tmpdir;
// Assign the reporter process to a job. If the browser exits before the
// reporter, the OS will close the job handle and the reporter process.
//
// Windows 7 does not allow nested job objects, and the process may already
// be in a job (for example when running under a debugger or in Terminal
// Server) so only enable this on Windows 8+. The reporter will finish its
// scan and upload reports if the user has opted in, but not be able to
// prompt for cleanup if UwS is found.
base::win::ScopedHandle job;
if (base::win::GetVersion() >= base::win::Version::WIN8) {
job.Set(::CreateJobObject(nullptr, nullptr));
}
if (job.IsValid()) {
base::SetJobObjectLimitFlags(job.Get(), JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE);
launch_options.job_handle = job.Get();
} else {
PLOG(WARNING) << "The Chrome Cleanup Tool's reporter process is not "
"attached to a job and may outlive the browser.";
}
base::Process reporter_process =
g_testing_delegate_
? g_testing_delegate_->LaunchReporterProcess(invocation,
......@@ -1045,9 +1023,6 @@ int LaunchAndWaitForExit(const SwReporterInvocation& invocation) {
bool success = reporter_process.WaitForExit(&exit_code);
DCHECK(success);
}
// After the reporter process has exited the job object is no longer needed.
// It will be closed when it goes out of scope here.
return exit_code;
}
......
......@@ -3811,7 +3811,6 @@ test("unit_tests") {
"../browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win_unittest.cc",
"../browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_process_win.cc",
"../browser/safe_browsing/chrome_cleaner/mock_chrome_cleaner_process_win.h",
"../browser/safe_browsing/chrome_cleaner/reporter_runner_win_unittest.cc",
"../browser/safe_browsing/chrome_cleaner/srt_delete_extension_win_unittest.cc",
"../browser/safe_browsing/chrome_cleaner/srt_field_trial_win_unittest.cc",
"../browser/search/background/ntp_background_service_unittest.cc",
......
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