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

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 6bc7d6bbfd28e3638249c8248accff15de0da765..5de984b32ecbcb4964d597ca9b1a8732d29a6a40 100644
--- a/net/proxy/proxy_resolver_mojo.h
+++ b/net/proxy/proxy_resolver_mojo.h
@@ -7,6 +7,7 @@
#include <set>
+#include "base/callback_helpers.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
@@ -32,18 +33,16 @@ class MojoProxyResolverFactory;
// 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 connected to a Mojo proxy resolver service
+ // using |mojo_proxy_resolver| that will delete |runner| when it is deleted.
eroman 2015/04/15 00:46:44 this comment is hard to parse
Sam McNally 2015/04/15 06:04:22 How about now?
// TODO(amistry): Add ProxyResolverErrorObserver and NetLog.
- ProxyResolverMojo(MojoProxyResolverFactory* mojo_proxy_resolver_factory,
- HostResolver* host_resolver);
+ ProxyResolverMojo(interfaces::ProxyResolverPtr mojo_proxy_resolver,
+ scoped_ptr<base::ScopedClosureRunner> runner);
~ProxyResolverMojo() override;
// ProxyResolver implementation:
@@ -70,8 +69,6 @@ class ProxyResolverMojo : public ProxyResolver, public mojo::ErrorHandler {
const net::CompletionCallback& callback,
int32_t result);
- void SetUpServices();
-
void AbortPendingRequests();
void RemoveJob(Job* job);
@@ -79,24 +76,13 @@ class ProxyResolverMojo : public ProxyResolver, public mojo::ErrorHandler {
// 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_;
+ scoped_ptr<base::ScopedClosureRunner> runner_;
+
base::WeakPtrFactory<ProxyResolverMojo> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ProxyResolverMojo);

Powered by Google App Engine
This is Rietveld 408576698