• Robert Ogden's avatar
    Plumb prefetch results in IsolatedPrerender Metrics Collector · d17049f1
    Robert Ogden authored
    Also transitions the origin prober over to using the new probe result
    enum so that it can be passed to the metrics collector.
    
    ScopedRefPtr:
    The metrics collector uses a scoped ref ptr to manage its lifetime.
    For mainframe prefetching, the TabHelper has the only refptr to the
    collector. But during NSP, the refptr is shared to every subresource
    manager that is created.
    If the next navigation does not go to a prefetched page, all subresource
    managers are destroyed, as well as the TabHelper's CurrentPageLoad class
    which destroys the metrics collector. Since there would not be any
    cache reuse to record in the metrics, it can be safely destroyed then.
    If the next navigation goes to a prefetched page, then all refptrs to
    the metrics collector will be destroyed, except for the one in the
    subresource manager associated with that page. This allows the
    subresource manager to record cache reuse directly, without relying on
    the TabHelper to make some lifetime guarantee about the metrics
    collector.
    Furthermore, this pattern keeps the cache reuse logic out of the
    TabHelper when it is already isolated to the subresource manager.
    
    Bug: 1136174
    Change-Id: I4e0e52acb8f99a1490f67d98b44329f997e40720
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2463544
    Commit-Queue: Robert Ogden <robertogden@chromium.org>
    Reviewed-by: default avatarRyan Sturm <ryansturm@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#818670}
    d17049f1
isolated_prerender_tab_helper.cc 50.7 KB