Add a list of BackgroundFetchRecord objects to BackgroundFetchRegistration.
When we allow access to active background fetches, BackgroundFetchRecords for the fetch can be accessed from multiple places. It simplifies matters if we return the same record for a request whenever it's accessed. This CL adds a (private) list of BackgroundFetchRecords to the BackgroundFetchRegistration object, and updates it every time match and matchAll() are called. The second change introduced here is to not immediately resolve responseReady() if the fetch is active and a response for the request isn't yet available. Once the fetch has completed, or there's a response available for the request, we resolve pending promises. We also make sure to return the same promise (resolved or unresolved) for a given record, every time responseReady is called. For a more detailed discussion, see the following doc: https://docs.google.com/document/d/1CrbWrnnshhyp_SfiAeuODpnQX36GK3Bsi19rXQGez6Q/edit?usp=sharing Bug: 875201 Change-Id: I8cb386efd19086c0993ad2be2fb2691ad90597ec Reviewed-on: https://chromium-review.googlesource.com/c/1336151 Commit-Queue: Mugdha Lakhani <nator@chromium.org> Reviewed-by:Rayan Kanso <rayankans@chromium.org> Reviewed-by:
Peter Beverloo <peter@chromium.org> Cr-Commit-Position: refs/heads/master@{#610410}
Showing
Please register or sign in to comment