• pavely@chromium.org's avatar
    Report InvalidatorState correctly from GCMNetworkChannel · afff175b
    pavely@chromium.org authored
    The problem:
    Sync observes Invalidator state to decide whenever to use PreCommit GU
    optimization, therefore INVALIDATIONS_ENABLED should be reported only
    when it is certain that communication channel between client and
    invalidations server works both ways.
    SyncNetworkChannel::NotifyStateChange is currently used for two purposes:
    - Notify observers of invalidations about InvalidatorState
    - Nudge cacheinvalidations to send heartbeat on network status change.
    Because of this dual purpose it is called with INVALIDATIONS_ENABLED when
    network status changes. In this case sync is notified that invalidations
    are enabled while there is no GCM connection established.
    
    Solution:
    - Separate two purposes into separate functions and call them appropriately
    - Only set INVALIDATIONS_ENABLED when it is confirmed that both http and
    gcm channels are working.
    
    BUG=377911
    R=rlarocque@chromium.org,zea@chromium.org
    
    Review URL: https://codereview.chromium.org/348503002
    
    git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278597 0039d316-1c4b-4281-b951-d872f2087c98
    afff175b
push_client_channel.cc 5.38 KB