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

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: fix compile 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
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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 273
275 // Sets a name for this URLRequestContext. Currently the name is used in 274 // Sets a name for this URLRequestContext. Currently the name is used in
276 // MemoryDumpProvier to annotate memory usage. The name does not need to be 275 // MemoryDumpProvier to annotate memory usage. The name does not need to be
277 // unique. 276 // unique.
278 void set_name(const char* name) { name_ = name; } 277 void set_name(const char* name) { name_ = name; }
279 278
280 // MemoryDumpProvider implementation: 279 // MemoryDumpProvider implementation:
281 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, 280 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
282 base::trace_event::ProcessMemoryDump* pmd) override; 281 base::trace_event::ProcessMemoryDump* pmd) override;
283 282
283 void AssertCalledOnValidThread() {
284 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
285 }
mmenke 2017/05/31 19:28:08 De-inline this?
gab 2017/05/31 20:46:36 If inlined the compiler can know to compile it out
286
284 private: 287 private:
285 // --------------------------------------------------------------------------- 288 // ---------------------------------------------------------------------------
286 // Important: When adding any new members below, consider whether they need to 289 // Important: When adding any new members below, consider whether they need to
287 // be added to CopyFrom. 290 // be added to CopyFrom.
288 // --------------------------------------------------------------------------- 291 // ---------------------------------------------------------------------------
289 292
290 // Ownership for these members are not defined here. Clients should either 293 // Ownership for these members are not defined here. Clients should either
291 // provide storage elsewhere or have a subclass take ownership. 294 // provide storage elsewhere or have a subclass take ownership.
292 NetLog* net_log_; 295 NetLog* net_log_;
293 HostResolver* host_resolver_; 296 HostResolver* host_resolver_;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 329
327 // An optional name which can be set to describe this URLRequestContext. 330 // An optional name which can be set to describe this URLRequestContext.
328 // Used in MemoryDumpProvier to annotate memory usage. The name does not need 331 // Used in MemoryDumpProvier to annotate memory usage. The name does not need
329 // to be unique. 332 // to be unique.
330 const char* name_; 333 const char* name_;
331 334
332 // The largest number of outstanding URLRequests that have been created by 335 // 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. 336 // |this| and are not yet destroyed. This doesn't need to be in CopyFrom.
334 mutable size_t largest_outstanding_requests_count_seen_; 337 mutable size_t largest_outstanding_requests_count_seen_;
335 338
339 THREAD_CHECKER(thread_checker_);
340
336 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); 341 DISALLOW_COPY_AND_ASSIGN(URLRequestContext);
337 }; 342 };
338 343
339 } // namespace net 344 } // namespace net
340 345
341 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ 346 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698