Commit 821c5f7a authored by Reilly Grant's avatar Reilly Grant Committed by Commit Bot

[bluetooth] Boost priority while probing bthprops.cpl

The HasBluetoothStack() method checks if bthprops.cpl can be loaded.
This can take the dynamic library loader lock while on a background
thread and so an annotation is needed to temporarily boost thread
priority to avoid janking the main thread.

Noticed in crash/e8feafd49cc404d4.

Bug: 973868
Change-Id: I036ffacd5f22afa9a5493d746b2b1ada600ecfc6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2209133
Auto-Submit: Reilly Grant <reillyg@chromium.org>
Commit-Queue: Vincent Scheib <scheib@chromium.org>
Reviewed-by: default avatarVincent Scheib <scheib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#770323}
parent 832c793a
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "device/bluetooth/bluetooth_init_win.h" #include "device/bluetooth/bluetooth_init_win.h"
#include "base/threading/scoped_blocking_call.h" #include "base/threading/scoped_thread_priority.h"
namespace { namespace {
...@@ -28,8 +28,10 @@ bool HasBluetoothStack() { ...@@ -28,8 +28,10 @@ bool HasBluetoothStack() {
} has_bluetooth_stack = HBS_UNKNOWN; } has_bluetooth_stack = HBS_UNKNOWN;
if (has_bluetooth_stack == HBS_UNKNOWN) { if (has_bluetooth_stack == HBS_UNKNOWN) {
base::ScopedBlockingCall scoped_blocking_call( // Mitigate the issues caused by loading DLLs on a background thread
FROM_HERE, base::BlockingType::MAY_BLOCK); // (http://crbug/973868).
SCOPED_MAY_LOAD_LIBRARY_AT_BACKGROUND_PRIORITY_REPEATEDLY();
HRESULT hr = E_FAIL; HRESULT hr = E_FAIL;
__try { __try {
hr = __HrLoadAllImportsForDll("bthprops.cpl"); hr = __HrLoadAllImportsForDll("bthprops.cpl");
......
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