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

Unified Diff: chrome/browser/ui/webui/chromeos/login/l10n_util.cc

Issue 2884973004: Remove usage of SequencedWorkerPool::GetNamedSequenceToken from GetKeyboardLayoutsForLocale. (Closed)
Patch Set: rebase 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
« no previous file with comments | « chrome/browser/chromeos/policy/device_local_account_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/chromeos/login/l10n_util.cc
diff --git a/chrome/browser/ui/webui/chromeos/login/l10n_util.cc b/chrome/browser/ui/webui/chromeos/login/l10n_util.cc
index 8373721721c2700b978bff049f37ef929a1b07fa..ea458416b2b6e1aa17886b205a4b97ca81b22b5e 100644
--- a/chrome/browser/ui/webui/chromeos/login/l10n_util.cc
+++ b/chrome/browser/ui/webui/chromeos/login/l10n_util.cc
@@ -24,8 +24,8 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task_runner_util.h"
-#include "base/threading/sequenced_worker_pool.h"
-#include "base/threading/thread_task_runner_handle.h"
+#include "base/task_scheduler/post_task.h"
+#include "base/threading/sequenced_task_runner_handle.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/customization/customization_document.h"
@@ -45,8 +45,6 @@ const char kMostRelevantLanguagesDivider[] = "MOST_RELEVANT_LANGUAGES_DIVIDER";
namespace {
-const char kSequenceToken[] = "chromeos_login_l10n_util";
-
std::unique_ptr<base::DictionaryValue> CreateInputMethodsEntry(
const input_method::InputMethodDescriptor& method,
const std::string selected) {
@@ -346,12 +344,11 @@ std::string CalculateSelectedLanguage(const std::string& requested_locale,
return loaded_locale;
}
-void ResolveLanguageListOnBlockingPool(
+void ResolveLanguageListInThreadPool(
std::unique_ptr<chromeos::locale_util::LanguageSwitchResult>
language_switch_result,
const scoped_refptr<base::TaskRunner> task_runner,
const UILanguageListResolvedCallback& resolved_callback) {
- // DCHECK(task_runner->RunsTasksInCurrentSequence());
achuithb 2017/05/18 21:36:51 Is there an appropriate DCHECK to assert the right
base::ThreadRestrictions::AssertIOAllowed();
emaxx 2017/05/19 17:58:16 nit: While you're here - please add #include "base
fdoray 2017/05/19 18:34:28 Done.
std::string selected_language;
@@ -428,10 +425,11 @@ void ResolveUILanguageList(
const UILanguageListResolvedCallback& callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- content::BrowserThread::GetBlockingPool()->PostTask(
- FROM_HERE, base::Bind(&ResolveLanguageListOnBlockingPool,
- base::Passed(&language_switch_result),
- base::ThreadTaskRunnerHandle::Get(), callback));
+ base::PostTaskWithTraits(
+ FROM_HERE, {base::MayBlock()},
+ base::BindOnce(&ResolveLanguageListInThreadPool,
+ base::Passed(&language_switch_result),
+ base::SequencedTaskRunnerHandle::Get(), callback));
}
std::unique_ptr<base::ListValue> GetMinimalUILanguageList() {
@@ -578,21 +576,15 @@ std::unique_ptr<base::ListValue> GetAndActivateLoginKeyboardLayouts(
void GetKeyboardLayoutsForLocale(
const GetKeyboardLayoutsForLocaleCallback& callback,
const std::string& locale) {
- base::SequencedWorkerPool* worker_pool =
- content::BrowserThread::GetBlockingPool();
- scoped_refptr<base::SequencedTaskRunner> background_task_runner =
- worker_pool->GetSequencedTaskRunnerWithShutdownBehavior(
- worker_pool->GetNamedSequenceToken(kSequenceToken),
- base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
emaxx 2017/05/19 17:58:16 Is there a reason for not keeping the SKIP_ON_SHUT
fdoray 2017/05/19 18:34:28 No. Added it back.
-
// Resolve |locale| on a background thread, then continue on the current
// thread.
std::string (*get_application_locale)(const std::string&, bool) =
&l10n_util::GetApplicationLocale;
- base::PostTaskAndReplyWithResult(
- background_task_runner.get(), FROM_HERE,
- base::Bind(get_application_locale, locale, false /* set_icu_locale */),
- base::Bind(&GetKeyboardLayoutsForResolvedLocale, locale, callback));
+ base::PostTaskWithTraitsAndReplyWithResult(
fdoray 2017/05/17 17:52:16 Is it important to have mutual exclusion between t
emaxx 2017/05/19 17:58:16 Looking at implementation of l10n_util::GetApplica
+ FROM_HERE, {base::MayBlock()},
+ base::BindOnce(get_application_locale, locale,
+ false /* set_icu_locale */),
+ base::BindOnce(&GetKeyboardLayoutsForResolvedLocale, locale, callback));
}
std::unique_ptr<base::DictionaryValue> GetCurrentKeyboardLayout() {
« no previous file with comments | « chrome/browser/chromeos/policy/device_local_account_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698