alloy: Move ExtensionsBrowserClient ownership to BrowserProcess (fixes issue #3247)

Fixes a shutdown crash due to `ExtensionsBrowserClient::Set(nullptr)` being
called too early. Some code that may occasionally be triggered via
`content::ContentMainShutdown()` is expecting the extensions objects to still
be valid.

This new ownership pattern matches the code in chrome/.
This commit is contained in:
Marshall Greenblatt
2022-01-28 16:16:29 -05:00
parent 81e7748fb5
commit 9eb0954cde
4 changed files with 30 additions and 23 deletions

View File

@ -15,11 +15,6 @@
#include "content/public/browser/browser_main_parts.h"
#include "content/public/common/main_function_params.h"
namespace extensions {
class ExtensionsBrowserClient;
class ExtensionsClient;
} // namespace extensions
#if defined(USE_AURA)
namespace display {
class Screen;
@ -84,10 +79,6 @@ class AlloyBrowserMainParts : public content::BrowserMainParts {
CefRefPtr<CefRequestContextImpl> global_request_context_;
CefDevToolsDelegate* devtools_delegate_ = nullptr; // Deletes itself.
std::unique_ptr<extensions::ExtensionsClient> extensions_client_;
std::unique_ptr<extensions::ExtensionsBrowserClient>
extensions_browser_client_;
// Blocking task runners exposed via CefTaskRunner. For consistency with
// previous named thread behavior always execute all pending tasks before
// shutdown (e.g. to make sure critical data is saved to disk).