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

Unified Diff: net/url_request/url_request_context.h

Issue 998803003: Checks to enforce relative lifetimes for SdchManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporated comments and fixed else clause. Created 5 years, 9 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/sdch/sdch_owner.cc ('k') | net/url_request/url_request_context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_context.h
diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h
index 992f985f0332b441af1c21614e27a5c48974cd4f..fc0709804c385059d3b339ce83934e59e826445f 100644
--- a/net/url_request/url_request_context.h
+++ b/net/url_request/url_request_context.h
@@ -20,6 +20,7 @@
#include "net/base/net_export.h"
#include "net/base/net_log.h"
#include "net/base/request_priority.h"
+#include "net/base/sdch_manager.h"
#include "net/http/http_network_session.h"
#include "net/http/http_server_properties.h"
#include "net/http/transport_security_state.h"
@@ -186,10 +187,17 @@ class NET_EXPORT URLRequestContext
// May be NULL.
SdchManager* sdch_manager() const {
- return sdch_manager_;
+ // For investigation of http://crbug.com/454198; remove ?: when resolved.
+ CHECK(!have_sdch_manager_ || sdch_manager_.get());
+ return have_sdch_manager_ ? sdch_manager_.get() : NULL;
}
void set_sdch_manager(SdchManager* sdch_manager) {
- sdch_manager_ = sdch_manager;
+ // For investigation of http://crbug.com/454198; simplify when resolved.
+ have_sdch_manager_ = !!sdch_manager;
+ if (have_sdch_manager_)
+ sdch_manager_ = sdch_manager->GetWeakPtr();
+ else
+ sdch_manager_.reset();
}
// Gets the URLRequest objects that hold a reference to this
@@ -238,7 +246,9 @@ class NET_EXPORT URLRequestContext
HttpTransactionFactory* http_transaction_factory_;
const URLRequestJobFactory* job_factory_;
URLRequestThrottlerManager* throttler_manager_;
- SdchManager* sdch_manager_;
+ // For investigation of http://crbug.com/454198; remove WeakPtr when resolved.
+ bool have_sdch_manager_;
+ base::WeakPtr<SdchManager> sdch_manager_;
// ---------------------------------------------------------------------------
// Important: When adding any new members below, consider whether they need to
« no previous file with comments | « net/sdch/sdch_owner.cc ('k') | net/url_request/url_request_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698