Strip disabled optimizations when parsing preview hints
The logic in PreviewsHints::CreateFromConfig() has been modified so that it now strips out optimizations that are disabled and only allows one of each optimization type within a PageHint. Duplicate types encountered are also stripped. This makes it so that enabling an experimental optimization will automatically disable a subsequent optimization of the same optimization type in the same PageHint. If all optimizations for a page hint are stripped, then the page hint is also stripped. This fixes a bug related to disabled page hint optimizations being usable, as the disabled optimizations will no longer exist in the hint cache. As a result of this change, when the total page hints with resource hints exceeds the cap, the number of page hints added will always exactly match the cap. This is due to the logic for stripping hints allowing us to add hints that only include some of their page hints. A DCHECK has been added verifying that non-resource loading hint optimizations never contain resource loading hints. Additionally, the description of |whitelisted_optimizations| for the PageHint proto has been updated to match expectations that it will be provided as an ordered list. Unittests have been added to verify that the stripping is handled properly and that the number of page hints allowed stops exactly at the cap. Some issues with unittests in PreviewsOptimizationGuideUnittest using InitializeMultipleResourceLoadingHints() have also been fixed. Bug: 900725, 900733 Change-Id: Ic8d8ce2de98e4e2993cab994906c3b2e43c31a22 Reviewed-on: https://chromium-review.googlesource.com/c/1311796Reviewed-by:Doug Arnett <dougarnett@chromium.org> Reviewed-by:
Tarun Bansal <tbansal@chromium.org> Commit-Queue: Jered Gray <jegray@chromium.org> Cr-Commit-Position: refs/heads/master@{#604773}
Showing
This diff is collapsed.
This diff is collapsed.
Please register or sign in to comment