Cache top-frame site value in Document to reduce visited links latency When a blink::Document is constructed, this CL caches the value for top- frame origin and stores it as a net::SchemefulSite. This has performance benefits for the new partitioned :visited links model, as each link is stored as a triple key: <link url, top-level schemeful site, frame origin>. As a result, for each HTMLAnchorElement found in a Document, we must perform the relatively expensive conversion from TopFrameOrigin() to a net::SchemefulSite. By calculating this value once during construction, we reduce the amount of time spent constructing the triple key for each link in this Document. I chose to use a PassKey to limit access to this cached value to HTMLAnchorElementBase. When working in HTMLAnchorElementBase to determine the triple-keys for each link, we have certain benefits, such as a guarantee to be in a frame context where obtaining top-level site produces a valid, non-null value, and a guarantee that the cached top- level site will not become stale (if this happens the process is killed before we could style a link incorrectly). Limiting access to this function via passkey allows us to safely rely on these benefits. Finally, from pprof analysis, we can see that this decreases the amount of time spent in VisitedLinkState::DetermineLinkStateSlowCase by about 0.25%. For more information on why we are working to reduce latency in partitioned :visited links, visit the bug below. Bug: 372093900 Change-Id: Ifed3f1c0cb777efb765757b265213f7414962ca7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5949903 Reviewed-by: David Baron <dbaron@chromium.org> Commit-Queue: Kyra Seevers <kyraseevers@chromium.org> Cr-Commit-Position: refs/heads/main@{#1372040}
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.
To check out the source code locally, don't use git clone! Instead, follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure.
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.