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

@ -18,6 +18,11 @@
#include "chrome/browser/extensions/event_router_forwarder.h"
#include "media/media_buildflags.h"
namespace extensions {
class ExtensionsBrowserClient;
class ExtensionsClient;
} // namespace extensions
class ChromeProfileManagerAlloy;
class BackgroundModeManager {
@ -112,6 +117,10 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
bool context_initialized_;
bool shutdown_;
std::unique_ptr<extensions::ExtensionsClient> extensions_client_;
std::unique_ptr<extensions::ExtensionsBrowserClient>
extensions_browser_client_;
std::string locale_;
std::unique_ptr<printing::PrintJobManager> print_job_manager_;
std::unique_ptr<ChromeProfileManagerAlloy> profile_manager_;