• Pavol Marko's avatar
    Improve PolicyService initialization throttling · 9763fae4
    Pavol Marko authored
    Instead of using SetInitializationThrottled(bool), initialization
    throttling of a PolicyServiceImpl can only be activated at construction
    time using CreateWithInitilizationThrottled and deactivated using
    UnthrottleInitialization. This is clearer and guarantees that the state
    of the service is consistent even when all PolicyProviders are already
    initialized at construction time.
    
    To be able to implement this properly, the meaning of the
    |initialization_complete_| variable had to be changed - it can now be
    true even when initialization is throttled. Initialization throttling
    only means that observers are not notified yet.
    
    Also add unit tests to test the behavior of initialization throttling.
    
    Planned follow-up changes:
    (*) Timeout to abort initialization throttling after a few seconds to
        protect against coding error.
    (*) UMA stat to track initialization throttling time.
    
    Bug: 982936, 1002066
    Test: browser_test still pass, new components_unittests test
    
    Change-Id: I32eb7fbac1746d25ab650ba0969e6cb7a1a22241
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1798324Reviewed-by: default avatarLutz Justen <ljusten@chromium.org>
    Commit-Queue: Pavol Marko <pmarko@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#700174}
    9763fae4
profile_policy_connector.h 6.19 KB