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 // A factory used to create connections to Mojo proxy resolver services run in a |
| 15 // utility process. All Mojo proxy resolver services will be run in the same |
| 16 // utility process. Utility process crashes are detected and the utility |
| 17 // process is automatically restarted. |
| 18 class UtilityProcessMojoProxyResolverFactory |
| 19 : public net::MojoProxyResolverFactory, |
| 20 public mojo::ErrorHandler { |
| 21 public: |
| 22 static UtilityProcessMojoProxyResolverFactory* GetInstance(); |
| 23 |
| 24 // Overridden from net::MojoProxyResolverFactory: |
| 25 void Create(mojo::InterfaceRequest<net::interfaces::ProxyResolver> req, |
| 26 net::interfaces::HostResolverPtr host_resolver) override; |
| 27 |
| 28 private: |
| 29 friend struct DefaultSingletonTraits<UtilityProcessMojoProxyResolverFactory>; |
| 30 UtilityProcessMojoProxyResolverFactory(); |
| 31 ~UtilityProcessMojoProxyResolverFactory() override; |
| 32 |
| 33 // Overridden from mojo::ErrorHandler: |
| 34 void OnConnectionError() override; |
| 35 |
| 36 // Creates a new utility process and connects to its Mojo proxy resolver |
| 37 // factory. |
| 38 void CreateProcessAndConnect(); |
| 39 |
| 40 net::interfaces::ProxyResolverFactoryPtr resolver_factory_; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(UtilityProcessMojoProxyResolverFactory); |
| 43 }; |
| 44 |
| 45 #endif // CHROME_BROWSER_NET_UTILITY_PROCESS_MOJO_PROXY_RESOLVER_FACTORY_H_ |
OLD | NEW |