commit | 74bc832a3f961bb28eab4cb227cd6ff2dc781fc7 | [log] [tgz] |
---|---|---|
author | Dominick Ng <dominickn@chromium.org> | Wed Oct 31 04:45:51 2018 |
committer | Commit Bot <commit-bot@chromium.org> | Wed Oct 31 04:45:51 2018 |
tree | e05439334f040767ca66c33594ca93ab2420fe91 | |
parent | e3eddb5b598fa1d4a3b2e8989be77fbabdb1fffb [diff] |
Make SiteEngagementService::RecordMetrics less expensive on the UI thread. RecordMetrics() is called after browser startup and then no more than once per hour of browser use. It must fetch all site engagement content settings and calculate statistics over them, and on some Android devices it blocks the UI thread for 2500ms. This is bad since Android will kill the browser if the UI thread is busy for more than 5 seconds. This CL refactors the method to make it less expensive. In particular: - a duplicate call to SiteEngagementService::GetAllDetails is eliminated - SiteEngagementService::GetAllDetails (the fetch method) is refactored so that it may be run as a background task to free the UI thread. This involved eliminating all calls to HostContentSettingsMapFactory::GetForProfile as this method DCHECKs that it is on the UI thread. After this CL, SiteEngagementService::GetAllDetails() is called once in SiteEngagementService::RecordMetrics(), and that one call happens on a background thread. Other callers to the method continue to call it on the UI thread; future work may convert the method to be callback-driven so that it is never called on the UI thread. BUG=900022 Change-Id: Ie661b915891ddf981ac4a3049e8e96b73b23684d Reviewed-on: https://chromium-review.googlesource.com/c/1307018 Commit-Queue: Dominick Ng <dominickn@chromium.org> Reviewed-by: calamity <calamity@chromium.org> Cr-Commit-Position: refs/heads/master@{#604156}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .