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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This class represents contextual information (cookies, cache, etc.) 5 // This class represents contextual information (cookies, cache, etc.)
6 // that's necessary when processing resource requests. 6 // that's necessary when processing resource requests.
7 7
8 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ 8 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_
9 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ 9 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_
10 10
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } 214 }
215 215
216 // May return nullptr. 216 // May return nullptr.
217 SdchManager* sdch_manager() const { return sdch_manager_; } 217 SdchManager* sdch_manager() const { return sdch_manager_; }
218 void set_sdch_manager(SdchManager* sdch_manager) { 218 void set_sdch_manager(SdchManager* sdch_manager) {
219 sdch_manager_ = sdch_manager; 219 sdch_manager_ = sdch_manager;
220 } 220 }
221 221
222 // Gets the URLRequest objects that hold a reference to this 222 // Gets the URLRequest objects that hold a reference to this
223 // URLRequestContext. 223 // URLRequestContext.
224 std::set<const URLRequest*>* url_requests() const { 224 const std::set<const URLRequest*>& url_requests() const {
225 return url_requests_.get(); 225 return url_requests_;
226 } 226 }
227 227
228 void InsertURLRequest(const URLRequest* request) const;
229
230 void RemoveURLRequest(const URLRequest* request) const;
231
228 // CHECKs that no URLRequests using this context remain. Subclasses should 232 // CHECKs that no URLRequests using this context remain. Subclasses should
229 // additionally call AssertNoURLRequests() within their own destructor, 233 // additionally call AssertNoURLRequests() within their own destructor,
230 // prior to implicit destruction of subclass-owned state. 234 // prior to implicit destruction of subclass-owned state.
231 void AssertNoURLRequests() const; 235 void AssertNoURLRequests() const;
232 236
233 // Get the underlying |HttpUserAgentSettings| implementation that provides 237 // Get the underlying |HttpUserAgentSettings| implementation that provides
234 // the HTTP Accept-Language and User-Agent header values. 238 // the HTTP Accept-Language and User-Agent header values.
235 const HttpUserAgentSettings* http_user_agent_settings() const { 239 const HttpUserAgentSettings* http_user_agent_settings() const {
236 return http_user_agent_settings_; 240 return http_user_agent_settings_;
237 } 241 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 URLRequestBackoffManager* backoff_manager_; 309 URLRequestBackoffManager* backoff_manager_;
306 SdchManager* sdch_manager_; 310 SdchManager* sdch_manager_;
307 NetworkQualityEstimator* network_quality_estimator_; 311 NetworkQualityEstimator* network_quality_estimator_;
308 ReportingService* reporting_service_; 312 ReportingService* reporting_service_;
309 313
310 // --------------------------------------------------------------------------- 314 // ---------------------------------------------------------------------------
311 // Important: When adding any new members below, consider whether they need to 315 // Important: When adding any new members below, consider whether they need to
312 // be added to CopyFrom. 316 // be added to CopyFrom.
313 // --------------------------------------------------------------------------- 317 // ---------------------------------------------------------------------------
314 318
315 std::unique_ptr<std::set<const URLRequest*>> url_requests_; 319 mutable std::set<const URLRequest*> url_requests_;
316 320
317 // Enables Brotli Content-Encoding support. 321 // Enables Brotli Content-Encoding support.
318 bool enable_brotli_; 322 bool enable_brotli_;
319 // Enables checking system policy before allowing a cleartext http or ws 323 // Enables checking system policy before allowing a cleartext http or ws
320 // request. Only used on Android. 324 // request. Only used on Android.
321 bool check_cleartext_permitted_; 325 bool check_cleartext_permitted_;
322 326
323 // An optional name which can be set to describe this URLRequestContext. 327 // An optional name which can be set to describe this URLRequestContext.
324 // Used in MemoryDumpProvier to annotate memory usage. The name does not need 328 // Used in MemoryDumpProvier to annotate memory usage. The name does not need
325 // to be unique. 329 // to be unique.
326 const char* name_; 330 const char* name_;
327 331
332 // The largest number of outstanding URLRequests that have been created by
333 // |this| and are not yet destroyed. This doesn't need to be in CopyFrom.
334 mutable size_t largest_outstanding_requests_count_seen_;
335
328 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); 336 DISALLOW_COPY_AND_ASSIGN(URLRequestContext);
329 }; 337 };
330 338
331 } // namespace net 339 } // namespace net
332 340
333 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ 341 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_
OLDNEW
« 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