Commit ae1a0ae1 authored by Ken Rockot's avatar Ken Rockot Committed by Commit Bot

Fix threading issue with Font Service bindings

This ensures that content::ConnectToFontService() always posts binding
operations to the same SequencedTaskRunner rather than using an
arbitrary runner per call.

Bug: 995144
Change-Id: Ic6f3947f056f028cb2febec875dd26eb8b870e82
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1761555Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Commit-Queue: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#688640}
parent 35c07cfc
......@@ -266,14 +266,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest,
//
// The test then presses <tab> six times to cycle through focused elements 1-6.
// The test then repeats this with <shift-tab> to cycle in reverse order.
#if defined(THREAD_SANITIZER)
// TODO(crbug.com/995144): Fix the data race reported by TSan.
#define MAYBE_SequentialFocusNavigation DISABLED_SequentialFocusNavigation
#else
#define MAYBE_SequentialFocusNavigation SequentialFocusNavigation
#endif
IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest,
MAYBE_SequentialFocusNavigation) {
SequentialFocusNavigation) {
GURL main_url(embedded_test_server()->GetURL(
"a.com", "/cross_site_iframe_factory.html?a(b,c)"));
ui_test_utils::NavigateToURL(browser(), main_url);
......
......@@ -12,6 +12,14 @@ namespace content {
namespace {
base::SequencedTaskRunner* GetServiceTaskRunner() {
static base::NoDestructor<scoped_refptr<base::SequencedTaskRunner>>
task_runner{base::CreateSequencedTaskRunner(
{base::ThreadPool(), base::MayBlock(), base::WithBaseSyncPrimitives(),
base::TaskPriority::USER_BLOCKING})};
return task_runner->get();
}
void BindToBackgroundFontService(
mojo::PendingReceiver<font_service::mojom::FontService> receiver) {
static base::NoDestructor<font_service::FontServiceApp> service;
......@@ -22,11 +30,9 @@ void BindToBackgroundFontService(
void ConnectToFontService(
mojo::PendingReceiver<font_service::mojom::FontService> receiver) {
base::CreateSequencedTaskRunner({base::ThreadPool(), base::MayBlock(),
base::WithBaseSyncPrimitives(),
base::TaskPriority::USER_BLOCKING})
->PostTask(FROM_HERE, base::BindOnce(&BindToBackgroundFontService,
std::move(receiver)));
GetServiceTaskRunner()->PostTask(
FROM_HERE,
base::BindOnce(&BindToBackgroundFontService, std::move(receiver)));
}
} // namespace content
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