Add ServiceWorkerContextWrapper::GetInstalledRegistrationOrigins
The purpose of introducing the method is to remove GetAllOriginsInfo() calls from ServiceWorkerQuotaClient. ServiceWorkerQuotaClient called GetAllOriginsInfo() to check if there are registrations for an origin. As explained in [1], GetAllOriginsInfo() could be very expensive when there are many origins that have service worker registrations. Instead of calling GetAllOriginsInfo(), we can use |registered_origins_| in ServiceWorkerContextWrapper to provide origins that have registrations. Using |registered_origins_| should be much faster than GetAllOriginsInfo() because we don't need to read all registrations from the database. Performance comparison: It seems that ServiceWorkerQuotaClient::GetOriginsForHost() is called for each origin which has registrations when chrome://settings is opened. In my local environment with 15k origins/registrations, time to finish getting all origins when chrome://settings is opened are: * with this CL: ~4 secs * without this CL: ~44 mins [1] https://docs.google.com/document/d/1iaQGQzovFVL3LxDiyIvVgEUFWMhzrXpdf_6TmuwIICA/edit?usp=sharing Bug: 807440 Change-Id: I804adf45292e9191482ff7f3c412ce03a0eb7bb8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2253259 Commit-Queue: Kenichi Ishibashi <bashi@chromium.org> Reviewed-by:Victor Costan <pwnall@chromium.org> Reviewed-by:
Matt Falkenhagen <falken@chromium.org> Cr-Commit-Position: refs/heads/master@{#781178}
Showing
Please register or sign in to comment