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

Side by Side Diff: net/url_request/url_request_context.h

Issue 10006009: Track URLRequestContext references in a set. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add comments and track the number of leaked requests. Created 8 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
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 useful when processing resource requests. 6 // that's useful when processing resource requests.
7 // The class is reference-counted so that it can be cleaned up after any 7 // The class is reference-counted so that it can be cleaned up after any
8 // requests that are using it have been completed. 8 // requests that are using it have been completed.
9 9
10 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ 10 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_
11 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ 11 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_
12 #pragma once 12 #pragma once
13 13
14 #include <set>
wtc 2012/04/05 21:37:16 Nit: add a blank line to separate this from Chrome
14 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
17 #include "base/threading/non_thread_safe.h" 18 #include "base/threading/non_thread_safe.h"
18 #include "net/base/net_export.h" 19 #include "net/base/net_export.h"
19 #include "net/base/net_log.h" 20 #include "net/base/net_log.h"
20 #include "net/base/ssl_config_service.h" 21 #include "net/base/ssl_config_service.h"
21 #include "net/base/transport_security_state.h" 22 #include "net/base/transport_security_state.h"
22 #include "net/http/http_server_properties.h" 23 #include "net/http/http_server_properties.h"
23 #include "net/ftp/ftp_auth_cache.h" 24 #include "net/ftp/ftp_auth_cache.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 const std::string& referrer_charset() const { return referrer_charset_; } 183 const std::string& referrer_charset() const { return referrer_charset_; }
183 void set_referrer_charset(const std::string& charset) { 184 void set_referrer_charset(const std::string& charset) {
184 referrer_charset_ = charset; 185 referrer_charset_ = charset;
185 } 186 }
186 187
187 const URLRequestJobFactory* job_factory() const { return job_factory_; } 188 const URLRequestJobFactory* job_factory() const { return job_factory_; }
188 void set_job_factory(const URLRequestJobFactory* job_factory) { 189 void set_job_factory(const URLRequestJobFactory* job_factory) {
189 job_factory_ = job_factory; 190 job_factory_ = job_factory;
190 } 191 }
191 192
193 std::set<const URLRequest*>* url_requests() const {
wtc 2012/04/05 21:37:16 Please document this method. ("Gets the URLRequest
194 return url_requests_.get();
195 }
196
192 protected: 197 protected:
193 friend class base::RefCountedThreadSafe<URLRequestContext>; 198 friend class base::RefCountedThreadSafe<URLRequestContext>;
194 199
195 virtual ~URLRequestContext(); 200 virtual ~URLRequestContext();
196 201
197 private: 202 private:
198 base::WeakPtrFactory<URLRequestContext> weak_factory_; 203 base::WeakPtrFactory<URLRequestContext> weak_factory_;
199 204
200 // --------------------------------------------------------------------------- 205 // ---------------------------------------------------------------------------
201 // Important: When adding any new members below, consider whether they need to 206 // Important: When adding any new members below, consider whether they need to
(...skipping 23 matching lines...) Expand all
225 std::string referrer_charset_; 230 std::string referrer_charset_;
226 HttpTransactionFactory* http_transaction_factory_; 231 HttpTransactionFactory* http_transaction_factory_;
227 FtpTransactionFactory* ftp_transaction_factory_; 232 FtpTransactionFactory* ftp_transaction_factory_;
228 const URLRequestJobFactory* job_factory_; 233 const URLRequestJobFactory* job_factory_;
229 234
230 // --------------------------------------------------------------------------- 235 // ---------------------------------------------------------------------------
231 // Important: When adding any new members below, consider whether they need to 236 // Important: When adding any new members below, consider whether they need to
232 // be added to CopyFrom. 237 // be added to CopyFrom.
233 // --------------------------------------------------------------------------- 238 // ---------------------------------------------------------------------------
234 239
240 scoped_ptr<std::set<const URLRequest*> > url_requests_;
wtc 2012/04/05 21:37:16 This can be simply std::set<const URLRequest*>
willchan no longer on Chromium 2012/04/06 13:51:17 Actually it does, because URLRequest has access to
241
235 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); 242 DISALLOW_COPY_AND_ASSIGN(URLRequestContext);
236 }; 243 };
237 244
238 } // namespace net 245 } // namespace net
239 246
240 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ 247 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698