Index: components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc |
diff --git a/components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc b/components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..14c001eb7f9704b829d73d15eec4c48d88ec83f1 |
--- /dev/null |
+++ b/components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.cc |
@@ -0,0 +1,48 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "components/data_reduction_proxy/content/browser/data_reduction_proxy_host_impl.h" |
+ |
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h" |
+#include "content/public/browser/browser_thread.h" |
+#include "content/public/browser/render_process_host.h" |
+#include "net/base/host_port_pair.h" |
+ |
+namespace data_reduction_proxy { |
+ |
+DataReductionProxyHostImpl::DataReductionProxyHostImpl( |
+ DataReductionProxyConfig* config, |
+ content::RenderProcessHost* host) |
+ : config_(config) { |
+ // Unit tests may pass nullptr as |host|. |
+ if (host) |
+ host->AddObserver(this); |
+} |
+ |
+DataReductionProxyHostImpl::~DataReductionProxyHostImpl() {} |
+ |
+void DataReductionProxyHostImpl::BindRequest( |
+ mojom::DataReductionProxyHostRequest request) { |
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
+ bindings_.AddBinding(this, std::move(request)); |
+} |
+ |
+void DataReductionProxyHostImpl::IsDataReductionProxy( |
+ const net::HostPortPair& proxy_server, |
+ const IsDataReductionProxyCallback& callback) { |
+ if (!config_) { |
+ callback.Run(false); |
+ return; |
+ } |
+ |
+ callback.Run(config_->IsDataReductionProxy(proxy_server, nullptr)); |
+} |
+ |
+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
|
+ content::RenderProcessHost* host) { |
+ content::BrowserThread::DeleteSoon(content::BrowserThread::IO, FROM_HERE, |
+ this); |
+} |
+ |
+} // namespace data_reduction_proxy |