| OLD | NEW |
| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 base::Bind(&UtilityProcessMojoProxyResolverFactory::OnConnectionError, | 60 base::Bind(&UtilityProcessMojoProxyResolverFactory::OnConnectionError, |
| 61 base::Unretained(this))); | 61 base::Unretained(this))); |
| 62 weak_utility_process_host_ = utility_process_host->AsWeakPtr(); | 62 weak_utility_process_host_ = utility_process_host->AsWeakPtr(); |
| 63 } else { | 63 } else { |
| 64 LOG(ERROR) << "Unable to connect to utility process"; | 64 LOG(ERROR) << "Unable to connect to utility process"; |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 std::unique_ptr<base::ScopedClosureRunner> | 68 std::unique_ptr<base::ScopedClosureRunner> |
| 69 UtilityProcessMojoProxyResolverFactory::CreateResolver( | 69 UtilityProcessMojoProxyResolverFactory::CreateResolver( |
| 70 const mojo::String& pac_script, | 70 const std::string& pac_script, |
| 71 mojo::InterfaceRequest<net::interfaces::ProxyResolver> req, | 71 mojo::InterfaceRequest<net::interfaces::ProxyResolver> req, |
| 72 net::interfaces::ProxyResolverFactoryRequestClientPtr client) { | 72 net::interfaces::ProxyResolverFactoryRequestClientPtr client) { |
| 73 DCHECK(thread_checker_.CalledOnValidThread()); | 73 DCHECK(thread_checker_.CalledOnValidThread()); |
| 74 if (!resolver_factory_) | 74 if (!resolver_factory_) |
| 75 CreateProcessAndConnect(); | 75 CreateProcessAndConnect(); |
| 76 | 76 |
| 77 if (!resolver_factory_) { | 77 if (!resolver_factory_) { |
| 78 // If there's still no factory, then utility process creation failed so | 78 // If there's still no factory, then utility process creation failed so |
| 79 // close |req|'s message pipe, which should cause a connection error. | 79 // close |req|'s message pipe, which should cause a connection error. |
| 80 req = nullptr; | 80 req = nullptr; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 void UtilityProcessMojoProxyResolverFactory::OnIdleTimeout() { | 116 void UtilityProcessMojoProxyResolverFactory::OnIdleTimeout() { |
| 117 DCHECK(thread_checker_.CalledOnValidThread()); | 117 DCHECK(thread_checker_.CalledOnValidThread()); |
| 118 DCHECK_EQ(num_proxy_resolvers_, 0u); | 118 DCHECK_EQ(num_proxy_resolvers_, 0u); |
| 119 delete weak_utility_process_host_.get(); | 119 delete weak_utility_process_host_.get(); |
| 120 weak_utility_process_host_.reset(); | 120 weak_utility_process_host_.reset(); |
| 121 resolver_factory_.reset(); | 121 resolver_factory_.reset(); |
| 122 } | 122 } |
| OLD | NEW |