Commit ddd78fc1 authored by Patrick Monette's avatar Patrick Monette Committed by Commit Bot

Boost thread priority when loading a DLL on a background thread

As described in the linked bug, loading DLL on a background thread may
cause a priority inversion on the loader lock. It is a common source of
jank in Chrome.

Bug: 973868
Change-Id: Ic375b0b4e94cca763f7c48ebb3c231ac5a1223a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2071960Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Commit-Queue: Patrick Monette <pmonette@chromium.org>
Cr-Commit-Position: refs/heads/master@{#744526}
parent 6ceacfa8
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "base/task/task_traits.h" #include "base/task/task_traits.h"
#include "base/threading/scoped_thread_priority.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "base/win/core_winrt_util.h" #include "base/win/core_winrt_util.h"
#include "base/win/post_async_results.h" #include "base/win/post_async_results.h"
...@@ -706,6 +707,10 @@ void BluetoothAdapterWinrt::InitForTests( ...@@ -706,6 +707,10 @@ void BluetoothAdapterWinrt::InitForTests(
// static // static
BluetoothAdapterWinrt::StaticsInterfaces BluetoothAdapterWinrt::StaticsInterfaces
BluetoothAdapterWinrt::PerformSlowInitTasks() { BluetoothAdapterWinrt::PerformSlowInitTasks() {
// Mitigate the issues caused by loading DLLs on a background thread
// (http://crbug/973868).
SCOPED_MAY_LOAD_LIBRARY_AT_BACKGROUND_PRIORITY();
if (!ResolveCoreWinRT()) if (!ResolveCoreWinRT())
return BluetoothAdapterWinrt::StaticsInterfaces(); return BluetoothAdapterWinrt::StaticsInterfaces();
......
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