Skip to content

Commit

Permalink
Merge pull request #41 from brightray/v8-proxy-resolver
Browse files Browse the repository at this point in the history
Use "ProxyResolverV8" instead of "SystemProxyResolver" as proxy service
  • Loading branch information
aroben committed Dec 6, 2013
2 parents 873f52f + 0a1f756 commit afc627a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
10 changes: 10 additions & 0 deletions brightray/browser/browser_main_parts.cc
Expand Up @@ -6,6 +6,7 @@

#include "browser/browser_context.h"
#include "browser/web_ui_controller_factory.h"
#include "net/proxy/proxy_resolver_v8.h"

namespace brightray {

Expand All @@ -29,6 +30,15 @@ void BrowserMainParts::PostMainMessageLoopRun() {
browser_context_.reset();
}

int BrowserMainParts::PreCreateThreads() {
#if defined(OS_WIN)
net::ProxyResolverV8::CreateIsolate();
#else
net::ProxyResolverV8::RememberDefaultIsolate();
#endif
return 0;
}

BrowserContext* BrowserMainParts::CreateBrowserContext() {
return new BrowserContext;
}
Expand Down
1 change: 1 addition & 0 deletions brightray/browser/browser_main_parts.h
Expand Up @@ -32,6 +32,7 @@ class BrowserMainParts : public content::BrowserMainParts {

virtual void PreMainMessageLoopRun() OVERRIDE;
virtual void PostMainMessageLoopRun() OVERRIDE;
virtual int PreCreateThreads() OVERRIDE;

private:
scoped_ptr<BrowserContext> browser_context_;
Expand Down
20 changes: 14 additions & 6 deletions brightray/browser/url_request_context_getter.cc
Expand Up @@ -19,7 +19,11 @@
#include "net/http/http_auth_handler_factory.h"
#include "net/http/http_cache.h"
#include "net/http/http_server_properties_impl.h"
#include "net/proxy/dhcp_proxy_script_fetcher_factory.h"
#include "net/proxy/proxy_config_service.h"
#include "net/proxy/proxy_script_fetcher_impl.h"
#include "net/proxy/proxy_service.h"
#include "net/proxy/proxy_service_v8.h"
#include "net/ssl/default_server_bound_cert_store.h"
#include "net/ssl/server_bound_cert_service.h"
#include "net/ssl/ssl_config_service_defaults.h"
Expand Down Expand Up @@ -83,12 +87,6 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
net::HostResolver::CreateDefaultResolver(NULL));

storage_->set_cert_verifier(net::CertVerifier::CreateDefault());
// TODO(jam): use v8 if possible, look at chrome code.
storage_->set_proxy_service(
net::ProxyService::CreateUsingSystemProxyResolver(
proxy_config_service_.release(),
0,
NULL));
storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults);
storage_->set_http_auth_handler_factory(
net::HttpAuthHandlerFactory::CreateDefault(host_resolver.get()));
Expand Down Expand Up @@ -128,6 +126,16 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
network_session_params.host_resolver =
url_request_context_->host_resolver();

net::DhcpProxyScriptFetcherFactory dhcp_factory;
storage_->set_proxy_service(
net::CreateProxyServiceUsingV8ProxyResolver(
proxy_config_service_.release(),
new net::ProxyScriptFetcherImpl(url_request_context_.get()),
dhcp_factory.Create(url_request_context_.get()),
url_request_context_->host_resolver(),
NULL,
url_request_context_->network_delegate()));

net::HttpCache* main_cache = new net::HttpCache(
network_session_params, main_backend);
storage_->set_http_transaction_factory(main_cache);
Expand Down
2 changes: 1 addition & 1 deletion brightray/vendor/libchromiumcontent
Submodule libchromiumcontent updated from 5cce38 to ee2e80

0 comments on commit afc627a

Please sign in to comment.