Commit 77b3d04f authored by joenotcharles's avatar joenotcharles Committed by Commit bot

Remove explicit task runner references from MaybeExecuteSRTFromBlockingPool

BUG=714191

Review-Url: https://codereview.chromium.org/2829293002
Cr-Commit-Position: refs/heads/master@{#468103}
parent 34f7b0fb
...@@ -13,10 +13,8 @@ ...@@ -13,10 +13,8 @@
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "base/process/launch.h" #include "base/process/launch.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/task_scheduler/post_task.h" #include "base/task_scheduler/post_task.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/app/chrome_command_ids.h" #include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/metrics/chrome_metrics_service_accessor.h" #include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
...@@ -33,13 +31,8 @@ ...@@ -33,13 +31,8 @@
#include "components/component_updater/pref_names.h" #include "components/component_updater/pref_names.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/version_info/version_info.h" #include "components/version_info/version_info.h"
#include "content/public/browser/browser_thread.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
using base::SingleThreadTaskRunner;
using base::ThreadTaskRunnerHandle;
using content::BrowserThread;
namespace safe_browsing { namespace safe_browsing {
namespace { namespace {
...@@ -53,14 +46,11 @@ const char kSRTDownloadURL[] = ...@@ -53,14 +46,11 @@ const char kSRTDownloadURL[] =
// downloaded. // downloaded.
const base::FilePath::CharType kExecutableExtension[] = L"exe"; const base::FilePath::CharType kExecutableExtension[] = L"exe";
void MaybeExecuteSRTFromBlockingPool( bool MaybeExecuteSRTFromBlockingPool(
const base::FilePath& downloaded_path, const base::FilePath& downloaded_path,
bool metrics_enabled, bool metrics_enabled,
bool sber_enabled, bool sber_enabled,
chrome_cleaner::ChromePromptValue prompt_value, chrome_cleaner::ChromePromptValue prompt_value) {
const scoped_refptr<SingleThreadTaskRunner>& task_runner,
const base::Closure& success_callback,
const base::Closure& failure_callback) {
DCHECK(!downloaded_path.empty()); DCHECK(!downloaded_path.empty());
if (base::PathExists(downloaded_path)) { if (base::PathExists(downloaded_path)) {
...@@ -96,14 +86,10 @@ void MaybeExecuteSRTFromBlockingPool( ...@@ -96,14 +86,10 @@ void MaybeExecuteSRTFromBlockingPool(
base::Process srt_process( base::Process srt_process(
base::LaunchProcess(srt_command_line, base::LaunchOptions())); base::LaunchProcess(srt_command_line, base::LaunchOptions()));
if (srt_process.IsValid()) { return srt_process.IsValid();
task_runner->PostTask(FROM_HERE, success_callback);
return;
}
} }
} }
return false;
task_runner->PostTask(FROM_HERE, failure_callback);
} }
void DeleteFilesFromBlockingPool(const base::FilePath& downloaded_path) { void DeleteFilesFromBlockingPool(const base::FilePath& downloaded_path) {
...@@ -222,7 +208,7 @@ void SRTGlobalError::MaybeExecuteSRT() { ...@@ -222,7 +208,7 @@ void SRTGlobalError::MaybeExecuteSRT() {
// At this point, this object owns itself, since ownership has been taken back // At this point, this object owns itself, since ownership has been taken back
// from the global_error_service_ in the call to OnUserInteractionStarted. // from the global_error_service_ in the call to OnUserInteractionStarted.
// This means that it is safe to use base::Unretained here. // This means that it is safe to use base::Unretained here.
base::PostTaskWithTraits( base::PostTaskWithTraitsAndReplyWithResult(
FROM_HERE, FROM_HERE,
base::TaskTraits().MayBlock().WithPriority( base::TaskTraits().MayBlock().WithPriority(
base::TaskPriority::BACKGROUND), base::TaskPriority::BACKGROUND),
...@@ -232,12 +218,15 @@ void SRTGlobalError::MaybeExecuteSRT() { ...@@ -232,12 +218,15 @@ void SRTGlobalError::MaybeExecuteSRT() {
SafeBrowsingExtendedReportingEnabled(), SafeBrowsingExtendedReportingEnabled(),
bubble_shown_from_menu_ bubble_shown_from_menu_
? chrome_cleaner::ChromePromptValue::kShownFromMenu ? chrome_cleaner::ChromePromptValue::kShownFromMenu
: chrome_cleaner::ChromePromptValue::kPrompted, : chrome_cleaner::ChromePromptValue::kPrompted),
base::ThreadTaskRunnerHandle::Get(), base::Bind(
base::Bind(&SRTGlobalError::OnUserinteractionDone, [](SRTGlobalError* self, bool success) {
base::Unretained(this)), if (success)
base::Bind(&SRTGlobalError::FallbackToDownloadPage, self->OnUserinteractionDone();
base::Unretained(this)))); else
self->FallbackToDownloadPage();
},
base::Unretained(this)));
} }
void SRTGlobalError::FallbackToDownloadPage() { void SRTGlobalError::FallbackToDownloadPage() {
......
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