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

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

Issue 2536723009: Make net::URLRequestContext a MemoryDumpProvider (Closed)
Patch Set: Created 4 years 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 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
11 #include <memory> 11 #include <memory>
12 #include <set> 12 #include <set>
13 #include <string> 13 #include <string>
14 14
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/threading/non_thread_safe.h" 18 #include "base/threading/non_thread_safe.h"
19 #include "base/trace_event/memory_dump_provider.h"
19 #include "net/base/net_export.h" 20 #include "net/base/net_export.h"
20 #include "net/base/request_priority.h" 21 #include "net/base/request_priority.h"
21 #include "net/http/http_network_session.h" 22 #include "net/http/http_network_session.h"
22 #include "net/http/http_server_properties.h" 23 #include "net/http/http_server_properties.h"
23 #include "net/http/transport_security_state.h" 24 #include "net/http/transport_security_state.h"
24 #include "net/ssl/ssl_config_service.h" 25 #include "net/ssl/ssl_config_service.h"
25 #include "net/url_request/url_request.h" 26 #include "net/url_request/url_request.h"
26 27
28 namespace base {
29 namespace trace_event {
30 class ProcessMemoryDump;
31 }
32 }
33
27 namespace net { 34 namespace net {
28 class CertVerifier; 35 class CertVerifier;
29 class ChannelIDService; 36 class ChannelIDService;
30 class CookieStore; 37 class CookieStore;
31 class CTPolicyEnforcer; 38 class CTPolicyEnforcer;
32 class CTVerifier; 39 class CTVerifier;
33 class HostResolver; 40 class HostResolver;
34 class HttpAuthHandlerFactory; 41 class HttpAuthHandlerFactory;
35 class HttpTransactionFactory; 42 class HttpTransactionFactory;
36 class HttpUserAgentSettings; 43 class HttpUserAgentSettings;
37 class NetLog; 44 class NetLog;
38 class NetworkDelegate; 45 class NetworkDelegate;
39 class NetworkQualityEstimator; 46 class NetworkQualityEstimator;
40 class SdchManager; 47 class SdchManager;
41 class ProxyService; 48 class ProxyService;
42 class URLRequest; 49 class URLRequest;
43 class URLRequestBackoffManager; 50 class URLRequestBackoffManager;
44 class URLRequestJobFactory; 51 class URLRequestJobFactory;
45 class URLRequestThrottlerManager; 52 class URLRequestThrottlerManager;
46 53
47 // Subclass to provide application-specific context for URLRequest 54 // Subclass to provide application-specific context for URLRequest
48 // instances. URLRequestContext does not own these member variables, since they 55 // instances. URLRequestContext does not own these member variables, since they
49 // may be shared with other contexts. URLRequestContextStorage can be used for 56 // may be shared with other contexts. URLRequestContextStorage can be used for
50 // automatic lifetime management. Most callers should use an existing 57 // automatic lifetime management. Most callers should use an existing
51 // URLRequestContext rather than creating a new one, as guaranteeing that the 58 // URLRequestContext rather than creating a new one, as guaranteeing that the
52 // URLRequestContext is destroyed before its members can be difficult. 59 // URLRequestContext is destroyed before its members can be difficult.
53 class NET_EXPORT URLRequestContext 60 class NET_EXPORT URLRequestContext
54 : NON_EXPORTED_BASE(public base::NonThreadSafe) { 61 : NON_EXPORTED_BASE(public base::NonThreadSafe),
62 public base::trace_event::MemoryDumpProvider {
55 public: 63 public:
56 URLRequestContext(); 64 URLRequestContext();
57 virtual ~URLRequestContext(); 65 ~URLRequestContext() override;
58 66
59 // Copies the state from |other| into this context. 67 // Copies the state from |other| into this context.
60 void CopyFrom(const URLRequestContext* other); 68 void CopyFrom(const URLRequestContext* other);
61 69
62 // May return nullptr if this context doesn't have an associated network 70 // May return nullptr if this context doesn't have an associated network
63 // session. 71 // session.
64 const HttpNetworkSession::Params* GetNetworkSessionParams() const; 72 const HttpNetworkSession::Params* GetNetworkSessionParams() const;
65 73
66 std::unique_ptr<URLRequest> CreateRequest( 74 std::unique_ptr<URLRequest> CreateRequest(
67 const GURL& url, 75 const GURL& url,
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } 231 }
224 void set_network_quality_estimator( 232 void set_network_quality_estimator(
225 NetworkQualityEstimator* network_quality_estimator) { 233 NetworkQualityEstimator* network_quality_estimator) {
226 network_quality_estimator_ = network_quality_estimator; 234 network_quality_estimator_ = network_quality_estimator;
227 } 235 }
228 236
229 void set_enable_brotli(bool enable_brotli) { enable_brotli_ = enable_brotli; } 237 void set_enable_brotli(bool enable_brotli) { enable_brotli_ = enable_brotli; }
230 238
231 bool enable_brotli() const { return enable_brotli_; } 239 bool enable_brotli() const { return enable_brotli_; }
232 240
241 void set_name_string(const std::string& name_string) {
eroman 2016/12/01 22:16:00 how about calling this "set_name()" and the variab
xunjieli 2016/12/01 22:45:22 Done.
242 name_string_ = name_string;
243 }
244
245 // MemoryDumpProvider implementation:
246 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
247 base::trace_event::ProcessMemoryDump* pmd) override;
248
233 private: 249 private:
234 // --------------------------------------------------------------------------- 250 // ---------------------------------------------------------------------------
235 // Important: When adding any new members below, consider whether they need to 251 // Important: When adding any new members below, consider whether they need to
236 // be added to CopyFrom. 252 // be added to CopyFrom.
237 // --------------------------------------------------------------------------- 253 // ---------------------------------------------------------------------------
238 254
239 // Ownership for these members are not defined here. Clients should either 255 // Ownership for these members are not defined here. Clients should either
240 // provide storage elsewhere or have a subclass take ownership. 256 // provide storage elsewhere or have a subclass take ownership.
241 NetLog* net_log_; 257 NetLog* net_log_;
242 HostResolver* host_resolver_; 258 HostResolver* host_resolver_;
(...skipping 19 matching lines...) Expand all
262 // --------------------------------------------------------------------------- 278 // ---------------------------------------------------------------------------
263 // Important: When adding any new members below, consider whether they need to 279 // Important: When adding any new members below, consider whether they need to
264 // be added to CopyFrom. 280 // be added to CopyFrom.
265 // --------------------------------------------------------------------------- 281 // ---------------------------------------------------------------------------
266 282
267 std::unique_ptr<std::set<const URLRequest*>> url_requests_; 283 std::unique_ptr<std::set<const URLRequest*>> url_requests_;
268 284
269 // Enables Brotli Content-Encoding support. 285 // Enables Brotli Content-Encoding support.
270 bool enable_brotli_; 286 bool enable_brotli_;
271 287
288 std::string name_string_;
289
272 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); 290 DISALLOW_COPY_AND_ASSIGN(URLRequestContext);
273 }; 291 };
274 292
275 } // namespace net 293 } // namespace net
276 294
277 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ 295 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698