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

Unified Diff: chrome/browser/shell_integration.cc

Issue 2888693003: Remove the usage of BrowserThread::FILE in the shell_integration* files (Closed)
Patch Set: Again Created 3 years, 7 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/shell_integration.cc
diff --git a/chrome/browser/shell_integration.cc b/chrome/browser/shell_integration.cc
index a846887aa0d8bb3a30a26c9878843fec0096d1bd..7d746c3eeb2f28f2dabf24cf0b64b1e787da6901 100644
--- a/chrome/browser/shell_integration.cc
+++ b/chrome/browser/shell_integration.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/shell_integration.h"
+#include "base//task_scheduler/post_task.h"
Lei Zhang 2017/05/19 23:23:13 Extra /
Patrick Monette 2017/05/26 01:50:12 Done.
#include "base/bind.h"
#include "base/command_line.h"
#include "base/files/file_util.h"
@@ -136,15 +137,18 @@ base::string16 GetAppShortcutsSubdirName() {
//
void DefaultWebClientWorker::StartCheckIsDefault() {
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
- base::Bind(&DefaultWebClientWorker::CheckIsDefault, this, false));
+ base::CreateSequencedTaskRunnerWithTraits({base::MayBlock()})
+ ->PostTask(FROM_HERE, base::Bind(&DefaultWebClientWorker::CheckIsDefault,
+ this, false));
}
void DefaultWebClientWorker::StartSetAsDefault() {
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
- base::Bind(&DefaultWebClientWorker::SetAsDefault, this));
+ // TODO(pmonette): Windows' implementation uses a base::Timer which currently
+ // still requires a SingleThreadTaskRunner. Change this to a
+ // SequencedTaskRunner when crbug.com/552633 is fixed.
+ base::CreateSingleThreadTaskRunnerWithTraits({base::MayBlock()})
+ ->PostTask(FROM_HERE,
+ base::Bind(&DefaultWebClientWorker::SetAsDefault, this));
}
///////////////////////////////////////////////////////////////////////////////
@@ -171,7 +175,8 @@ void DefaultWebClientWorker::OnCheckIsDefaultComplete(
// DefaultWebClientWorker, private:
void DefaultWebClientWorker::CheckIsDefault(bool is_following_set_as_default) {
- DCHECK_CURRENTLY_ON(BrowserThread::FILE);
+ base::ThreadRestrictions::AssertIOAllowed();
+
DefaultWebClientState state = CheckIsDefaultImpl();
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
@@ -180,7 +185,7 @@ void DefaultWebClientWorker::CheckIsDefault(bool is_following_set_as_default) {
}
void DefaultWebClientWorker::SetAsDefault() {
- DCHECK_CURRENTLY_ON(BrowserThread::FILE);
+ base::ThreadRestrictions::AssertIOAllowed();
// SetAsDefaultImpl will make sure the callback is executed exactly once.
SetAsDefaultImpl(

Powered by Google App Engine
This is Rietveld 408576698