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

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: 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
« no previous file with comments | « chrome/browser/net/utility_process_mojo_proxy_resolver_factory.h ('k') | net/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } else { 57 } else {
58 LOG(ERROR) << "Unable to connect to utility process"; 58 LOG(ERROR) << "Unable to connect to utility process";
59 } 59 }
60 } 60 }
61 61
62 scoped_ptr<base::ScopedClosureRunner> 62 scoped_ptr<base::ScopedClosureRunner>
63 UtilityProcessMojoProxyResolverFactory::CreateResolver( 63 UtilityProcessMojoProxyResolverFactory::CreateResolver(
64 const mojo::String& pac_script, 64 const mojo::String& pac_script,
65 mojo::InterfaceRequest<net::interfaces::ProxyResolver> req, 65 mojo::InterfaceRequest<net::interfaces::ProxyResolver> req,
66 net::interfaces::HostResolverPtr host_resolver, 66 net::interfaces::HostResolverPtr host_resolver,
67 net::interfaces::ProxyResolverErrorObserverPtr error_observer,
67 net::interfaces::ProxyResolverFactoryRequestClientPtr client) { 68 net::interfaces::ProxyResolverFactoryRequestClientPtr client) {
68 DCHECK(thread_checker_.CalledOnValidThread()); 69 DCHECK(thread_checker_.CalledOnValidThread());
69 if (!resolver_factory_) 70 if (!resolver_factory_)
70 CreateProcessAndConnect(); 71 CreateProcessAndConnect();
71 72
72 if (!resolver_factory_) { 73 if (!resolver_factory_) {
73 // If there's still no factory, then utility process creation failed so 74 // If there's still no factory, then utility process creation failed so
74 // close |req|'s message pipe, which should cause a connection error. 75 // close |req|'s message pipe, which should cause a connection error.
75 req = nullptr; 76 req = nullptr;
76 return nullptr; 77 return nullptr;
77 } 78 }
78 idle_timer_.Stop(); 79 idle_timer_.Stop();
79 num_proxy_resolvers_++; 80 num_proxy_resolvers_++;
80 resolver_factory_->CreateResolver(pac_script, req.Pass(), 81 resolver_factory_->CreateResolver(pac_script, req.Pass(),
81 host_resolver.Pass(), client.Pass()); 82 host_resolver.Pass(), error_observer.Pass(),
83 client.Pass());
82 return make_scoped_ptr(new base::ScopedClosureRunner( 84 return make_scoped_ptr(new base::ScopedClosureRunner(
83 base::Bind(&UtilityProcessMojoProxyResolverFactory::OnResolverDestroyed, 85 base::Bind(&UtilityProcessMojoProxyResolverFactory::OnResolverDestroyed,
84 base::Unretained(this)))); 86 base::Unretained(this))));
85 } 87 }
86 88
87 void UtilityProcessMojoProxyResolverFactory::OnConnectionError() { 89 void UtilityProcessMojoProxyResolverFactory::OnConnectionError() {
88 DVLOG(1) << "Disconnection from utility process detected"; 90 DVLOG(1) << "Disconnection from utility process detected";
89 resolver_factory_.reset(); 91 resolver_factory_.reset();
90 } 92 }
91 93
(...skipping 14 matching lines...) Expand all
106 } 108 }
107 } 109 }
108 110
109 void UtilityProcessMojoProxyResolverFactory::OnIdleTimeout() { 111 void UtilityProcessMojoProxyResolverFactory::OnIdleTimeout() {
110 DCHECK(thread_checker_.CalledOnValidThread()); 112 DCHECK(thread_checker_.CalledOnValidThread());
111 DCHECK_EQ(num_proxy_resolvers_, 0u); 113 DCHECK_EQ(num_proxy_resolvers_, 0u);
112 delete weak_utility_process_host_.get(); 114 delete weak_utility_process_host_.get();
113 weak_utility_process_host_.reset(); 115 weak_utility_process_host_.reset();
114 resolver_factory_.reset(); 116 resolver_factory_.reset();
115 } 117 }
OLDNEW
« no previous file with comments | « chrome/browser/net/utility_process_mojo_proxy_resolver_factory.h ('k') | net/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698