Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: chrome/browser/net/utility_process_mojo_proxy_resolver_factory.h

Issue 2930743002: Use a MojoProxyResolverFactory on Android. (Closed)
Patch Set: Oops Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 <stddef.h>
9
10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/threading/thread_checker.h"
13 #include "base/timer/timer.h"
14 #include "net/proxy/mojo_proxy_resolver_factory.h"
15
16 namespace content {
17 class UtilityProcessHost;
18 }
19 namespace base {
20 template <typename Type>
21 struct DefaultSingletonTraits;
22 } // namespace base
23
24 // A factory used to create connections to Mojo proxy resolver services run in a
25 // utility process. All Mojo proxy resolver services will be run in the same
26 // utility process. Utility process crashes are detected and the utility
27 // process is automatically restarted.
28 class UtilityProcessMojoProxyResolverFactory
29 : public net::MojoProxyResolverFactory {
30 public:
31 static UtilityProcessMojoProxyResolverFactory* GetInstance();
32
33 // Overridden from net::MojoProxyResolverFactory:
34 std::unique_ptr<base::ScopedClosureRunner> CreateResolver(
35 const std::string& pac_script,
36 mojo::InterfaceRequest<net::interfaces::ProxyResolver> req,
37 net::interfaces::ProxyResolverFactoryRequestClientPtr client) override;
38
39 private:
40 friend struct base::DefaultSingletonTraits<
41 UtilityProcessMojoProxyResolverFactory>;
42 UtilityProcessMojoProxyResolverFactory();
43 ~UtilityProcessMojoProxyResolverFactory() override;
44
45 // Error handler callback for |resolver_factory_|.
46 void OnConnectionError();
47
48 // Invoked each time a proxy resolver is destroyed.
49 void OnResolverDestroyed();
50
51 // Invoked once an idle timeout has elapsed after all proxy resolvers are
52 // destroyed.
53 void OnIdleTimeout();
54
55 // Creates a new utility process and connects to its Mojo proxy resolver
56 // factory.
57 void CreateProcessAndConnect();
58
59 net::interfaces::ProxyResolverFactoryPtr resolver_factory_;
60
61 base::WeakPtr<content::UtilityProcessHost> weak_utility_process_host_;
62 size_t num_proxy_resolvers_ = 0;
63
64 base::OneShotTimer idle_timer_;
65
66 base::ThreadChecker thread_checker_;
67
68 DISALLOW_COPY_AND_ASSIGN(UtilityProcessMojoProxyResolverFactory);
69 };
70
71 #endif // CHROME_BROWSER_NET_UTILITY_PROCESS_MOJO_PROXY_RESOLVER_FACTORY_H_
OLDNEW
« no previous file with comments | « chrome/browser/net/proxy_service_factory.cc ('k') | chrome/browser/net/utility_process_mojo_proxy_resolver_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698