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

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

Issue 1017453005: Add support for ProxyResolverErrorObserver to ProxyResolverMojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 7 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/net/utility_process_mojo_proxy_resolver_factory.h" 5 #include "chrome/browser/net/utility_process_mojo_proxy_resolver_factory.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "chrome/grit/generated_resources.h" 9 #include "chrome/grit/generated_resources.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } else { 55 } else {
56 LOG(ERROR) << "Unable to connect to utility process"; 56 LOG(ERROR) << "Unable to connect to utility process";
57 } 57 }
58 } 58 }
59 59
60 scoped_ptr<base::ScopedClosureRunner> 60 scoped_ptr<base::ScopedClosureRunner>
61 UtilityProcessMojoProxyResolverFactory::CreateResolver( 61 UtilityProcessMojoProxyResolverFactory::CreateResolver(
62 const mojo::String& pac_script, 62 const mojo::String& pac_script,
63 mojo::InterfaceRequest<net::interfaces::ProxyResolver> req, 63 mojo::InterfaceRequest<net::interfaces::ProxyResolver> req,
64 net::interfaces::HostResolverPtr host_resolver, 64 net::interfaces::HostResolverPtr host_resolver,
65 net::interfaces::ProxyResolverErrorObserverPtr error_observer,
65 net::interfaces::ProxyResolverFactoryRequestClientPtr client) { 66 net::interfaces::ProxyResolverFactoryRequestClientPtr client) {
66 DCHECK(thread_checker_.CalledOnValidThread()); 67 DCHECK(thread_checker_.CalledOnValidThread());
67 if (!resolver_factory_) 68 if (!resolver_factory_)
68 CreateProcessAndConnect(); 69 CreateProcessAndConnect();
69 70
70 if (!resolver_factory_) { 71 if (!resolver_factory_) {
71 // If there's still no factory, then utility process creation failed so 72 // If there's still no factory, then utility process creation failed so
72 // close |req|'s message pipe, which should cause a connection error. 73 // close |req|'s message pipe, which should cause a connection error.
73 req = nullptr; 74 req = nullptr;
74 return nullptr; 75 return nullptr;
75 } 76 }
76 idle_timer_.Stop(); 77 idle_timer_.Stop();
77 num_proxy_resolvers_++; 78 num_proxy_resolvers_++;
78 resolver_factory_->CreateResolver(pac_script, req.Pass(), 79 resolver_factory_->CreateResolver(pac_script, req.Pass(),
79 host_resolver.Pass(), client.Pass()); 80 host_resolver.Pass(), error_observer.Pass(),
81 client.Pass());
80 return make_scoped_ptr(new base::ScopedClosureRunner( 82 return make_scoped_ptr(new base::ScopedClosureRunner(
81 base::Bind(&UtilityProcessMojoProxyResolverFactory::OnResolverDestroyed, 83 base::Bind(&UtilityProcessMojoProxyResolverFactory::OnResolverDestroyed,
82 base::Unretained(this)))); 84 base::Unretained(this))));
83 } 85 }
84 86
85 void UtilityProcessMojoProxyResolverFactory::OnConnectionError() { 87 void UtilityProcessMojoProxyResolverFactory::OnConnectionError() {
86 DVLOG(1) << "Disconnection from utility process detected"; 88 DVLOG(1) << "Disconnection from utility process detected";
87 resolver_factory_.reset(); 89 resolver_factory_.reset();
88 } 90 }
89 91
(...skipping 14 matching lines...) Expand all
104 } 106 }
105 } 107 }
106 108
107 void UtilityProcessMojoProxyResolverFactory::OnIdleTimeout() { 109 void UtilityProcessMojoProxyResolverFactory::OnIdleTimeout() {
108 DCHECK(thread_checker_.CalledOnValidThread()); 110 DCHECK(thread_checker_.CalledOnValidThread());
109 DCHECK_EQ(num_proxy_resolvers_, 0u); 111 DCHECK_EQ(num_proxy_resolvers_, 0u);
110 delete weak_utility_process_host_.get(); 112 delete weak_utility_process_host_.get();
111 weak_utility_process_host_.reset(); 113 weak_utility_process_host_.reset();
112 resolver_factory_.reset(); 114 resolver_factory_.reset();
113 } 115 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698