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

Unified Diff: chrome/browser/ui/webui/help/version_updater_win.cc

Issue 2952133002: Use task runner in version_updater_win.cc. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..88e3bf3f62e6408dc79d6e687f7c7ae35a1d7e72 100644
--- a/chrome/browser/ui/webui/help/version_updater_win.cc
+++ b/chrome/browser/ui/webui/help/version_updater_win.cc
@@ -5,14 +5,12 @@
#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"
#include "chrome/browser/first_run/upgrade_util.h"
#include "chrome/grit/generated_resources.h"
-#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
@@ -46,47 +44,37 @@ void VersionUpdaterWin::CheckForUpdate(const StatusCallback& callback,
void VersionUpdaterWin::OnUpdateCheckComplete(
const base::string16& new_version) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
Status status = CHECKING;
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;
+ BeginUpdateCheckOnFileThread(true /* install_update_if_possible */);
callback_.Run(status, 0, std::string(), 0, base::string16());
}
void VersionUpdaterWin::OnUpgradeProgress(int progress,
const base::string16& new_version) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
callback_.Run(UPDATING, progress, std::string(), 0, base::string16());
}
void VersionUpdaterWin::OnUpgradeComplete(const base::string16& new_version) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
callback_.Run(NEARLY_UPDATED, 0, std::string(), 0, base::string16());
}
void VersionUpdaterWin::OnError(GoogleUpdateErrorCode error_code,
const base::string16& html_error_message,
const base::string16& new_version) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
gab 2017/07/11 23:40:15 It's fine to keep these (the UI thread isn't going
calamity 2017/07/12 07:11:40 Done.
base::string16 message;
Status status = FAILED;
@@ -118,8 +106,8 @@ void VersionUpdaterWin::BeginUpdateCheckOnFileThread(
bool install_update_if_possible) {
// Disconnect from any previous attempts to avoid redundant callbacks.
weak_factory_.InvalidateWeakPtrs();
- BeginUpdateCheck(content::BrowserThread::GetTaskRunnerForThread(
- content::BrowserThread::FILE),
+ BeginUpdateCheck(base::CreateSingleThreadTaskRunnerWithTraits(
gab 2017/07/11 23:40:15 Have the leaves of this call obtain the task runne
calamity 2017/07/12 07:11:40 I gave this a shot. The latest patchset shows my a
+ {base::MayBlock(), base::TaskPriority::USER_VISIBLE}),
g_browser_process->GetApplicationLocale(),
install_update_if_possible, owner_widget_,
weak_factory_.GetWeakPtr());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698