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