| Index: chrome/browser/net/proxy_service_factory.cc
|
| diff --git a/chrome/browser/net/proxy_service_factory.cc b/chrome/browser/net/proxy_service_factory.cc
|
| index c73f3c725ce6539ef5bff22f1230df35fec09189..d50c5c7b980fc3618d23c4af724f8883e20cdff4 100644
|
| --- a/chrome/browser/net/proxy_service_factory.cc
|
| +++ b/chrome/browser/net/proxy_service_factory.cc
|
| @@ -12,9 +12,19 @@
|
| #include "chrome/browser/net/pref_proxy_config_tracker_impl.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #include "content/public/browser/browser_thread.h"
|
| +#include "content/public/browser/utility_process_host.h"
|
| +#include "content/public/browser/utility_process_host_client.h"
|
| +#include "content/public/common/service_registry.h"
|
| #include "net/base/net_log.h"
|
| +#include "net/dns/host_resolver.mojom.h"
|
| +#include "net/dns/host_resolver_mojo_host.h"
|
| #include "net/proxy/dhcp_proxy_script_fetcher_factory.h"
|
| +#include "net/proxy/network_delegate_error_observer.h"
|
| #include "net/proxy/proxy_config_service.h"
|
| +#include "net/proxy/proxy_resolver.mojom.h"
|
| +#include "net/proxy/proxy_resolver_error_observer_mojo_host.h"
|
| +#include "net/proxy/proxy_resolver_mojo.h"
|
| +#include "net/proxy/proxy_resolver_mojo_host.h"
|
| #include "net/proxy/proxy_script_fetcher_impl.h"
|
| #include "net/proxy/proxy_service.h"
|
| #include "net/proxy/proxy_service_v8.h"
|
| @@ -31,6 +41,62 @@
|
|
|
| using content::BrowserThread;
|
|
|
| +namespace {
|
| +
|
| +net::ProxyService* CreateProxyServiceUsingMojo(
|
| + net::ProxyConfigService* proxy_config_service,
|
| + net::ProxyScriptFetcher* proxy_script_fetcher,
|
| + net::DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher,
|
| + net::HostResolver* host_resolver,
|
| + net::NetLog* net_log,
|
| + net::NetworkDelegate* network_delegate) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| + DCHECK(proxy_config_service);
|
| + DCHECK(proxy_script_fetcher);
|
| + DCHECK(dhcp_proxy_script_fetcher);
|
| + DCHECK(host_resolver);
|
| +
|
| + content::UtilityProcessHost* utility_process_host;
|
| + utility_process_host = content::UtilityProcessHost::Create(
|
| + scoped_refptr<content::UtilityProcessHostClient>(),
|
| + base::MessageLoopProxy::current().get());
|
| + utility_process_host->StartMojoMode();
|
| + content::ServiceRegistry* service_registry =
|
| + utility_process_host->GetServiceRegistry();
|
| +
|
| + net::proxy::ResolverFactoryPtr resolver_factory;
|
| + service_registry->ConnectToRemoteService(&resolver_factory);
|
| +
|
| + net::proxy::ResolverPtr resolver_handle;
|
| + net::dns::ResolverPtr dns_resolver_handle;
|
| + net::proxy::ErrorObserverPtr error_observer_handle;
|
| + mojo::BindToProxy(new net::HostResolverMojoHost(host_resolver),
|
| + &dns_resolver_handle);
|
| + mojo::BindToProxy(
|
| + new net::ProxyResolverErrorObserverMojoHost(
|
| + make_scoped_ptr(new net::NetworkDelegateErrorObserver(
|
| + network_delegate, base::MessageLoopProxy::current().get()))),
|
| + &error_observer_handle);
|
| +
|
| + resolver_factory->CreateResolver(mojo::GetProxy(&resolver_handle),
|
| + dns_resolver_handle.Pass(),
|
| + error_observer_handle.Pass());
|
| +
|
| + net::ProxyResolver* proxy_resolver =
|
| + new net::ProxyResolverMojo(resolver_handle.Pass(), host_resolver);
|
| +
|
| + net::ProxyService* proxy_service =
|
| + new net::ProxyService(proxy_config_service, proxy_resolver, net_log);
|
| +
|
| + // Configure fetchers to use for PAC script downloads and auto-detect.
|
| + proxy_service->SetProxyScriptFetchers(proxy_script_fetcher,
|
| + dhcp_proxy_script_fetcher);
|
| +
|
| + return proxy_service;
|
| +}
|
| +
|
| +}
|
| +
|
| // static
|
| net::ProxyConfigService* ProxyServiceFactory::CreateProxyConfigService(
|
| PrefProxyConfigTracker* tracker) {
|
| @@ -127,8 +193,6 @@ net::ProxyService* ProxyServiceFactory::CreateProxyService(
|
| #if defined(OS_IOS)
|
| NOTREACHED();
|
| #else
|
| - net::ProxyResolverV8::EnsureIsolateCreated();
|
| -
|
| net::DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher;
|
| #if defined(OS_CHROMEOS)
|
| dhcp_proxy_script_fetcher =
|
| @@ -138,7 +202,7 @@ net::ProxyService* ProxyServiceFactory::CreateProxyService(
|
| dhcp_proxy_script_fetcher = dhcp_factory.Create(context);
|
| #endif
|
|
|
| - proxy_service = net::CreateProxyServiceUsingV8ProxyResolver(
|
| + proxy_service = CreateProxyServiceUsingMojo(
|
| proxy_config_service,
|
| new net::ProxyScriptFetcherImpl(context),
|
| dhcp_proxy_script_fetcher,
|
|
|