OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_NET_UTILITY_PROCESS_MOJO_PROXY_RESOLVER_FACTORY_H_ |
| 6 #define CHROME_BROWSER_NET_UTILITY_PROCESS_MOJO_PROXY_RESOLVER_FACTORY_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "net/proxy/mojo_proxy_resolver_factory.h" |
| 10 |
| 11 template <typename Type> |
| 12 struct DefaultSingletonTraits; |
| 13 |
| 14 namespace content { |
| 15 class UtilityProcessHost; |
| 16 } |
| 17 |
| 18 // A factory used to create connections to Mojo proxy resolver services run in a |
| 19 // utility process. All Mojo proxy resolver services will be run in the same |
| 20 // utility process. Utility process crashes are detected and the utility |
| 21 // process is automatically restarted. |
| 22 class UtilityProcessMojoProxyResolverFactory |
| 23 : public net::MojoProxyResolverFactory, |
| 24 public mojo::ErrorHandler { |
| 25 public: |
| 26 static UtilityProcessMojoProxyResolverFactory* GetInstance(); |
| 27 |
| 28 // Overridden from net::MojoProxyResolverFactory: |
| 29 void Create(mojo::InterfaceRequest<net::interfaces::ProxyResolver> req, |
| 30 net::interfaces::HostResolverPtr host_resolver) override; |
| 31 |
| 32 private: |
| 33 friend struct DefaultSingletonTraits<UtilityProcessMojoProxyResolverFactory>; |
| 34 UtilityProcessMojoProxyResolverFactory(); |
| 35 ~UtilityProcessMojoProxyResolverFactory() override; |
| 36 |
| 37 // Overridden from mojo::ErrorHandler: |
| 38 void OnConnectionError() override; |
| 39 |
| 40 // Creates a new utility process and connects to its Mojo proxy resolver |
| 41 // factory. |
| 42 void CreateProcessAndConnect(); |
| 43 |
| 44 net::interfaces::ProxyResolverFactoryPtr resolver_factory_; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(UtilityProcessMojoProxyResolverFactory); |
| 47 }; |
| 48 |
| 49 #endif // CHROME_BROWSER_NET_UTILITY_PROCESS_MOJO_PROXY_RESOLVER_FACTORY_H_ |
OLD | NEW |