diff --git a/brightray/browser/browser_main_parts.cc b/brightray/browser/browser_main_parts.cc index ceee0d51e6a..806faee8610 100644 --- a/brightray/browser/browser_main_parts.cc +++ b/brightray/browser/browser_main_parts.cc @@ -18,6 +18,21 @@ BrowserMainParts::BrowserMainParts() { BrowserMainParts::~BrowserMainParts() { } +void BrowserMainParts::PreEarlyInitialization() { +#if defined(OS_MACOSX) + IncreaseFileDescriptorLimit(); +#endif +} + +void BrowserMainParts::ToolkitInitialized() { +} + +void BrowserMainParts::PreMainMessageLoopStart() { +#if defined(OS_MACOSX) + InitializeMainNib(); +#endif +} + void BrowserMainParts::PreMainMessageLoopRun() { browser_context_.reset(CreateBrowserContext()); browser_context_->Initialize(); diff --git a/brightray/browser/browser_main_parts.h b/brightray/browser/browser_main_parts.h index 79d343ac608..fc0587f41c2 100644 --- a/brightray/browser/browser_main_parts.h +++ b/brightray/browser/browser_main_parts.h @@ -26,16 +26,19 @@ class BrowserMainParts : public content::BrowserMainParts { // implementation. The caller takes ownership of the returned object. virtual BrowserContext* CreateBrowserContext(); -#if defined(OS_MACOSX) virtual void PreEarlyInitialization() OVERRIDE; + virtual void ToolkitInitialized() OVERRIDE; virtual void PreMainMessageLoopStart() OVERRIDE; -#endif - virtual void PreMainMessageLoopRun() OVERRIDE; virtual void PostMainMessageLoopRun() OVERRIDE; virtual int PreCreateThreads() OVERRIDE; private: +#if defined(OS_MACOSX) + void IncreaseFileDescriptorLimit(); + void InitializeMainNib(); +#endif + scoped_ptr browser_context_; scoped_ptr web_ui_controller_factory_; diff --git a/brightray/browser/browser_main_parts_mac.mm b/brightray/browser/browser_main_parts_mac.mm index 44b9494374a..a795e80a69d 100644 --- a/brightray/browser/browser_main_parts_mac.mm +++ b/brightray/browser/browser_main_parts_mac.mm @@ -27,7 +27,7 @@ void SetFileDescriptorLimit(rlim_t max_descriptors) { } // namespace -void BrowserMainParts::PreEarlyInitialization() { +void BrowserMainParts::IncreaseFileDescriptorLimit() { // We use quite a few file descriptors for our IPC, and the default limit on the Mac is low (256), // so bump it up. // See http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/chrome_browser_main_posix.cc?revision=244734#l295 @@ -36,7 +36,7 @@ void BrowserMainParts::PreEarlyInitialization() { } // Replicates NSApplicationMain, but doesn't start a run loop. -void BrowserMainParts::PreMainMessageLoopStart() { +void BrowserMainParts::InitializeMainNib() { auto infoDictionary = base::mac::OuterBundle().infoDictionary; auto principalClass = NSClassFromString([infoDictionary objectForKey:@"NSPrincipalClass"]);