| Index: chrome/browser/ui/webui/help/version_updater_win.cc
|
| diff --git a/chrome/browser/ui/webui/help/version_updater_win.cc b/chrome/browser/ui/webui/help/version_updater_win.cc
|
| index 43bcd5945b4b3fd9a608a9030900a6a7785775b0..ae1d55f5462f828adb0441d47deb3507559745a0 100644
|
| --- a/chrome/browser/ui/webui/help/version_updater_win.cc
|
| +++ b/chrome/browser/ui/webui/help/version_updater_win.cc
|
| @@ -5,8 +5,7 @@
|
| #include "chrome/browser/ui/webui/help/version_updater_win.h"
|
|
|
| #include "base/memory/weak_ptr.h"
|
| -#include "base/task_runner_util.h"
|
| -#include "base/threading/sequenced_worker_pool.h"
|
| +#include "base/task_scheduler/post_task.h"
|
| #include "base/win/win_util.h"
|
| #include "base/win/windows_version.h"
|
| #include "chrome/browser/browser_process.h"
|
| @@ -40,7 +39,7 @@ void VersionUpdaterWin::CheckForUpdate(const StatusCallback& callback,
|
| (base::win::OSInfo::GetInstance()->service_pack().major == 0) &&
|
| !base::win::UserAccountControlIsEnabled())) {
|
| callback_.Run(CHECKING, 0, std::string(), 0, base::string16());
|
| - BeginUpdateCheckOnFileThread(false /* !install_update_if_possible */);
|
| + DoBeginUpdateCheck(false /* !install_update_if_possible */);
|
| }
|
| }
|
|
|
| @@ -51,24 +50,18 @@ void VersionUpdaterWin::OnUpdateCheckComplete(
|
| if (new_version.empty()) {
|
| // Google Update says that no new version is available. Check to see if a
|
| // restart is needed for a previously-applied update to take effect.
|
| - if (base::PostTaskAndReplyWithResult(
|
| - content::BrowserThread::GetBlockingPool(),
|
| - FROM_HERE,
|
| - base::Bind(&upgrade_util::IsUpdatePendingRestart),
|
| - base::Bind(&VersionUpdaterWin::OnPendingRestartCheck,
|
| - weak_factory_.GetWeakPtr()))) {
|
| - // Early exit since callback_ will be Run in OnPendingRestartCheck.
|
| - return;
|
| - }
|
| - // Failure to post the task means that Chrome is shutting down. A pending
|
| - // update (if there is one) will be applied as Chrome exits, so tell the
|
| - // caller that it is up to date in either case.
|
| - status = UPDATED;
|
| - } else {
|
| - // Notify the caller that the update is now beginning and initiate it.
|
| - status = UPDATING;
|
| - BeginUpdateCheckOnFileThread(true /* install_update_if_possible */);
|
| + base::PostTaskWithTraitsAndReplyWithResult(
|
| + FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
|
| + base::Bind(&upgrade_util::IsUpdatePendingRestart),
|
| + base::Bind(&VersionUpdaterWin::OnPendingRestartCheck,
|
| + weak_factory_.GetWeakPtr()));
|
| + // Early exit since callback_ will be Run in OnPendingRestartCheck.
|
| + return;
|
| }
|
| +
|
| + // Notify the caller that the update is now beginning and initiate it.
|
| + status = UPDATING;
|
| + DoBeginUpdateCheck(true /* install_update_if_possible */);
|
| callback_.Run(status, 0, std::string(), 0, base::string16());
|
| }
|
|
|
| @@ -114,13 +107,10 @@ void VersionUpdaterWin::OnError(GoogleUpdateErrorCode error_code,
|
| callback_.Run(status, 0, std::string(), 0, message);
|
| }
|
|
|
| -void VersionUpdaterWin::BeginUpdateCheckOnFileThread(
|
| - bool install_update_if_possible) {
|
| +void VersionUpdaterWin::DoBeginUpdateCheck(bool install_update_if_possible) {
|
| // Disconnect from any previous attempts to avoid redundant callbacks.
|
| weak_factory_.InvalidateWeakPtrs();
|
| - BeginUpdateCheck(content::BrowserThread::GetTaskRunnerForThread(
|
| - content::BrowserThread::FILE),
|
| - g_browser_process->GetApplicationLocale(),
|
| + BeginUpdateCheck(g_browser_process->GetApplicationLocale(),
|
| install_update_if_possible, owner_widget_,
|
| weak_factory_.GetWeakPtr());
|
| }
|
|
|