Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4852)

Unified Diff: chrome/browser/google/google_update_win.cc

Issue 2952133002: Use task runner in version_updater_win.cc. (Closed)
Patch Set: remove task runner injection Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/google/google_update_win.cc
diff --git a/chrome/browser/google/google_update_win.cc b/chrome/browser/google/google_update_win.cc
index 48df1755ab31e9ed8ab1c96650110454273e7d3e..6bed7ee8343ac3b54f32114c04ada9e41a2a2890 100644
--- a/chrome/browser/google/google_update_win.cc
+++ b/chrome/browser/google/google_update_win.cc
@@ -27,6 +27,8 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/task_scheduler/post_task.h"
+#include "base/task_scheduler/task_traits.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "base/version.h"
@@ -205,10 +207,9 @@ HRESULT CreateGoogleUpdate3WebClass(
// Google Update on another.
class UpdateCheckDriver {
public:
- // Runs an update check on |task_runner|, invoking methods of |delegate| on
- // the caller's thread to report progress and final results.
+ // Runs an update check, invoking methods of |delegate| on the caller's thread
+ // to report progress and final results.
static void RunUpdateCheck(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner,
const std::string& locale,
bool install_update_if_possible,
gfx::AcceleratedWidget elevation_window,
@@ -218,7 +219,6 @@ class UpdateCheckDriver {
friend class base::DeleteHelper<UpdateCheckDriver>;
UpdateCheckDriver(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner,
const std::string& locale,
bool install_update_if_possible,
gfx::AcceleratedWidget elevation_window,
@@ -369,7 +369,6 @@ UpdateCheckDriver* UpdateCheckDriver::driver_ = nullptr;
// static
void UpdateCheckDriver::RunUpdateCheck(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner,
const std::string& locale,
bool install_update_if_possible,
gfx::AcceleratedWidget elevation_window,
@@ -379,26 +378,24 @@ void UpdateCheckDriver::RunUpdateCheck(
if (!driver_) {
// The driver is owned by itself, and will self-destruct when its work is
// done.
- driver_ =
- new UpdateCheckDriver(task_runner, locale, install_update_if_possible,
- elevation_window, delegate);
- task_runner->PostTask(FROM_HERE,
- base::Bind(&UpdateCheckDriver::BeginUpdateCheck,
- base::Unretained(driver_)));
+ driver_ = new UpdateCheckDriver(locale, install_update_if_possible,
+ elevation_window, delegate);
+ driver_->task_runner_->PostTask(
+ FROM_HERE, base::Bind(&UpdateCheckDriver::BeginUpdateCheck,
+ base::Unretained(driver_)));
} else {
- DCHECK_EQ(driver_->task_runner_, task_runner);
driver_->AddDelegate(delegate);
}
}
// Runs on the caller's thread.
UpdateCheckDriver::UpdateCheckDriver(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner,
const std::string& locale,
bool install_update_if_possible,
gfx::AcceleratedWidget elevation_window,
const base::WeakPtr<UpdateCheckDelegate>& delegate)
- : task_runner_(std::move(task_runner)),
+ : task_runner_(base::CreateSingleThreadTaskRunnerWithTraits(
gab 2017/07/17 17:14:40 Does CreateSequencedTaskRunnerWithTraits() work?
calamity 2017/07/19 09:03:38 Seems to.
+ {base::MayBlock(), base::TaskPriority::USER_VISIBLE})),
result_runner_(base::ThreadTaskRunnerHandle::Get()),
locale_(locale),
install_update_if_possible_(install_update_if_possible),
@@ -867,13 +864,11 @@ void UpdateCheckDriver::OnUpgradeError(GoogleUpdateErrorCode error_code,
// Globals ---------------------------------------------------------------------
void BeginUpdateCheck(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner,
const std::string& locale,
bool install_update_if_possible,
gfx::AcceleratedWidget elevation_window,
const base::WeakPtr<UpdateCheckDelegate>& delegate) {
- UpdateCheckDriver::RunUpdateCheck(std::move(task_runner), locale,
- install_update_if_possible,
+ UpdateCheckDriver::RunUpdateCheck(locale, install_update_if_possible,
elevation_window, delegate);
}

Powered by Google App Engine
This is Rietveld 408576698