Make future changes to PrefetchItemState elements safer.
Introduce new code patterns to improve the likeliness that future changes to the elements of PrefetchItemState will be properly handled. A new |kOrderedPrefetchItemStates| complements the enum definition by providing the full listing of existing states. A new test also checks that changes to the enum are reflected in this listing. The implementation of GetAllStatesExcept was updated to use this official state list and accept a collection of states to filter from its result. New calls to this function were also added from tests where created a local listing of arbitrary states, what should guarantee that new or changed state values would have to be dealt with. Finally uses of `default` in switch blocks for PrefetchItemState were replaced with the full listing of all possible states so that build errors would guide the proper handling of all states. Bug: 701939 Change-Id: I2f303c6922795f509f8046000fdd286c5e0affa9 Reviewed-on: https://chromium-review.googlesource.com/937944 Commit-Queue: Carlos Knippschild <carlosk@chromium.org> Reviewed-by:Justin DeWitt <dewittj@chromium.org> Cr-Commit-Position: refs/heads/master@{#539995}
Showing
Please register or sign in to comment