From 02f52f7e20b4946570c56d8cac2701aeac64fb6e Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 3 Jul 2014 09:18:24 +0000 Subject: [PATCH] Allow override BrowserMainParts::InitProxyResolverV8. --- brightray/browser/browser_main_parts.cc | 14 +++++++++----- brightray/browser/browser_main_parts.h | 12 ++++++++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/brightray/browser/browser_main_parts.cc b/brightray/browser/browser_main_parts.cc index 019ad9ed64a3..68cb5e07a5d7 100644 --- a/brightray/browser/browser_main_parts.cc +++ b/brightray/browser/browser_main_parts.cc @@ -86,11 +86,7 @@ int BrowserMainParts::PreCreateThreads() { views::CreateDesktopScreen()); #endif -#if defined(OS_WIN) - net::ProxyResolverV8::CreateIsolate(); -#else - net::ProxyResolverV8::RememberDefaultIsolate(); -#endif + InitProxyResolverV8(); return 0; } @@ -98,4 +94,12 @@ BrowserContext* BrowserMainParts::CreateBrowserContext() { return new BrowserContext; } +void BrowserMainParts::InitProxyResolverV8() { +#if defined(OS_WIN) + net::ProxyResolverV8::CreateIsolate(); +#else + net::ProxyResolverV8::RememberDefaultIsolate(); +#endif +} + } // namespace brightray diff --git a/brightray/browser/browser_main_parts.h b/brightray/browser/browser_main_parts.h index cbb81006e3e1..2d100cdc2510 100644 --- a/brightray/browser/browser_main_parts.h +++ b/brightray/browser/browser_main_parts.h @@ -28,10 +28,7 @@ class BrowserMainParts : public content::BrowserMainParts { BrowserContext* browser_context() { return browser_context_.get(); } protected: - // Subclasses should override this to provide their own BrowserContxt - // implementation. The caller takes ownership of the returned object. - virtual BrowserContext* CreateBrowserContext(); - + // content::BrowserMainParts: virtual void PreEarlyInitialization() OVERRIDE; virtual void ToolkitInitialized() OVERRIDE; virtual void PreMainMessageLoopStart() OVERRIDE; @@ -39,6 +36,13 @@ class BrowserMainParts : public content::BrowserMainParts { virtual void PostMainMessageLoopRun() OVERRIDE; virtual int PreCreateThreads() OVERRIDE; + // Subclasses should override this to provide their own BrowserContxt + // implementation. The caller takes ownership of the returned object. + virtual BrowserContext* CreateBrowserContext(); + + // Override this to change how ProxyResolverV8 is initialized. + virtual void InitProxyResolverV8(); + private: #if defined(OS_MACOSX) void IncreaseFileDescriptorLimit();