Make BrowserMainParts's overrides available on all platforms.

This commit is contained in:
Cheng Zhao 2014-07-03 08:12:12 +00:00
parent bc6237375e
commit d4e81da19a
3 changed files with 23 additions and 5 deletions

View file

@ -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();

View file

@ -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<BrowserContext> browser_context_;
scoped_ptr<WebUIControllerFactory> web_ui_controller_factory_;

View file

@ -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"]);