Commit 7c8a57db authored by Matthias Körber's avatar Matthias Körber Committed by Commit Bot

[Autofill] Remove finch guards for cache-based improvements

Change-Id: Id85a0ae43cdfab09a4bcc7bf31024b7f19e74c46
Bug: 1100231
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2507654
Commit-Queue: Matthias Körber <koerber@google.com>
Reviewed-by: default avatarChristoph Schwering <schwering@google.com>
Cr-Commit-Position: refs/heads/master@{#823156}
parent 1b2b285f
...@@ -103,17 +103,11 @@ void AutofillHandler::OnFormsSeen(const std::vector<FormData>& forms, ...@@ -103,17 +103,11 @@ void AutofillHandler::OnFormsSeen(const std::vector<FormData>& forms,
// code would have ignored the cache hit we update the FormStructure's // code would have ignored the cache hit we update the FormStructure's
// FormSignature. // FormSignature.
// Otherwise, if the experiment disabled, we just ignore the cache hit. // Otherwise, if the experiment disabled, we just ignore the cache hit.
//
// TODO(crbug.com/1100231) Clean up when experiment is complete.
const bool kOldBehavior = !base::FeatureList::IsEnabled(
features::kAutofillKeepInitialFormValuesInCache);
bool update_form_signature = false; bool update_form_signature = false;
if (cached_form_structure) { if (cached_form_structure) {
for (const FormType& form_type : cached_form_structure->GetFormTypes()) { for (const FormType& form_type : cached_form_structure->GetFormTypes()) {
if (form_type != CREDIT_CARD_FORM) { if (form_type != CREDIT_CARD_FORM) {
update_form_signature = true; update_form_signature = true;
if (kOldBehavior)
cached_form_structure = nullptr;
break; break;
} }
} }
...@@ -124,7 +118,7 @@ void AutofillHandler::OnFormsSeen(const std::vector<FormData>& forms, ...@@ -124,7 +118,7 @@ void AutofillHandler::OnFormsSeen(const std::vector<FormData>& forms,
continue; continue;
DCHECK(form_structure); DCHECK(form_structure);
if (update_form_signature && !kOldBehavior) if (update_form_signature)
form_structure->set_form_signature(CalculateFormSignature(form)); form_structure->set_form_signature(CalculateFormSignature(form));
new_forms.push_back(&form); new_forms.push_back(&form);
......
...@@ -1089,10 +1089,7 @@ void FormStructure::RetrieveFromCache( ...@@ -1089,10 +1089,7 @@ void FormStructure::RetrieveFromCache(
// If the unique renderer id (or the name) is not stable due to some Java // If the unique renderer id (or the name) is not stable due to some Java
// Script magic in the website, use the field signature as a fallback // Script magic in the website, use the field signature as a fallback
// solution to find the field in the cached form. // solution to find the field in the cached form.
// TODO(crbug.com/1125624): Remove feature check once trial ended. if (!cached_field) {
if (!cached_field &&
base::FeatureList::IsEnabled(
features::kAutofillRetrieveFromCacheWithFieldSignatureAsFallback)) {
// Iterates over the fields to find the field with the same form // Iterates over the fields to find the field with the same form
// signature. // signature.
for (size_t i = 0; i < cached_form.field_count(); ++i) { for (size_t i = 0; i < cached_form.field_count(); ++i) {
...@@ -1125,13 +1122,7 @@ void FormStructure::RetrieveFromCache( ...@@ -1125,13 +1122,7 @@ void FormStructure::RetrieveFromCache(
field->is_autofilled = cached_field->is_autofilled; field->is_autofilled = cached_field->is_autofilled;
} }
if (field->form_control_type != "select-one") { if (field->form_control_type != "select-one") {
bool is_credit_card_field = if (should_keep_cached_value) {
AutofillType(cached_field->Type().GetStorableType()).group() ==
CREDIT_CARD;
if (should_keep_cached_value &&
(is_credit_card_field ||
base::FeatureList::IsEnabled(
features::kAutofillKeepInitialFormValuesInCache))) {
field->value = cached_field->value; field->value = cached_field->value;
value_from_dynamic_change_form_ = true; value_from_dynamic_change_form_ = true;
} else if (field->value == cached_field->value && } else if (field->value == cached_field->value &&
......
...@@ -151,24 +151,12 @@ const base::Feature kAutofillExtractAllDatalists{ ...@@ -151,24 +151,12 @@ const base::Feature kAutofillExtractAllDatalists{
const base::Feature kAutofillFixFillableFieldTypes{ const base::Feature kAutofillFixFillableFieldTypes{
"AutofillFixFillableFieldTypes", base::FEATURE_DISABLED_BY_DEFAULT}; "AutofillFixFillableFieldTypes", base::FEATURE_DISABLED_BY_DEFAULT};
// When enabled, Autofill keeps the initial field values in the |FormStructure|
// cache for all field types.
const base::Feature kAutofillKeepInitialFormValuesInCache{
"AutofillKeepCachedFormValues", base::FEATURE_ENABLED_BY_DEFAULT};
// When enabled, Autofill will use FieldRendererIds instead of unique_names // When enabled, Autofill will use FieldRendererIds instead of unique_names
// to align forms in FormStructure::RetrieveFromCache(). // to align forms in FormStructure::RetrieveFromCache().
const base::Feature kAutofillRetrieveFromCacheWithRendererIds{ const base::Feature kAutofillRetrieveFromCacheWithRendererIds{
"AutofillRetrieveFromCacheWithRendererIds", "AutofillRetrieveFromCacheWithRendererIds",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
// When enabled, Autofill will try to retrieve cached fields by signatures as a
// fallback that is useful if unique renderer ids are unstable.
// TODO(crbug.com/1125624): Remove experiment once trial ended.
const base::Feature kAutofillRetrieveFromCacheWithFieldSignatureAsFallback{
"AutofillRetrieveFromCacheWithFieldSignatureAsFallback",
base::FEATURE_DISABLED_BY_DEFAULT};
// When enabled, autofill suggestions are displayed in the keyboard accessory // When enabled, autofill suggestions are displayed in the keyboard accessory
// instead of the regular popup. // instead of the regular popup.
const base::Feature kAutofillKeyboardAccessory{ const base::Feature kAutofillKeyboardAccessory{
......
...@@ -45,10 +45,7 @@ extern const base::Feature kAutofillEnforceMinRequiredFieldsForQuery; ...@@ -45,10 +45,7 @@ extern const base::Feature kAutofillEnforceMinRequiredFieldsForQuery;
extern const base::Feature kAutofillEnforceMinRequiredFieldsForUpload; extern const base::Feature kAutofillEnforceMinRequiredFieldsForUpload;
extern const base::Feature kAutofillExtractAllDatalists; extern const base::Feature kAutofillExtractAllDatalists;
extern const base::Feature kAutofillFixFillableFieldTypes; extern const base::Feature kAutofillFixFillableFieldTypes;
extern const base::Feature kAutofillKeepInitialFormValuesInCache;
extern const base::Feature kAutofillRetrieveFromCacheWithRendererIds; extern const base::Feature kAutofillRetrieveFromCacheWithRendererIds;
extern const base::Feature
kAutofillRetrieveFromCacheWithFieldSignatureAsFallback;
extern const base::Feature kAutofillKeyboardAccessory; extern const base::Feature kAutofillKeyboardAccessory;
extern const base::Feature kAutofillLabelAffixRemoval; extern const base::Feature kAutofillLabelAffixRemoval;
extern const base::Feature kAutofillPruneSuggestions; extern const base::Feature kAutofillPruneSuggestions;
......
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