OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/proxy/mojo_proxy_resolver_factory_impl.h" | 5 #include "net/proxy/mojo_proxy_resolver_factory_impl.h" |
6 | 6 |
7 #include "net/dns/host_resolver_mojo.h" | 7 #include "net/dns/host_resolver_mojo.h" |
8 #include "net/proxy/mojo_proxy_resolver_impl.h" | 8 #include "net/proxy/mojo_proxy_resolver_impl.h" |
9 #include "net/proxy/proxy_resolver_v8.h" | 9 #include "net/proxy/proxy_resolver_v8.h" |
10 #include "net/proxy/proxy_resolver_v8_tracing.h" | 10 #include "net/proxy/proxy_resolver_v8_tracing.h" |
11 #include "third_party/mojo/src/mojo/public/cpp/bindings/error_handler.h" | 11 #include "third_party/mojo/src/mojo/public/cpp/bindings/error_handler.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 namespace { | 14 namespace { |
15 | 15 |
16 scoped_ptr<ProxyResolver> CreateDefaultProxyResolver( | 16 scoped_ptr<ProxyResolver> CreateDefaultProxyResolver( |
17 HostResolver* host_resolver) { | 17 HostResolver* host_resolver) { |
18 ProxyResolverV8::EnsureIsolateCreated(); | |
19 return make_scoped_ptr( | 18 return make_scoped_ptr( |
20 new ProxyResolverV8Tracing(host_resolver, nullptr, nullptr)); | 19 new ProxyResolverV8Tracing(host_resolver, nullptr, nullptr)); |
21 } | 20 } |
22 | 21 |
23 // A class to manage the lifetime of a MojoProxyResolverImpl and a | 22 // A class to manage the lifetime of a MojoProxyResolverImpl and a |
24 // HostResolverMojo. An instance will remain while the message pipes for both | 23 // HostResolverMojo. An instance will remain while the message pipes for both |
25 // mojo connections remain open. | 24 // mojo connections remain open. |
26 class MojoProxyResolverHolder : public mojo::ErrorHandler { | 25 class MojoProxyResolverHolder : public mojo::ErrorHandler { |
27 public: | 26 public: |
28 MojoProxyResolverHolder( | 27 MojoProxyResolverHolder( |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 mojo::InterfaceRequest<interfaces::ProxyResolver> request, | 77 mojo::InterfaceRequest<interfaces::ProxyResolver> request, |
79 interfaces::HostResolverPtr host_resolver) { | 78 interfaces::HostResolverPtr host_resolver) { |
80 // The MojoProxyResolverHolder will delete itself when either |request| or | 79 // The MojoProxyResolverHolder will delete itself when either |request| or |
81 // |host_resolver| encounters a connection error, that is, when either the | 80 // |host_resolver| encounters a connection error, that is, when either the |
82 // ProxyResolver client or the HostResolver implementation is deleted. | 81 // ProxyResolver client or the HostResolver implementation is deleted. |
83 new MojoProxyResolverHolder(proxy_resolver_impl_factory_, request.Pass(), | 82 new MojoProxyResolverHolder(proxy_resolver_impl_factory_, request.Pass(), |
84 host_resolver.Pass()); | 83 host_resolver.Pass()); |
85 } | 84 } |
86 | 85 |
87 } // namespace net | 86 } // namespace net |
OLD | NEW |