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

Add a feature flag for controlling Android downloadable fonts matching

Wire it from content::features to a Blink RuntimeEnabledFeature in order
to enable potential A/B testing for this font retrieval path.

Bug: 1115064
Change-Id: I81fb92591b7a78b3a136205d4863a423e003ab9b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2416380Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Dominik Röttsches <drott@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808284}
parent 578e5c09
...@@ -358,6 +358,8 @@ void SetRuntimeFeaturesFromChromiumFeatures() { ...@@ -358,6 +358,8 @@ void SetRuntimeFeaturesFromChromiumFeatures() {
kEnableOnly}, kEnableOnly},
{"AllowContentInitiatedDataUrlNavigations", {"AllowContentInitiatedDataUrlNavigations",
features::kAllowContentInitiatedDataUrlNavigations, kDefault}, features::kAllowContentInitiatedDataUrlNavigations, kDefault},
{"AndroidDownloadableFontsMatching",
features::kAndroidDownloadableFontsMatching, kDefault},
{"AudioWorkletRealtimeThread", {"AudioWorkletRealtimeThread",
blink::features::kAudioWorkletRealtimeThread, kEnableOnly}, blink::features::kAudioWorkletRealtimeThread, kEnableOnly},
{"BlockCredentialedSubresources", {"BlockCredentialedSubresources",
......
...@@ -41,6 +41,11 @@ const base::Feature kAllowSignedHTTPExchangeCertsWithoutExtension{ ...@@ -41,6 +41,11 @@ const base::Feature kAllowSignedHTTPExchangeCertsWithoutExtension{
"AllowSignedHTTPExchangeCertsWithoutExtension", "AllowSignedHTTPExchangeCertsWithoutExtension",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
// Allows Blink to request fonts from the Android Downloadable Fonts API through
// the service implemented on the Java side.
const base::Feature kAndroidDownloadableFontsMatching{
"AndroidDownloadableFontsMatching", base::FEATURE_ENABLED_BY_DEFAULT};
// Launches the audio service on the browser startup. // Launches the audio service on the browser startup.
const base::Feature kAudioServiceLaunchOnStartup{ const base::Feature kAudioServiceLaunchOnStartup{
"AudioServiceLaunchOnStartup", base::FEATURE_DISABLED_BY_DEFAULT}; "AudioServiceLaunchOnStartup", base::FEATURE_DISABLED_BY_DEFAULT};
......
...@@ -20,6 +20,7 @@ CONTENT_EXPORT extern const base::Feature kAllowActivationDelegationAttr; ...@@ -20,6 +20,7 @@ CONTENT_EXPORT extern const base::Feature kAllowActivationDelegationAttr;
CONTENT_EXPORT extern const base::Feature CONTENT_EXPORT extern const base::Feature
kAllowContentInitiatedDataUrlNavigations; kAllowContentInitiatedDataUrlNavigations;
CONTENT_EXPORT extern const base::Feature kAllowPopupsDuringPageUnload; CONTENT_EXPORT extern const base::Feature kAllowPopupsDuringPageUnload;
CONTENT_EXPORT extern const base::Feature kAndroidDownloadableFontsMatching;
CONTENT_EXPORT extern const base::Feature CONTENT_EXPORT extern const base::Feature
kAllowSignedHTTPExchangeCertsWithoutExtension; kAllowSignedHTTPExchangeCertsWithoutExtension;
CONTENT_EXPORT extern const base::Feature kAudioServiceLaunchOnStartup; CONTENT_EXPORT extern const base::Feature kAudioServiceLaunchOnStartup;
......
...@@ -84,11 +84,17 @@ sk_sp<SkTypeface> FontUniqueNameLookupAndroid::MatchUniqueName( ...@@ -84,11 +84,17 @@ sk_sp<SkTypeface> FontUniqueNameLookupAndroid::MatchUniqueName(
MatchUniqueNameFromFirmwareFonts(font_unique_name); MatchUniqueNameFromFirmwareFonts(font_unique_name);
if (result_font) if (result_font)
return result_font; return result_font;
return MatchUniqueNameFromDownloadableFonts(font_unique_name); if (RuntimeEnabledFeatures::AndroidDownloadableFontsMatchingEnabled()) {
return MatchUniqueNameFromDownloadableFonts(font_unique_name);
} else {
return nullptr;
}
} }
void FontUniqueNameLookupAndroid::EnsureServiceConnected() { void FontUniqueNameLookupAndroid::EnsureServiceConnected() {
if (firmware_font_lookup_service_ && android_font_lookup_service_) if (firmware_font_lookup_service_ &&
(!RuntimeEnabledFeatures::AndroidDownloadableFontsMatchingEnabled() ||
android_font_lookup_service_))
return; return;
if (!firmware_font_lookup_service_) { if (!firmware_font_lookup_service_) {
...@@ -96,7 +102,8 @@ void FontUniqueNameLookupAndroid::EnsureServiceConnected() { ...@@ -96,7 +102,8 @@ void FontUniqueNameLookupAndroid::EnsureServiceConnected() {
firmware_font_lookup_service_.BindNewPipeAndPassReceiver()); firmware_font_lookup_service_.BindNewPipeAndPassReceiver());
} }
if (!android_font_lookup_service_) { if (RuntimeEnabledFeatures::AndroidDownloadableFontsMatchingEnabled() &&
!android_font_lookup_service_) {
Platform::Current()->GetBrowserInterfaceBroker()->GetInterface( Platform::Current()->GetBrowserInterfaceBroker()->GetInterface(
android_font_lookup_service_.BindNewPipeAndPassReceiver()); android_font_lookup_service_.BindNewPipeAndPassReceiver());
} }
......
...@@ -150,6 +150,9 @@ ...@@ -150,6 +150,9 @@
name: "AllowSyncXHRInPageDismissal", name: "AllowSyncXHRInPageDismissal",
origin_trial_feature_name: "AllowSyncXHRInPageDismissal", origin_trial_feature_name: "AllowSyncXHRInPageDismissal",
}, },
{
name: "AndroidDownloadableFontsMatching",
},
{ {
name: "AnimationWorklet", name: "AnimationWorklet",
status: "experimental", status: "experimental",
......
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