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

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

Issue 2910473005: Deprecate NonThreadSafe in net/ in favor of SequenceChecker/ThreadChecker. (Closed)
Patch Set: rebase on r476634 Created 3 years, 6 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
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/thread_checker.h"
19 #include "base/trace_event/memory_dump_provider.h" 19 #include "base/trace_event/memory_dump_provider.h"
20 #include "net/base/net_export.h" 20 #include "net/base/net_export.h"
21 #include "net/base/request_priority.h" 21 #include "net/base/request_priority.h"
22 #include "net/http/http_network_session.h" 22 #include "net/http/http_network_session.h"
23 #include "net/http/http_server_properties.h" 23 #include "net/http/http_server_properties.h"
24 #include "net/http/transport_security_state.h" 24 #include "net/http/transport_security_state.h"
25 #include "net/ssl/ssl_config_service.h" 25 #include "net/ssl/ssl_config_service.h"
26 #include "net/traffic_annotation/network_traffic_annotation.h" 26 #include "net/traffic_annotation/network_traffic_annotation.h"
27 #include "net/url_request/url_request.h" 27 #include "net/url_request/url_request.h"
28 28
(...skipping 24 matching lines...) Expand all
53 class URLRequestJobFactory; 53 class URLRequestJobFactory;
54 class URLRequestThrottlerManager; 54 class URLRequestThrottlerManager;
55 55
56 // Subclass to provide application-specific context for URLRequest 56 // Subclass to provide application-specific context for URLRequest
57 // instances. URLRequestContext does not own these member variables, since they 57 // instances. URLRequestContext does not own these member variables, since they
58 // may be shared with other contexts. URLRequestContextStorage can be used for 58 // may be shared with other contexts. URLRequestContextStorage can be used for
59 // automatic lifetime management. Most callers should use an existing 59 // automatic lifetime management. Most callers should use an existing
60 // URLRequestContext rather than creating a new one, as guaranteeing that the 60 // URLRequestContext rather than creating a new one, as guaranteeing that the
61 // URLRequestContext is destroyed before its members can be difficult. 61 // URLRequestContext is destroyed before its members can be difficult.
62 class NET_EXPORT URLRequestContext 62 class NET_EXPORT URLRequestContext
63 : NON_EXPORTED_BASE(public base::NonThreadSafe), 63 : public base::trace_event::MemoryDumpProvider {
64 public base::trace_event::MemoryDumpProvider {
65 public: 64 public:
66 URLRequestContext(); 65 URLRequestContext();
67 ~URLRequestContext() override; 66 ~URLRequestContext() override;
68 67
69 // Copies the state from |other| into this context. 68 // Copies the state from |other| into this context.
70 void CopyFrom(const URLRequestContext* other); 69 void CopyFrom(const URLRequestContext* other);
71 70
72 // May return nullptr if this context doesn't have an associated network 71 // May return nullptr if this context doesn't have an associated network
73 // session. 72 // session.
74 const HttpNetworkSession::Params* GetNetworkSessionParams() const; 73 const HttpNetworkSession::Params* GetNetworkSessionParams() const;
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 277
279 // Sets a name for this URLRequestContext. Currently the name is used in 278 // Sets a name for this URLRequestContext. Currently the name is used in
280 // MemoryDumpProvier to annotate memory usage. The name does not need to be 279 // MemoryDumpProvier to annotate memory usage. The name does not need to be
281 // unique. 280 // unique.
282 void set_name(const char* name) { name_ = name; } 281 void set_name(const char* name) { name_ = name; }
283 282
284 // MemoryDumpProvider implementation: 283 // MemoryDumpProvider implementation:
285 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, 284 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
286 base::trace_event::ProcessMemoryDump* pmd) override; 285 base::trace_event::ProcessMemoryDump* pmd) override;
287 286
287 void AssertCalledOnValidThread() {
288 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
289 }
290
288 private: 291 private:
289 // --------------------------------------------------------------------------- 292 // ---------------------------------------------------------------------------
290 // Important: When adding any new members below, consider whether they need to 293 // Important: When adding any new members below, consider whether they need to
291 // be added to CopyFrom. 294 // be added to CopyFrom.
292 // --------------------------------------------------------------------------- 295 // ---------------------------------------------------------------------------
293 296
294 // Ownership for these members are not defined here. Clients should either 297 // Ownership for these members are not defined here. Clients should either
295 // provide storage elsewhere or have a subclass take ownership. 298 // provide storage elsewhere or have a subclass take ownership.
296 NetLog* net_log_; 299 NetLog* net_log_;
297 HostResolver* host_resolver_; 300 HostResolver* host_resolver_;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 333
331 // An optional name which can be set to describe this URLRequestContext. 334 // An optional name which can be set to describe this URLRequestContext.
332 // Used in MemoryDumpProvier to annotate memory usage. The name does not need 335 // Used in MemoryDumpProvier to annotate memory usage. The name does not need
333 // to be unique. 336 // to be unique.
334 const char* name_; 337 const char* name_;
335 338
336 // The largest number of outstanding URLRequests that have been created by 339 // The largest number of outstanding URLRequests that have been created by
337 // |this| and are not yet destroyed. This doesn't need to be in CopyFrom. 340 // |this| and are not yet destroyed. This doesn't need to be in CopyFrom.
338 mutable size_t largest_outstanding_requests_count_seen_; 341 mutable size_t largest_outstanding_requests_count_seen_;
339 342
343 THREAD_CHECKER(thread_checker_);
344
340 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); 345 DISALLOW_COPY_AND_ASSIGN(URLRequestContext);
341 }; 346 };
342 347
343 } // namespace net 348 } // namespace net
344 349
345 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ 350 #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