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

Unified Diff: net/proxy/proxy_resolver_mojo.h

Issue 1076083002: Shut down proxy resolver utility processes when no longer needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@proxy-service-with-factory-restart
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: net/proxy/proxy_resolver_mojo.h
diff --git a/net/proxy/proxy_resolver_mojo.h b/net/proxy/proxy_resolver_mojo.h
index 10a512e8ee7d91fb5a4e0507679008af53a874e4..69deec3dd4d477ad9ee0fdc75c10d878de0ecca2 100644
--- a/net/proxy/proxy_resolver_mojo.h
+++ b/net/proxy/proxy_resolver_mojo.h
@@ -7,11 +7,13 @@
#include <set>
+#include "base/callback_helpers.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
#include "net/base/completion_callback.h"
#include "net/base/load_states.h"
+#include "net/dns/mojo_host_resolver_impl.h"
#include "net/interfaces/host_resolver_service.mojom.h"
#include "net/interfaces/proxy_resolver_service.mojom.h"
#include "net/proxy/proxy_resolver.h"
@@ -25,24 +27,25 @@ namespace net {
class BoundNetLog;
class HostResolver;
class ProxyInfo;
-class MojoProxyResolverFactory;
// Implementation of ProxyResolver that connects to a Mojo service to evaluate
// PAC scripts. This implementation only knows about Mojo services, and
// therefore that service may live in or out of process.
//
-// This implementation handles disconnections from the Mojo service (i.e. if the
-// service is out-of-process and that process crashes) and transparently
-// re-connects to a new service.
+// This implementation reports disconnections from the Mojo service (i.e. if the
+// service is out-of-process and that process crashes) using the error code
+// ERR_PAC_SCRIPT_TERMINATED.
class ProxyResolverMojo : public ProxyResolver, public mojo::ErrorHandler {
public:
- // Constructs a ProxyResolverMojo and connects to a new Mojo proxy resolver
- // service using |mojo_proxy_resolver_factory|. The new Mojo proxy resolver
- // uses |host_resolver| as the DNS resolver. |mojo_proxy_resolver_factory|
- // and |host_resolver| are not owned and must outlive this.
+ // Constructs a ProxyResolverMojo that will use |mojo_proxy_resolver| to
+ // service requests. |host_resolver| is not owned and must outlive this.
+ // When deleted, the closure contained within |runner| will be run.
eroman 2015/05/02 02:22:31 can you come up with a better name than |runner|?
Sam McNally 2015/05/04 06:17:23 Done.
// TODO(amistry): Add ProxyResolverErrorObserver and NetLog.
- ProxyResolverMojo(MojoProxyResolverFactory* mojo_proxy_resolver_factory,
- HostResolver* host_resolver);
+ ProxyResolverMojo(
+ interfaces::ProxyResolverPtr mojo_proxy_resolver,
+ HostResolver* host_resolver,
+ mojo::InterfaceRequest<interfaces::HostResolver> host_resolver_request,
+ scoped_ptr<base::ScopedClosureRunner> runner);
~ProxyResolverMojo() override;
// ProxyResolver implementation:
@@ -69,31 +72,20 @@ class ProxyResolverMojo : public ProxyResolver, public mojo::ErrorHandler {
const net::CompletionCallback& callback,
int32_t result);
- void SetUpServices();
-
void RemoveJob(Job* job);
// Connection to the Mojo proxy resolver.
interfaces::ProxyResolverPtr mojo_proxy_resolver_ptr_;
- // Mojo host resolver service and binding.
- scoped_ptr<interfaces::HostResolver> mojo_host_resolver_;
- scoped_ptr<mojo::Binding<interfaces::HostResolver>>
- mojo_host_resolver_binding_;
-
- // Factory for connecting to new Mojo proxy resolvers.
- // Not owned.
- MojoProxyResolverFactory* mojo_proxy_resolver_factory_;
-
- // DNS resolver, saved for creating a new Mojo proxy resolver when the
- // existing one disconnects (i.e. when utility process crashes).
- HostResolver* host_resolver_;
-
std::set<Job*> pending_jobs_;
net::CancelableCompletionCallback set_pac_script_callback_;
base::ThreadChecker thread_checker_;
+ MojoHostResolverImpl host_resolver_;
+ mojo::Binding<interfaces::HostResolver> host_resolver_binding_;
+ scoped_ptr<base::ScopedClosureRunner> runner_;
+
DISALLOW_COPY_AND_ASSIGN(ProxyResolverMojo);
};

Powered by Google App Engine
This is Rietveld 408576698