Commit d4d76b8d authored by fdoray's avatar fdoray Committed by Commit bot

Use TaskScheduler instead of WorkerPool in xkb_keyboard_layout_engine.cc.

The following traits are used:

Priority: Inherited (default)
  The priority is inherited from the calling context (i.e. TaskTraits
  are initialized with the priority of the current task).

Shutdown behavior: CONTINUE_ON_SHUTDOWN
  Tasks posted with this mode which have not started executing before
  shutdown is initiated will never run. Tasks with this mode running at
  shutdown will be ignored (the worker will not be joined).

  Note: Tasks that were previously posted to base::WorkerPool should
  use this shutdown behavior because this is how base::WorkerPool
  handles all its tasks.

May Block:
  Tasks posted with MayBlock() may block. This includes but is not
  limited to tasks that wait on synchronous file I/O operations:
  read or write a file from disk, interact with a pipe or a socket,
  rename or delete a file, enumerate files in a directory, etc. This
  trait isn't required for the mere use of locks.

BUG=659191

Review-Url: https://codereview.chromium.org/2611473002
Cr-Commit-Position: refs/heads/master@{#441428}
parent 185c9436
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
#include "base/memory/free_deleter.h" #include "base/memory/free_deleter.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/task_runner.h" #include "base/task_runner.h"
#include "base/task_scheduler/post_task.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "base/threading/worker_pool.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "ui/events/event_constants.h" #include "ui/events/event_constants.h"
#include "ui/events/keycodes/dom/dom_code.h" #include "ui/events/keycodes/dom/dom_code.h"
...@@ -685,11 +685,13 @@ bool XkbKeyboardLayoutEngine::SetCurrentLayoutByName( ...@@ -685,11 +685,13 @@ bool XkbKeyboardLayoutEngine::SetCurrentLayoutByName(
} }
LoadKeymapCallback reply_callback = base::Bind( LoadKeymapCallback reply_callback = base::Bind(
&XkbKeyboardLayoutEngine::OnKeymapLoaded, weak_ptr_factory_.GetWeakPtr()); &XkbKeyboardLayoutEngine::OnKeymapLoaded, weak_ptr_factory_.GetWeakPtr());
base::WorkerPool::PostTask( base::PostTaskWithTraits(
FROM_HERE, FROM_HERE, base::TaskTraits()
.WithShutdownBehavior(
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
.MayBlock(),
base::Bind(&LoadKeymap, layout_name, base::ThreadTaskRunnerHandle::Get(), base::Bind(&LoadKeymap, layout_name, base::ThreadTaskRunnerHandle::Get(),
reply_callback), reply_callback));
true);
return true; return true;
#else #else
// Required by ozone-wayland (at least) for non ChromeOS builds. See // Required by ozone-wayland (at least) for non ChromeOS builds. See
......
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