• jdduke's avatar
    Throttle resource message requests during user interaction · 94ae1f37
    jdduke authored
    Resource message requests can be relatively expensive, particularly in
    the induced work on the browser IO thread. Currently, there is no bound
    on the rate with which such requests are dispatched from the renderer.
    This leads to situations where the browser IO thread is flooded with
    requests, potentially causing scroll jank and otherwise undesirable
    stalls in the browser pipeline.
    
    Introduce a ResourceMessageThrottler which intercepts and defers a given
    resource message stream, depending on the state of the RendererScheduler.
    When the RendererScheduler indicates that high priority work is
    imminent/likely, requests will be throttled according to a configurable
    dispatch rate.
    
    Hook this throttling mechanism up to the ResourceDispatcher, limiting
    the number of resource message requests/second during user interaction
    to 180 (3 per frame at 60 fps) on Android, and 480 on desktop.
    
    See goo.gl/H42AgQ for more design details.
    
    Note: This change originally landed in
    https://crrev.com/acfb4199abf841a1577c3968579c43b0232a53b7, but was
    reverted due to issues with enforced ThreadChecker validation in
    RendererSchedulerImpl. The ThreadChecker validation fix has been split
    into a separate patch.
    
    BUG=440037,402136
    
    Review URL: https://codereview.chromium.org/847883002
    
    Cr-Commit-Position: refs/heads/master@{#314767}
    94ae1f37
fake_renderer_scheduler.cc 1.3 KB