From 079e5df7405c5dbce6f57d4e8e615dfc4b6653d6 Mon Sep 17 00:00:00 2001 From: Aleksei Kuzmin Date: Thu, 5 Apr 2018 23:09:37 +0200 Subject: [PATCH] Adds ability for BrowserMainParts::PreEarlyInitialization() to fail https://chromium-review.googlesource.com/862964 --- atom/browser/atom_browser_main_parts.cc | 10 ++++++++-- atom/browser/atom_browser_main_parts.h | 2 +- brightray/browser/browser_main_parts.cc | 5 ++++- brightray/browser/browser_main_parts.h | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/atom/browser/atom_browser_main_parts.cc b/atom/browser/atom_browser_main_parts.cc index 2bd534defcbe..502d90abaa36 100644 --- a/atom/browser/atom_browser_main_parts.cc +++ b/atom/browser/atom_browser_main_parts.cc @@ -20,6 +20,7 @@ #include "base/threading/thread_task_runner_handle.h" #include "chrome/browser/browser_process.h" #include "content/public/browser/child_process_security_policy.h" +#include "content/public/common/result_codes.h" #include "device/geolocation/geolocation_delegate.h" #include "device/geolocation/geolocation_provider.h" #include "ui/base/idle/idle.h" @@ -126,11 +127,16 @@ void AtomBrowserMainParts::RegisterDestructionCallback( destructors_.insert(destructors_.begin(), std::move(callback)); } -void AtomBrowserMainParts::PreEarlyInitialization() { - brightray::BrowserMainParts::PreEarlyInitialization(); +int AtomBrowserMainParts::PreEarlyInitialization() { + const int result = brightray::BrowserMainParts::PreEarlyInitialization(); + if (result != content::RESULT_CODE_NORMAL_EXIT) + return result; + #if defined(OS_POSIX) HandleSIGCHLD(); #endif + + return content::RESULT_CODE_NORMAL_EXIT; } void AtomBrowserMainParts::PostEarlyInitialization() { diff --git a/atom/browser/atom_browser_main_parts.h b/atom/browser/atom_browser_main_parts.h index 3e09ab28e5ba..ab6ed5eb1483 100644 --- a/atom/browser/atom_browser_main_parts.h +++ b/atom/browser/atom_browser_main_parts.h @@ -57,7 +57,7 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts { protected: // content::BrowserMainParts: - void PreEarlyInitialization() override; + int PreEarlyInitialization() override; void PostEarlyInitialization() override; int PreCreateThreads() override; void ToolkitInitialized() override; diff --git a/brightray/browser/browser_main_parts.cc b/brightray/browser/browser_main_parts.cc index fd6c1a9242d4..e1e62bc5df7e 100644 --- a/brightray/browser/browser_main_parts.cc +++ b/brightray/browser/browser_main_parts.cc @@ -29,6 +29,7 @@ #include "brightray/common/main_delegate.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/content_switches.h" +#include "content/public/common/result_codes.h" #include "media/base/localized_strings.h" #include "net/proxy_resolution/proxy_resolver_v8.h" #include "ui/base/l10n/l10n_util.h" @@ -177,7 +178,7 @@ void OverrideAppLogsPath() { } #endif -void BrowserMainParts::PreEarlyInitialization() { +int BrowserMainParts::PreEarlyInitialization() { std::unique_ptr feature_list(new base::FeatureList); // TODO(deepak1556): Disable guest webcontents based on OOPIF feature. feature_list->InitializeFromCommandLine("", "GuestViewCrossProcessFrames"); @@ -192,6 +193,8 @@ void BrowserMainParts::PreEarlyInitialization() { // we can't shutdown properly while creating and initializing services. ui::SetX11ErrorHandlers(nullptr, nullptr); #endif + + return content::RESULT_CODE_NORMAL_EXIT; } void BrowserMainParts::ToolkitInitialized() { diff --git a/brightray/browser/browser_main_parts.h b/brightray/browser/browser_main_parts.h index 217333985364..0f82ce6daa9a 100644 --- a/brightray/browser/browser_main_parts.h +++ b/brightray/browser/browser_main_parts.h @@ -33,7 +33,7 @@ class BrowserMainParts : public content::BrowserMainParts { protected: // content::BrowserMainParts: - void PreEarlyInitialization() override; + int PreEarlyInitialization() override; void ToolkitInitialized() override; void PreMainMessageLoopStart() override; void PreMainMessageLoopRun() override;