Commit a7787963 authored by Dominik Röttsches's avatar Dominik Röttsches Committed by Commit Bot

Trigger font scanning at browser startup, not lazily on demand

Since font scanning is now an asynchronous, BEST_EFFORT priority task,
we should trigger it at startup so it may already be ready when a
renderer requests it. Previously, it was a synchronous task, triggered
by when a renderer requested the lookup table for the first
time. Triggering it at startup matches the approach we take on Windows 7
and 8.

Bug: 973394
Change-Id: I2e890058c538ed157217e98d1f4a0bdba639a602
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1681760Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Dominik Röttsches <drott@chromium.org>
Cr-Commit-Position: refs/heads/master@{#673386}
parent 90cf93ea
......@@ -165,6 +165,7 @@
#include "content/browser/android/launcher_thread.h"
#include "content/browser/android/scoped_surface_request_manager.h"
#include "content/browser/android/tracing_controller_android.h"
#include "content/browser/font_unique_name_lookup/font_unique_name_lookup.h"
#include "content/browser/screen_orientation/screen_orientation_delegate_android.h"
#include "media/base/android/media_drm_bridge_client.h"
#include "ui/android/screen_android.h"
......@@ -1433,6 +1434,9 @@ int BrowserMainLoop::BrowserThreadsStarted() {
#if defined(OS_ANDROID)
media::SetMediaDrmBridgeClient(GetContentClient()->GetMediaDrmBridgeClient());
if (base::FeatureList::IsEnabled(features::kFontSrcLocalMatching)) {
FontUniqueNameLookup::GetInstance();
}
#endif
#if defined(ENABLE_IPC_FUZZER)
......
......@@ -30,11 +30,12 @@ class CONTENT_EXPORT FontUniqueNameLookup {
public:
FontUniqueNameLookup() = delete;
// Retrieve an initialized instance of FontUniqueNameLookup that has read the
// table from cache if there was one, updated the lookup table if needed
// (i.e. if there was an Android firmware update) from the standard Android
// font directories, and written the updated lookup table back to file. It is
// ready to use with FontTableMatcher.
// Retrieve an instance of FontUniqueNameLookup. On the first call to
// GetInstance() this that will start a task reading the lookup table from
// cache if there was a cached one, updating the lookup table if needed
// (i.e. if there was an Android firmware update or no cached one existed)
// from the standard Android font directories, and writing the updated lookup
// table back to file.
static FontUniqueNameLookup& GetInstance();
// Construct a FontUniqueNameLookup given a cache directory path
......
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