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

Unified Diff: net/url_request/url_request_context_builder.cc

Issue 2956023003: Add enable_reporting to fix size regression in Cronet. (Closed)
Patch Set: Move build_config header back to top, to fix windows 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') | net/url_request/url_request_context_storage.h » ('j') | 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 fe2829257d82ea3364a5550e6fc1b2715e8c65fb..b3b53d1d4b16f85e179ec0226242024ab5547150 100644
--- a/net/url_request/url_request_context_builder.cc
+++ b/net/url_request/url_request_context_builder.cc
@@ -38,8 +38,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"
@@ -62,6 +60,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 {
@@ -146,9 +149,11 @@ class ContainerURLRequestContext final : public URLRequestContext {
ContainerURLRequestContext() : 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
@@ -258,10 +263,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>>
@@ -509,10 +516,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);
}
« no previous file with comments | « net/url_request/url_request_context_builder.h ('k') | net/url_request/url_request_context_storage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698