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

Unified Diff: net/url_request/url_request_context_builder.cc

Issue 2956023003: Add enable_reporting to fix size regression in Cronet. (Closed)
Patch Set: 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
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 6d5e797f7dbdc5724938bf72530e90a48a4dd308..ce77bb87820aa5781bb2a6f3b77dbe6a382aa034 100644
--- a/net/url_request/url_request_context_builder.cc
+++ b/net/url_request/url_request_context_builder.cc
@@ -39,8 +39,6 @@
#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"
@@ -63,6 +61,11 @@
#include "net/url_request/ftp_protocol_handler.h" // nogncheck
#endif
+#if BUILDFLAG(ENABLE_REPORTING)
+#include "net/reporting/reporting_policy.h"
+#include "net/reporting/reporting_service.h"
+#endif // BUILDFLAG(ENABLE_REPORTING)
+
namespace net {
namespace {
@@ -149,9 +152,11 @@ class ContainerURLRequestContext final : public URLRequestContext {
: file_task_runner_(file_task_runner), storage_(this) {}
~ContainerURLRequestContext() override {
+#if BUILDFLAG(ENABLE_REPORTING)
// Destroy the ReportingService before the rest of the URLRequestContext, so
// it cancels any pending requests it may have.
storage_.set_reporting_service(nullptr);
+#endif // BUILDFLAG(ENABLE_REPORTING)
// 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
@@ -277,10 +282,12 @@ void URLRequestContextBuilder::SetCertVerifier(
cert_verifier_ = std::move(cert_verifier);
}
+#if BUILDFLAG(ENABLE_REPORTING)
void URLRequestContextBuilder::set_reporting_policy(
std::unique_ptr<net::ReportingPolicy> reporting_policy) {
reporting_policy_ = std::move(reporting_policy);
}
+#endif // BUILDFLAG(ENABLE_REPORTING)
void URLRequestContextBuilder::SetInterceptors(
std::vector<std::unique_ptr<URLRequestInterceptor>>
@@ -516,10 +523,12 @@ std::unique_ptr<URLRequestContext> URLRequestContextBuilder::Build() {
}
storage->set_job_factory(std::move(top_job_factory));
+#if BUILDFLAG(ENABLE_REPORTING)
if (reporting_policy_) {
storage->set_reporting_service(
ReportingService::Create(*reporting_policy_, context.get()));
}
+#endif // BUILDFLAG(ENABLE_REPORTING)
return std::move(context);
}

Powered by Google App Engine
This is Rietveld 408576698