Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/data_reduction_proxy/content/browser/data_reduction_proxy_h ost_impl.h" | |
| 6 | |
| 7 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf ig.h" | |
| 8 #include "content/public/browser/browser_thread.h" | |
| 9 #include "content/public/browser/render_process_host.h" | |
| 10 #include "net/base/host_port_pair.h" | |
| 11 | |
| 12 namespace data_reduction_proxy { | |
| 13 | |
| 14 DataReductionProxyHostImpl::DataReductionProxyHostImpl( | |
| 15 DataReductionProxyConfig* config, | |
| 16 content::RenderProcessHost* host) | |
| 17 : config_(config) { | |
| 18 // Unit tests may pass nullptr as |host|. | |
| 19 if (host) | |
| 20 host->AddObserver(this); | |
| 21 } | |
| 22 | |
| 23 DataReductionProxyHostImpl::~DataReductionProxyHostImpl() {} | |
| 24 | |
| 25 void DataReductionProxyHostImpl::BindRequest( | |
| 26 mojom::DataReductionProxyHostRequest request) { | |
| 27 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | |
| 28 bindings_.AddBinding(this, std::move(request)); | |
| 29 } | |
| 30 | |
| 31 void DataReductionProxyHostImpl::IsDataReductionProxy( | |
| 32 const net::HostPortPair& proxy_server, | |
| 33 const IsDataReductionProxyCallback& callback) { | |
| 34 if (!config_) { | |
| 35 callback.Run(false); | |
| 36 return; | |
| 37 } | |
| 38 | |
| 39 callback.Run(config_->IsDataReductionProxy(proxy_server, nullptr)); | |
| 40 } | |
| 41 | |
| 42 void DataReductionProxyHostImpl::RenderProcessHostDestroyed( | |
|
Anand Mistry (off Chromium)
2016/06/30 12:51:45
RenderProcessHosts can be reused. And every time,
leonhsl(Using Gerrit)
2016/07/01 02:25:57
Oh, yeah, I see now.. Thanks a lot for pointing ou
| |
| 43 content::RenderProcessHost* host) { | |
| 44 content::BrowserThread::DeleteSoon(content::BrowserThread::IO, FROM_HERE, | |
| 45 this); | |
| 46 } | |
| 47 | |
| 48 } // namespace data_reduction_proxy | |
| OLD | NEW |