Address race condition between IPC and font lookup table getting ready

If a renderer asks for the font lookup table asynchronously using
GetUniqueNameLookupTableIfAvailable and recevied the information that
it's not ready yet, then queues a callback for receiving it, but the
font table has become ready in between, callbacks may be missed. Cover
for the situation in QueueShareMemoryRegionWhenReady() by posting
callbacks if the table was already prepared. We cannot DCHECK on
!font_table_built_.IsSignaled() as there is a small time window in which
the table gets ready between the two IPCs reaching the browser process.

Bug: 977283
Tbr: pkasting
Change-Id: I9e7b8d7b9a7afe761a5a0e9d11c894eedc0e452a
Reviewed-by: Dominik Röttsches <>
Reviewed-by: Rune Lillesveen <>
Commit-Queue: Dominik Röttsches <>
Cr-Commit-Position: refs/heads/master@{#672056}
diff --git a/chrome/browser/ui/ b/chrome/browser/ui/
index 488e069..d603265 100644
--- a/chrome/browser/ui/
+++ b/chrome/browser/ui/
@@ -1435,9 +1435,8 @@
-// Flaky
-                       DISABLED_NavigateFromDefaultToOptionsInSameTab) {
+                       NavigateFromDefaultToOptionsInSameTab) {
     content::WindowedNotificationObserver observer(
diff --git a/content/browser/renderer_host/ b/content/browser/renderer_host/
index 11c8ee1..8bfb6b9 100644
--- a/content/browser/renderer_host/
+++ b/content/browser/renderer_host/
@@ -335,9 +335,12 @@
-  // TODO( Triggers in tests causing flakiness.
-  // DCHECK(!font_table_built_.IsSignaled());
   pending_callbacks_.emplace_back(std::move(task_runner), std::move(callback));
+  // Cover for the condition in which the font table becomes ready briefly after
+  // a renderer asking for GetUniqueNameLookupTableIfAvailable(), receiving the
+  // information that it wasn't ready.
+  if (font_table_built_.IsSignaled())
+    PostCallbacks();
 bool DWriteFontLookupTableBuilder::FontUniqueNameTableReady() {