diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc index 9742c32aaf428..311339c29830d 100644 --- a/chrome/app/chrome_main_delegate.cc +++ b/chrome/app/chrome_main_delegate.cc @@ -740,8 +740,11 @@ void ChromeMainDelegate::PreSandboxStartup() { crash_reporter::SetCrashReporterClient(g_chrome_crash_client.Pointer()); #endif +#if defined(OS_MACOSX) if (process_type.empty()) nw::InitNWPackage(); +#endif + #if defined(OS_MACOSX) // On the Mac, the child executable lives at a predefined location within // the app bundle's versioned directory. @@ -909,6 +912,14 @@ void ChromeMainDelegate::SandboxInitialized(const std::string& process_type) { chrome_pdf::PPP_ShutdownModule); #endif #endif + +#if !define(OS_MACOSX) + // Make sure nw package is initialized after logging initialization. + // On Windows, the logging is initialized after sanbox is created. + // See https://github.com/nwjs/nw.js/issues/4637 + if (process_type.empty()) + nw::InitNWPackage(); +#endif } int ChromeMainDelegate::RunProcess(