OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/lock.h" | 13 #include "base/lock.h" |
14 #include "base/platform_thread.h" | 14 #include "base/platform_thread.h" |
15 #include "net/url_request/url_request.h" | 15 #include "net/url_request/url_request.h" |
16 | 16 |
17 // This class is responsible for managing the set of protocol factories and | 17 // This class is responsible for managing the set of protocol factories and |
18 // request interceptors that determine how an URLRequestJob gets created to | 18 // request interceptors that determine how an net::URLRequestJob gets created to |
19 // handle an net::URLRequest. | 19 // handle an net::URLRequest. |
20 // | 20 // |
21 // MULTI-THREADING NOTICE: | 21 // MULTI-THREADING NOTICE: |
22 // net::URLRequest is designed to have all consumers on a single thread, and | 22 // net::URLRequest is designed to have all consumers on a single thread, and |
23 // so no attempt is made to support ProtocolFactory or Interceptor instances | 23 // so no attempt is made to support ProtocolFactory or Interceptor instances |
24 // being registered/unregistered or in any way poked on multiple threads. | 24 // being registered/unregistered or in any way poked on multiple threads. |
25 // However, we do support checking for supported schemes FROM ANY THREAD | 25 // However, we do support checking for supported schemes FROM ANY THREAD |
26 // (i.e., it is safe to call SupportsScheme on any thread). | 26 // (i.e., it is safe to call SupportsScheme on any thread). |
27 // | 27 // |
28 class URLRequestJobManager { | 28 class URLRequestJobManager { |
29 public: | 29 public: |
30 URLRequestJobManager(); | 30 URLRequestJobManager(); |
31 ~URLRequestJobManager(); | 31 ~URLRequestJobManager(); |
32 | 32 |
33 // Instantiate an URLRequestJob implementation based on the registered | 33 // Instantiate an net::URLRequestJob implementation based on the registered |
34 // interceptors and protocol factories. This will always succeed in | 34 // interceptors and protocol factories. This will always succeed in |
35 // returning a job unless we are--in the extreme case--out of memory. | 35 // returning a job unless we are--in the extreme case--out of memory. |
36 net::URLRequestJob* CreateJob(net::URLRequest* request) const; | 36 net::URLRequestJob* CreateJob(net::URLRequest* request) const; |
37 | 37 |
38 // Allows interceptors to hijack the request after examining the new location | 38 // Allows interceptors to hijack the request after examining the new location |
39 // of a redirect. Returns NULL if no interceptor intervenes. | 39 // of a redirect. Returns NULL if no interceptor intervenes. |
40 net::URLRequestJob* MaybeInterceptRedirect(net::URLRequest* request, | 40 net::URLRequestJob* MaybeInterceptRedirect(net::URLRequest* request, |
41 const GURL& location) const; | 41 const GURL& location) const; |
42 | 42 |
43 // Allows interceptors to hijack the request after examining the response | 43 // Allows interceptors to hijack the request after examining the response |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // check back on. | 101 // check back on. |
102 return true; | 102 return true; |
103 #endif | 103 #endif |
104 } | 104 } |
105 #endif | 105 #endif |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(URLRequestJobManager); | 107 DISALLOW_COPY_AND_ASSIGN(URLRequestJobManager); |
108 }; | 108 }; |
109 | 109 |
110 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H__ | 110 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H__ |
OLD | NEW |