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

Unified Diff: net/url_request/url_request_context.h

Issue 2837313002: Add UMA to track the number of live URLRequests. (Closed)
Patch Set: use mutable 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
« no previous file with comments | « net/url_request/url_request.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 d34c2fdb3bb59c3396b32c99f8e990ce219f6b6f..206b01059971c7fb906723599c16146afe158b2b 100644
--- a/net/url_request/url_request_context.h
+++ b/net/url_request/url_request_context.h
@@ -221,10 +221,14 @@ class NET_EXPORT URLRequestContext
// Gets the URLRequest objects that hold a reference to this
// URLRequestContext.
- std::set<const URLRequest*>* url_requests() const {
- return url_requests_.get();
+ const std::set<const URLRequest*>& url_requests() const {
+ return url_requests_;
}
+ void InsertURLRequest(const URLRequest* request) const;
+
+ void RemoveURLRequest(const URLRequest* request) const;
+
// CHECKs that no URLRequests using this context remain. Subclasses should
// additionally call AssertNoURLRequests() within their own destructor,
// prior to implicit destruction of subclass-owned state.
@@ -312,7 +316,7 @@ class NET_EXPORT URLRequestContext
// be added to CopyFrom.
// ---------------------------------------------------------------------------
- std::unique_ptr<std::set<const URLRequest*>> url_requests_;
+ mutable std::set<const URLRequest*> url_requests_;
// Enables Brotli Content-Encoding support.
bool enable_brotli_;
@@ -325,6 +329,10 @@ class NET_EXPORT URLRequestContext
// to be unique.
const char* name_;
+ // The largest number of outstanding URLRequests that have been created by
+ // |this| and are not yet destroyed. This doesn't need to be in CopyFrom.
+ mutable size_t largest_outstanding_requests_count_seen_;
+
DISALLOW_COPY_AND_ASSIGN(URLRequestContext);
};
« no previous file with comments | « net/url_request/url_request.cc ('k') | net/url_request/url_request_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698