Give names to all utility processes.
[chromium-blink-merge.git] / chrome / browser / net / utility_process_mojo_proxy_resolver_factory.h
blob0186253071b9316186fb533496187905426bd74f
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.
5 #ifndef CHROME_BROWSER_NET_UTILITY_PROCESS_MOJO_PROXY_RESOLVER_FACTORY_H_
6 #define CHROME_BROWSER_NET_UTILITY_PROCESS_MOJO_PROXY_RESOLVER_FACTORY_H_
8 #include "base/macros.h"
9 #include "net/proxy/mojo_proxy_resolver_factory.h"
11 template <typename Type>
12 struct DefaultSingletonTraits;
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();
24 // Overridden from net::MojoProxyResolverFactory:
25 void Create(mojo::InterfaceRequest<net::interfaces::ProxyResolver> req,
26 net::interfaces::HostResolverPtr host_resolver) override;
28 private:
29 friend struct DefaultSingletonTraits<UtilityProcessMojoProxyResolverFactory>;
30 UtilityProcessMojoProxyResolverFactory();
31 ~UtilityProcessMojoProxyResolverFactory() override;
33 // Overridden from mojo::ErrorHandler:
34 void OnConnectionError() override;
36 // Creates a new utility process and connects to its Mojo proxy resolver
37 // factory.
38 void CreateProcessAndConnect();
40 net::interfaces::ProxyResolverFactoryPtr resolver_factory_;
42 DISALLOW_COPY_AND_ASSIGN(UtilityProcessMojoProxyResolverFactory);
45 #endif // CHROME_BROWSER_NET_UTILITY_PROCESS_MOJO_PROXY_RESOLVER_FACTORY_H_