OLD | NEW |
---|---|
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 #ifndef NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_ |
6 #define NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
13 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
14 #include "net/base/net_export.h" | |
14 #include "net/url_request/url_request.h" | 15 #include "net/url_request/url_request.h" |
15 | 16 |
16 template <typename T> struct DefaultSingletonTraits; | 17 template <typename T> struct DefaultSingletonTraits; |
17 | 18 |
18 namespace net { | 19 namespace net { |
19 | 20 |
20 // This class is responsible for managing the set of protocol factories and | 21 // This class is responsible for managing the set of protocol factories and |
21 // request interceptors that determine how an URLRequestJob gets created to | 22 // request interceptors that determine how an URLRequestJob gets created to |
22 // handle an URLRequest. | 23 // handle an URLRequest. |
23 // | 24 // |
24 // MULTI-THREADING NOTICE: | 25 // MULTI-THREADING NOTICE: |
25 // URLRequest is designed to have all consumers on a single thread, and | 26 // URLRequest is designed to have all consumers on a single thread, and |
26 // so no attempt is made to support ProtocolFactory or Interceptor instances | 27 // so no attempt is made to support ProtocolFactory or Interceptor instances |
27 // being registered/unregistered or in any way poked on multiple threads. | 28 // being registered/unregistered or in any way poked on multiple threads. |
28 // However, we do support checking for supported schemes FROM ANY THREAD | 29 // However, we do support checking for supported schemes FROM ANY THREAD |
29 // (i.e., it is safe to call SupportsScheme on any thread). | 30 // (i.e., it is safe to call SupportsScheme on any thread). |
30 // | 31 // |
31 class URLRequestJobManager { | 32 class NET_EXPORT URLRequestJobManager { |
Ryan Sleevi
2013/03/27 19:06:21
Where is this being used?
I'm a little nervous ab
Yaron
2013/03/27 19:10:17
To be honest I didn't investigate too closely. Loo
| |
32 public: | 33 public: |
33 // Returns the singleton instance. | 34 // Returns the singleton instance. |
34 static URLRequestJobManager* GetInstance(); | 35 static URLRequestJobManager* GetInstance(); |
35 | 36 |
36 // Instantiate an URLRequestJob implementation based on the registered | 37 // Instantiate an URLRequestJob implementation based on the registered |
37 // interceptors and protocol factories. This will always succeed in | 38 // interceptors and protocol factories. This will always succeed in |
38 // returning a job unless we are--in the extreme case--out of memory. | 39 // returning a job unless we are--in the extreme case--out of memory. |
39 URLRequestJob* CreateJob(URLRequest* request, | 40 URLRequestJob* CreateJob(URLRequest* request, |
40 NetworkDelegate* network_delegate) const; | 41 NetworkDelegate* network_delegate) const; |
41 | 42 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 mutable base::Lock lock_; | 108 mutable base::Lock lock_; |
108 FactoryMap factories_; | 109 FactoryMap factories_; |
109 InterceptorList interceptors_; | 110 InterceptorList interceptors_; |
110 | 111 |
111 DISALLOW_COPY_AND_ASSIGN(URLRequestJobManager); | 112 DISALLOW_COPY_AND_ASSIGN(URLRequestJobManager); |
112 }; | 113 }; |
113 | 114 |
114 } // namespace net | 115 } // namespace net |
115 | 116 |
116 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_ | 117 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_ |
OLD | NEW |