commit | 46bc05dddd16f2325fc804a20cd97acef9ce491a | [log] [tgz] |
---|---|---|
author | Erik Chen <erikchen@chromium.org> | Mon Jun 02 06:39:16 2025 |
committer | Chromium LUCI CQ <chromium-scoped@luci-project-accounts.iam.gserviceaccount.com> | Mon Jun 02 06:39:16 2025 |
tree | 1e0c58fc3dcfebb15e234a18329b5e5cf3654aa5 | |
parent | 81bcdde8c74ef18071cfbbaaa8e7a161e702daa4 [diff] |
Fix FocusedTabData. This data structure had several problems: (1) It kept a WeakPtr<WebContents>. This means that it was possible for a FocusedTabData to have neither a WebContents nor an error message. Instead FocusedTabData should use a raw_ptr and FocusedTabData should not be copied/stored. (2) It referenced a std::string_view, which is not guaranteed to be valid if the data structure is copied/stored. Conceptually the problem is that FocusedTabData is used for two different purposes: it's used for internal accounting for GlicFocusedTabManager, and it's used by consumers to get TabInterface or error string/unfocused tab. These use cases have different requirements and mixing them together caused confusion. This CL is the smallest possible CL that fixes these problems. It takes the existing two data structures and makes them inner classes of GlicFocusedTabManager. FocusedTabData is renamed FocusedTabDataImpl. A new class FocusedTabData is created which has exactly one of tabs::TabInterface* or std::string error + unfocused tab. The callbacks that vend FocusedTabData now vend a const ref. Many further improvements are possible, but this CL does not attempt to make them. Bug: /411462297 Change-Id: I150747e1e81295090fbfa30b3292556bcd87a783 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6607087 Commit-Queue: Erik Chen <erikchen@chromium.org> Reviewed-by: Ian Vollick <vollick@chromium.org> Cr-Commit-Position: refs/heads/main@{#1467965}
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.