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> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
9 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
10 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
11 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
12 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
13 #include "content/public/browser/utility_process_host.h" | 15 #include "content/public/browser/utility_process_host.h" |
14 #include "content/public/browser/utility_process_host_client.h" | 16 #include "content/public/browser/utility_process_host_client.h" |
15 #include "content/public/common/service_registry.h" | 17 #include "content/public/common/service_registry.h" |
16 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 CreateProcessAndConnect(); | 74 CreateProcessAndConnect(); |
73 | 75 |
74 if (!resolver_factory_) { | 76 if (!resolver_factory_) { |
75 // If there's still no factory, then utility process creation failed so | 77 // If there's still no factory, then utility process creation failed so |
76 // close |req|'s message pipe, which should cause a connection error. | 78 // close |req|'s message pipe, which should cause a connection error. |
77 req = nullptr; | 79 req = nullptr; |
78 return nullptr; | 80 return nullptr; |
79 } | 81 } |
80 idle_timer_.Stop(); | 82 idle_timer_.Stop(); |
81 num_proxy_resolvers_++; | 83 num_proxy_resolvers_++; |
82 resolver_factory_->CreateResolver(pac_script, req.Pass(), client.Pass()); | 84 resolver_factory_->CreateResolver(pac_script, std::move(req), |
| 85 std::move(client)); |
83 return make_scoped_ptr(new base::ScopedClosureRunner( | 86 return make_scoped_ptr(new base::ScopedClosureRunner( |
84 base::Bind(&UtilityProcessMojoProxyResolverFactory::OnResolverDestroyed, | 87 base::Bind(&UtilityProcessMojoProxyResolverFactory::OnResolverDestroyed, |
85 base::Unretained(this)))); | 88 base::Unretained(this)))); |
86 } | 89 } |
87 | 90 |
88 void UtilityProcessMojoProxyResolverFactory::OnConnectionError() { | 91 void UtilityProcessMojoProxyResolverFactory::OnConnectionError() { |
89 DVLOG(1) << "Disconnection from utility process detected"; | 92 DVLOG(1) << "Disconnection from utility process detected"; |
90 resolver_factory_.reset(); | 93 resolver_factory_.reset(); |
91 } | 94 } |
92 | 95 |
(...skipping 14 matching lines...) Expand all Loading... |
107 } | 110 } |
108 } | 111 } |
109 | 112 |
110 void UtilityProcessMojoProxyResolverFactory::OnIdleTimeout() { | 113 void UtilityProcessMojoProxyResolverFactory::OnIdleTimeout() { |
111 DCHECK(thread_checker_.CalledOnValidThread()); | 114 DCHECK(thread_checker_.CalledOnValidThread()); |
112 DCHECK_EQ(num_proxy_resolvers_, 0u); | 115 DCHECK_EQ(num_proxy_resolvers_, 0u); |
113 delete weak_utility_process_host_.get(); | 116 delete weak_utility_process_host_.get(); |
114 weak_utility_process_host_.reset(); | 117 weak_utility_process_host_.reset(); |
115 resolver_factory_.reset(); | 118 resolver_factory_.reset(); |
116 } | 119 } |
OLD | NEW |