Index: chrome/browser/shell_integration_win.cc |
diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc |
index 6661fcef8312e7d26a207adccc547bdb9818650a..b46c436ec1db411b14107d11312c1fc515ae8c47 100644 |
--- a/chrome/browser/shell_integration_win.cc |
+++ b/chrome/browser/shell_integration_win.cc |
@@ -31,6 +31,7 @@ |
#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/time/time.h" |
#include "base/timer/timer.h" |
#include "base/win/registry.h" |
@@ -53,12 +54,9 @@ |
#include "chrome/installer/util/scoped_user_protocol_entry.h" |
#include "chrome/installer/util/shell_util.h" |
#include "components/variations/variations_associated_data.h" |
-#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/utility_process_mojo_client.h" |
#include "ui/base/l10n/l10n_util.h" |
-using content::BrowserThread; |
- |
namespace shell_integration { |
namespace { |
@@ -149,8 +147,7 @@ base::string16 GetExpectedAppId(const base::CommandLine& command_line, |
} |
void MigrateTaskbarPinsCallback() { |
- // This should run on the file thread. |
- DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
+ base::ThreadRestrictions::AssertIOAllowed(); |
// Get full path of chrome. |
base::FilePath chrome_exe; |
@@ -327,8 +324,6 @@ class OpenSystemSettingsHelper { |
// watched. The array must contain at least one element. |
static void Begin(const wchar_t* const protocols[], |
const base::Closure& on_finished_callback) { |
- DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
Lei Zhang
2017/05/19 23:23:13
Looks like you wrote this code. If you are ok with
Patrick Monette
2017/05/26 01:50:12
Your comment made me realize that there is actuall
|
- |
delete instance_; |
instance_ = new OpenSystemSettingsHelper(protocols, on_finished_callback); |
} |
@@ -368,8 +363,6 @@ class OpenSystemSettingsHelper { |
// function even if the value change is the only one that matters. This |
// is good enough for now. |
void OnRegistryKeyChanged() { |
- DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
- |
// Make sure all the registry watchers have fired. |
if (--registry_watcher_count_ == 0) { |
UMA_HISTOGRAM_MEDIUM_TIMES( |
@@ -384,8 +377,6 @@ class OpenSystemSettingsHelper { |
// |on_finished_callback_| and then dispose of this class instance to make |
// sure the callback won't get called subsequently. |
void ConcludeInteraction(ConcludeReason conclude_reason) { |
- DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
- |
UMA_HISTOGRAM_ENUMERATION( |
"DefaultBrowser.SettingsInteraction.ConcludeReason", conclude_reason, |
NUM_CONCLUDE_REASON_TYPES); |
@@ -642,8 +633,6 @@ bool SetAsDefaultBrowserUsingIntentPicker() { |
void SetAsDefaultBrowserUsingSystemSettings( |
const base::Closure& on_finished_callback) { |
- DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
- |
base::FilePath chrome_exe; |
if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { |
NOTREACHED() << "Error getting app exe path"; |
@@ -690,7 +679,7 @@ bool SetAsDefaultProtocolClientUsingIntentPicker(const std::string& protocol) { |
void SetAsDefaultProtocolClientUsingSystemSettings( |
const std::string& protocol, |
const base::Closure& on_finished_callback) { |
- DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
+ base::ThreadRestrictions::AssertIOAllowed(); |
base::FilePath chrome_exe; |
if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { |
@@ -730,14 +719,12 @@ void MigrateTaskbarPins() { |
if (base::win::GetVersion() < base::win::VERSION_WIN7) |
return; |
- // This needs to happen eventually (e.g. so that the appid is fixed and the |
- // run-time Chrome icon is merged with the taskbar shortcut), but this is not |
- // urgent and shouldn't delay Chrome startup. |
- static const int64_t kMigrateTaskbarPinsDelaySeconds = 15; |
- BrowserThread::PostDelayedTask( |
- BrowserThread::FILE, FROM_HERE, |
- base::Bind(&MigrateTaskbarPinsCallback), |
- base::TimeDelta::FromSeconds(kMigrateTaskbarPinsDelaySeconds)); |
+ // This needs to happen (e.g. so that the appid is fixed and the |
+ // run-time Chrome icon is merged with the taskbar shortcut), but it is not an |
+ // urgent task. |
+ base::PostTaskWithTraits(FROM_HERE, |
+ {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
+ base::Bind(&MigrateTaskbarPinsCallback)); |
} |
void GetIsPinnedToTaskbarState( |