• Darin Fisher's avatar
    Cleanup plumbing of chrome::mojom::PrerenderCanceler · e41aab5f
    Darin Fisher authored
    Three changes:
    
    1- Avoid returning a raw pointer to chrome::mojom::PrerenderCanceler
       from GetPrerenderCanceller helper functions in favor returning a
       mojo::PendingRemote<chrome::mojom::PrerenderCanceler>. This avoids
       the need to schedule a DeleteSoon (in the renderer case) to cleanup
       the memory associated with that object later.
    
    2- By returning a mojo::PendingRemote<..> instead of a raw pointer to
       the interface, it is no longer necessary to manually PostTask before
       accessing that interface. A mojo::PendingRemote<..> can instead be
       bound to a mojo::Remote<..> that implicitly schedules function calls
       on the right thread. The PostTask is implicit.
    
    3- Make PrerenderContents support having multiple bound cancelers. This
       makes the above possible. In the renderer, the canceler is acquired
       immediately instead of lazily, and that is extra cost (an extra IPC)
       in the case where a canceler is not needed. This only happens for a
       page being prerendered, and so that overhead should be relatively
       small and seems worth the benefit of simple code.
    
    Change-Id: If43a1f6fa607f07eded8511639898ea99a023cd6
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2023358
    Commit-Queue: Darin Fisher <darin@chromium.org>
    Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
    Reviewed-by: default avatarRyan Sturm <ryansturm@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#736455}
    e41aab5f
prerender_url_loader_throttle.h 2.63 KB