| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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; |
| 81 return nullptr; | 81 return nullptr; |
| 82 } | 82 } |
| 83 idle_timer_.Stop(); | 83 idle_timer_.Stop(); |
| 84 num_proxy_resolvers_++; | 84 num_proxy_resolvers_++; |
| 85 resolver_factory_->CreateResolver(pac_script, std::move(req), | 85 resolver_factory_->CreateResolver(pac_script, std::move(req), |
| 86 std::move(client)); | 86 std::move(client)); |
| 87 return base::WrapUnique(new base::ScopedClosureRunner( | 87 return base::MakeUnique<base::ScopedClosureRunner>( |
| 88 base::Bind(&UtilityProcessMojoProxyResolverFactory::OnResolverDestroyed, | 88 base::Bind(&UtilityProcessMojoProxyResolverFactory::OnResolverDestroyed, |
| 89 base::Unretained(this)))); | 89 base::Unretained(this))); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void UtilityProcessMojoProxyResolverFactory::OnConnectionError() { | 92 void UtilityProcessMojoProxyResolverFactory::OnConnectionError() { |
| 93 DVLOG(1) << "Disconnection from utility process detected"; | 93 DVLOG(1) << "Disconnection from utility process detected"; |
| 94 resolver_factory_.reset(); | 94 resolver_factory_.reset(); |
| 95 delete weak_utility_process_host_.get(); | 95 delete weak_utility_process_host_.get(); |
| 96 weak_utility_process_host_.reset(); | 96 weak_utility_process_host_.reset(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void UtilityProcessMojoProxyResolverFactory::OnResolverDestroyed() { | 99 void UtilityProcessMojoProxyResolverFactory::OnResolverDestroyed() { |
| (...skipping 13 matching lines...) Expand all 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 |