REVIEW: Re-use devtools network throttling from content layer

https://chromium-review.googlesource.com/c/chromium/src/+/664356
This commit is contained in:
deepak1556 2017-12-19 23:47:48 +05:30 committed by Aleksei Kuzmin
parent 490b1e2532
commit 007ea500d0
26 changed files with 23 additions and 1651 deletions

View file

@ -13,8 +13,6 @@
#include "base/task_scheduler/post_task.h"
#include "base/threading/sequenced_worker_pool.h"
#include "brightray/browser/browser_client.h"
#include "brightray/browser/net/devtools_network_controller_handle.h"
#include "brightray/browser/net/devtools_network_transaction_factory.h"
#include "brightray/browser/net/require_ct_delegate.h"
#include "brightray/browser/net_log.h"
#include "brightray/browser/network_delegate.h"
@ -22,6 +20,7 @@
#include "components/network_session_configurator/common/network_switches.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/cookie_store_factory.h"
#include "content/public/browser/devtools_network_transaction_factory.h"
#include "content/public/common/content_switches.h"
#include "net/base/host_mapping_rules.h"
#include "net/cert/cert_verifier.h"
@ -120,7 +119,6 @@ URLRequestContextGetter::Delegate::GetCookieableSchemes() {
URLRequestContextGetter::URLRequestContextGetter(
Delegate* delegate,
DevToolsNetworkControllerHandle* handle,
NetLog* net_log,
const base::FilePath& base_path,
bool in_memory,
@ -128,7 +126,6 @@ URLRequestContextGetter::URLRequestContextGetter(
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector protocol_interceptors)
: delegate_(delegate),
network_controller_handle_(handle),
net_log_(net_log),
base_path_(base_path),
in_memory_(in_memory),
@ -335,20 +332,10 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
backend.reset(delegate_->CreateHttpCacheBackendFactory(base_path_));
}
if (network_controller_handle_) {
storage_->set_http_transaction_factory(base::WrapUnique(
new net::HttpCache(
base::WrapUnique(new DevToolsNetworkTransactionFactory(
network_controller_handle_->GetController(),
http_network_session_.get())),
std::move(backend),
false)));
} else {
storage_->set_http_transaction_factory(base::WrapUnique(
new net::HttpCache(http_network_session_.get(),
std::move(backend),
false)));
}
storage_->set_http_transaction_factory(base::MakeUnique<net::HttpCache>(
content::CreateDevToolsNetworkTransactionFactory(
http_network_session_.get()),
std::move(backend), false));
std::unique_ptr<net::URLRequestJobFactory> job_factory =
delegate_->CreateURLRequestJobFactory(&protocol_handlers_);