Commit aeae00e6 authored by François Doray's avatar François Doray Committed by Commit Bot

[threadpool] Set nacl tasks required for official keyboard on ChromeOS as USER_BLOCKING.

This is a required step to make the official keyboard work without
BEST_EFFORT tasks.

BEST_EFFORT tasks can be arbitrarily delayed. They should not be on
the critical path of behavior the user is actively waiting on.

Test:
- On a branch that has both this CL and
  https://chromium-review.googlesource.com/c/chromium/src/+/1680760,
  run Chrome with --enable-virtual-keyboard --disable-best-effort-tasks.
- Click on the omnibox to enter text.
- Expected result: The official virtual keyboard is displayed.

Bug: 976542
Change-Id: I05338afd019d769da18c272dbf300128b8d891bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1693184Reviewed-by: default avatarDerek Schuff <dschuff@chromium.org>
Reviewed-by: default avatarDarren Shen <shend@chromium.org>
Commit-Queue: François Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#675825}
parent aed5bc24
......@@ -31,6 +31,10 @@
namespace {
// Tasks posted in this file are on the critical path of displaying the official
// virtual keyboard on Chrome OS. https://crbug.com/976542
constexpr base::TaskPriority kUserBlocking = base::TaskPriority::USER_BLOCKING;
// An arbitrary delay to coalesce multiple writes to the cache.
const int kValidationCacheCoalescingTimeMS = 6000;
const base::FilePath::CharType kValidationCacheFileName[] =
......@@ -281,7 +285,7 @@ void NaClBrowser::EnsureIrtAvailable() {
if (IsOk() && irt_state_ == NaClResourceUninitialized) {
irt_state_ = NaClResourceRequested;
auto task_runner = base::CreateTaskRunnerWithTraits(
{base::MayBlock(), base::TaskPriority::BEST_EFFORT,
{base::MayBlock(), kUserBlocking,
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN});
std::unique_ptr<base::FileProxy> file_proxy(
new base::FileProxy(task_runner.get()));
......@@ -375,7 +379,7 @@ void NaClBrowser::EnsureValidationCacheAvailable() {
// task and further file access will not occur until after we get a
// response.
base::PostTaskWithTraitsAndReply(
FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
FROM_HERE, {base::MayBlock(), kUserBlocking},
base::BindOnce(ReadCache, validation_cache_file_path_, data),
base::BindOnce(&NaClBrowser::OnValidationCacheLoaded,
base::Unretained(this), base::Owned(data)));
......
......@@ -811,7 +811,10 @@ bool NaClProcessHost::StartNaClExecution() {
// compromised renderer to pass an arbitrary fd that could get loaded
// into the plugin process.
base::PostTaskWithTraitsAndReplyWithResult(
FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
FROM_HERE,
// USER_BLOCKING because it is on the critical path of displaying the
// official virtual keyboard on Chrome OS. https://crbug.com/976542
{base::MayBlock(), base::TaskPriority::USER_BLOCKING},
base::BindOnce(OpenNaClReadExecImpl, file_path,
true /* is_executable */),
base::BindOnce(&NaClProcessHost::StartNaClFileResolved,
......@@ -1044,7 +1047,10 @@ void NaClProcessHost::OnResolveFileToken(uint64_t file_token_lo,
// Open the file.
base::PostTaskWithTraitsAndReplyWithResult(
FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
FROM_HERE,
// USER_BLOCKING because it is on the critical path of displaying the
// official virtual keyboard on Chrome OS. https://crbug.com/976542
{base::MayBlock(), base::TaskPriority::USER_BLOCKING},
base::Bind(OpenNaClReadExecImpl, file_path, true /* is_executable */),
base::Bind(&NaClProcessHost::FileResolved, weak_factory_.GetWeakPtr(),
file_token_lo, file_token_hi, file_path));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment