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

Unified Diff: net/url_request/url_request_context_builder.cc

Issue 2933333002: URLRequestContextBuilder: Add the ability to create a ReportingService. (Closed)
Patch Set: Juggle things around a little Created 3 years, 6 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
« no previous file with comments | « net/url_request/url_request_context_builder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_context_builder.cc
diff --git a/net/url_request/url_request_context_builder.cc b/net/url_request/url_request_context_builder.cc
index 85a19f401ad5d3bb124fdcd8a7de6a78df4321ff..dad5d84575df3fa3ddafd778784653216a31b558 100644
--- a/net/url_request/url_request_context_builder.cc
+++ b/net/url_request/url_request_context_builder.cc
@@ -39,6 +39,8 @@
#include "net/net_features.h"
#include "net/nqe/network_quality_estimator.h"
#include "net/quic/chromium/quic_stream_factory.h"
+#include "net/reporting/reporting_policy.h"
+#include "net/reporting/reporting_service.h"
#include "net/ssl/channel_id_service.h"
#include "net/ssl/default_channel_id_store.h"
#include "net/ssl/ssl_config_service_defaults.h"
@@ -144,6 +146,10 @@ class ContainerURLRequestContext final : public URLRequestContext {
: file_task_runner_(file_task_runner), storage_(this) {}
~ContainerURLRequestContext() override {
+ // Destroy the ReportingService before the rest of the URLRequestContext, so
+ // it cancels any pending requests it may have.
+ storage_.set_reporting_service(nullptr);
+
// Shut down the ProxyService, as it may have pending URLRequests using this
// context. Since this cancels requests, it's not safe to subclass this, as
// some parts of the URLRequestContext may then be torn down before this
@@ -268,6 +274,11 @@ void URLRequestContextBuilder::SetCertVerifier(
cert_verifier_ = std::move(cert_verifier);
}
+void URLRequestContextBuilder::set_reporting_policy(
+ std::unique_ptr<net::ReportingPolicy> reporting_policy) {
+ reporting_policy_ = std::move(reporting_policy);
+}
+
void URLRequestContextBuilder::SetInterceptors(
std::vector<std::unique_ptr<URLRequestInterceptor>>
url_request_interceptors) {
@@ -496,7 +507,11 @@ std::unique_ptr<URLRequestContext> URLRequestContextBuilder::Build() {
url_request_interceptors_.clear();
}
storage->set_job_factory(std::move(top_job_factory));
- // TODO(willchan): Support sdch.
+
+ if (reporting_policy_) {
+ storage->set_reporting_service(
+ ReportingService::Create(*reporting_policy_, context.get()));
+ }
return std::move(context);
}
« no previous file with comments | « net/url_request/url_request_context_builder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698