• Darin Fisher's avatar
    Refactor renderer-side prerender code. · 42ca349a
    Darin Fisher authored
    This change teases apart the code that runs in a renderer that observes
    link tags from the code that runs in a renderer used to perform no-state
    prefetching. That translates to moving the PrefetchFinished signal from
    PrerenderDispatcher to PrerenderHelper.
    
    This change also goes one step further and, recognizing that
    PrerenderHelper is a RenderFrameObserver, ditches the PrefetchFinished
    method on WebPrerenderingSupport in favor of just observing
    DidFinishDocumentLoad (aka DOMContentLoaded). The timing of the two
    signals is approximately the same and for what the no-state prefetching
    code requires, this seems sufficient.
    
    URLLoaderThrottleProvider is simplified by moving most of the logic
    associated with creating the PrerenderURLLoaderThrottle moved into
    PrerenderHelper, further consolidating logic around the throttles (again
    used only by the renderer process being used to drive the no-state
    prefetch).
    
    There's a slight change to the calculation of the start time for the
    parse time histogram. It should not be material, and if anything, this
    should be a less errorprone way of calculating it. Having it align to
    the creation of the PrerenderHelper means that we aren't reliant on
    prefetch happening in a newly created process to have a properly
    computed start time. Hopefully this change does not goof up any metrics.
    
    This CL sets the stage for onion-souping the renderer code used to
    observe link tags, kick-off prefetches and observe their activity. We
    should be able to eliminate WebPrerenderingSupport and WebPrerender,
    for example.
    
    Change-Id: Ia337c74484d8ff9fd8e1fdb57f0a3e282a03b8df
    Bug: 967834
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2032424
    Commit-Queue: Darin Fisher <darin@chromium.org>
    Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
    Reviewed-by: default avatarRobert Ogden <robertogden@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#737559}
    42ca349a
prerender_dispatcher.h 2.54 KB