• A Olsen's avatar
    StubCrosSettingsProvider: Fix infinite loop risk · dfba2ada
    A Olsen authored
    There is no circumstance in which in an infinite loop actually ever
    happens - especially not in production which doesn't use
    StubCrosSettingsProvider - but in tests there is a bigger risk,
    and it is currently only narrowly avoided.
    
    This CL no longer notifies listeners when the value does not
    actually change, which should prevent infinite loops of the form
    where a listener tries to immediately write the same value
    after it is notified of a change to that value.
    
    See go/onsystemprefchanged for a longer explanation.
    
    (In a different CL I want to make a change that exposes this
    infinite loop problem, so I am fixing it first in this CL.)
    
    Change-Id: Ie47ac2db905a54c4d6244e06b54471c36454583d
    Reviewed-on: https://chromium-review.googlesource.com/c/1340305
    Commit-Queue: A Olsen <olsen@chromium.org>
    Reviewed-by: default avatarMaksim Ivanov <emaxx@chromium.org>
    Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#609270}
    dfba2ada
stub_cros_settings_provider.cc 2.97 KB