Change IdentityManager to forward SigninManager callbacks synchronously
When we first built out the IdentityManager C++ class and backed it via //components/signin classes, we wanted its interaction with those classes to mimic eventual interaction with the Identity Service as much as possible. As part of this design goal, we implemented it to handle callbacks from SigninManager by posting tasks to set its internal state and notify observers; this mimics the fact of receiving these notifications asynchronously from the Identity Service. This mimicking has proven useful, as it has ferreted out issues with tests assuming that signin state can be changed and have those changes observed synchronously. However, it has also proven problematic: 1. By delaying the change to IdentityManager's internal state, we could end up with clients getting inconsistent views of the user's signin state from SigninManager and IdentityManager (cf. crbug.com/804410). 2. We then changed IdentityManager to change its internal state before SigninManager sends its callbacks, but still delay notifying its (IdentityManager's) observers by posting a task. However, we have gotten feedback from developers of clients of IdentityManager that this behavior is problematic semantically: these developers want to be able to make changes to internal state in response to IdentityManager callbacks and have the invariant that those changes to internal state are made atomically with the change in IdentityManager's internal state. By decoupling the change in IdentityManager's internal state from the notification of its observers, these developers are forced to handle additional intermediate states in their code (e.g., "IdentityManager has changed to have the user be signed in but hasn't yet notified its observers"). In consequence of (1) and (2), we are abandoning the asynchronous notification at this time. However, once the codebase is converted away from direct usage of SigninManager entirely to IdentityManager, it could be a good idea to reintroduce the implementation described in the top paragraph above; reintroducing that implementation would be a good intermediate move to switching in the Identity Service-backed implementation. This change should not introduce any behavioral changes, as nothing in the codebase relies on these callbacks being fired asynchronously (or is even aware that they're fired asynchronously). Bug: 843510 Change-Id: Id1bc40fccbe1c4481d0c4968f90d7c15d1af154a Reviewed-on: https://chromium-review.googlesource.com/1061494 Commit-Queue: Colin Blundell <blundell@chromium.org> Reviewed-by:Sylvain Defresne <sdefresne@chromium.org> Reviewed-by:
Marc Treib <treib@chromium.org> Cr-Commit-Position: refs/heads/master@{#559134}
Showing
Please register or sign in to comment