• Mugdha Lakhani's avatar
    [Background Sync] Wait for all syncs to complete. · 94ed56cc
    Mugdha Lakhani authored
    We currently wake the browser up and call FireReadyEvents() to fire any
    ready sync events, and then call the passed |callback|. Before this
    change, we were invoking the callback once all sync events had been
    fired. This CL waits till all those sync events have completed before
    running the callback.
    
    This will have the effect of keeping the browser awake until all sync
    events complete, and will add a few minutes to how long we hold the
    wakelock. It will give the browser a chance to finish processing
    (Periodic) Background Sync registrations and reduce the number of times
    we need to wake the browser up.
    
    This CL adds a new parameter to BackgroundSyncParameters to enable this
    functionality, so that we can run experiments using the existing
    'BackgroundSync' field trial before it's enabled everywhere.
    
    A unit test has also been added to verify the functionality.
    
    Bug: 933849, 932591
    Change-Id: Ica68f6bdb262dea2365334296ae825d91126c65b
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1807194
    Commit-Queue: Mugdha Lakhani <nator@chromium.org>
    Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
    Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
    Reviewed-by: default avatarRayan Kanso <rayankans@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#704489}
    94ed56cc
background_sync_parameters.cc 2.28 KB