[ProfilePicker] Fix profile statistics keep-alive lifecycle on delete When deleting a profile in the Profile Picker, `getProfileStatistics` loads unloaded profiles asynchronously via `LoadProfileByPath()` before initializing `profile_statistics_keep_alive_`. If the user confirms or cancels the remove confirmation dialog before `LoadProfileByPath()` completes (or if loading fails), `profile_statistics_keep_alive_` is null, and an in-flight `LoadProfileByPath()` callback could subsequently create and leak a `ScopedProfileKeepAlive`. Cancel in-flight statistics callbacks via a dedicated `WeakPtrFactory` in `OnJavascriptDisallowed()`, `HandleGetProfileStatistics()`, `HandleCloseProfileStatistics()`, and `HandleRemoveProfile()`, and tolerate a null `profile_statistics_keep_alive_` instead of `DCHECK`/`CHECK`-failing. Fixed: 576442273 Test: unit_tests --gtest_filter=ProfilePickerHandlerTest.* Test: browser_tests --gtest_filter=ProfilePickerCreationFlowBrowserTest.DeleteProfile* Change-Id: Ic9f814630fa3c51e3411aaa3184bfcccdbd083e0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8727574 Auto-Submit: David Roger <droger@chromium.org> Reviewed-by: Sasha Kunitskaya <saskekun@google.com> Reviewed-by: Monica Salama <msalama@chromium.org> Commit-Queue: David Roger <droger@chromium.org> Cr-Commit-Position: refs/heads/main@{#1740656}
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.