Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Unified Diff: headless/lib/browser/headless_url_request_context_getter.cc

Issue 2841953002: headless: Add support for net logging (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: headless/lib/browser/headless_url_request_context_getter.cc
diff --git a/headless/lib/browser/headless_url_request_context_getter.cc b/headless/lib/browser/headless_url_request_context_getter.cc
index 1d26484d624860bae2d9184f7c8c0e19ebe834e7..1a0f432753239723f66aa078376efbc59815d73a 100644
--- a/headless/lib/browser/headless_url_request_context_getter.cc
+++ b/headless/lib/browser/headless_url_request_context_getter.cc
@@ -26,13 +26,15 @@ HeadlessURLRequestContextGetter::HeadlessURLRequestContextGetter(
content::ProtocolHandlerMap* protocol_handlers,
ProtocolHandlerMap context_protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors,
- HeadlessBrowserContextOptions* options)
+ HeadlessBrowserContextOptions* options,
+ net::NetLog* net_log)
: io_task_runner_(std::move(io_task_runner)),
file_task_runner_(std::move(file_task_runner)),
user_agent_(options->user_agent()),
host_resolver_rules_(options->host_resolver_rules()),
proxy_server_(options->proxy_server()),
- request_interceptors_(std::move(request_interceptors)) {
+ request_interceptors_(std::move(request_interceptors)),
+ net_log_(net_log) {
// Must first be created on the UI thread.
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -78,7 +80,7 @@ HeadlessURLRequestContextGetter::GetURLRequestContext() {
if (!host_resolver_rules_.empty()) {
std::unique_ptr<net::HostResolver> host_resolver(
- net::HostResolver::CreateDefaultResolver(nullptr /* net_log */));
+ net::HostResolver::CreateDefaultResolver(net_log_));
std::unique_ptr<net::MappedHostResolver> mapped_host_resolver(
new net::MappedHostResolver(std::move(host_resolver)));
mapped_host_resolver->SetRulesFromString(host_resolver_rules_);
@@ -93,6 +95,7 @@ HeadlessURLRequestContextGetter::GetURLRequestContext() {
builder.SetInterceptors(std::move(request_interceptors_));
url_request_context_ = builder.Build();
+ url_request_context_->set_net_log(net_log_);
}
return url_request_context_.get();

Powered by Google App Engine
This is Rietveld 408576698