| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
| 11 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
| 12 #include "net/url_request/url_request.h" | 12 #include "net/url_request/url_request.h" |
| 13 | 13 |
| 14 namespace base { |
| 14 template <typename T> struct DefaultSingletonTraits; | 15 template <typename T> struct DefaultSingletonTraits; |
| 16 } // namespace base |
| 15 | 17 |
| 16 namespace net { | 18 namespace net { |
| 17 | 19 |
| 18 // This class is responsible for managing the set of protocol factories and | 20 // This class is responsible for managing the set of protocol factories and |
| 19 // request interceptors that determine how an URLRequestJob gets created to | 21 // request interceptors that determine how an URLRequestJob gets created to |
| 20 // handle an URLRequest. | 22 // handle an URLRequest. |
| 21 // | 23 // |
| 22 // MULTI-THREADING NOTICE: | 24 // MULTI-THREADING NOTICE: |
| 23 // URLRequest is designed to have all consumers on a single thread, and | 25 // URLRequest is designed to have all consumers on a single thread, and |
| 24 // so no attempt is made to support Interceptor instances being | 26 // so no attempt is made to support Interceptor instances being |
| (...skipping 19 matching lines...) Expand all Loading... |
| 44 // status and headers. This is also called when there is no server response | 46 // status and headers. This is also called when there is no server response |
| 45 // at all to allow interception of failed requests due to network errors. | 47 // at all to allow interception of failed requests due to network errors. |
| 46 // Returns NULL if no interceptor intervenes. | 48 // Returns NULL if no interceptor intervenes. |
| 47 URLRequestJob* MaybeInterceptResponse( | 49 URLRequestJob* MaybeInterceptResponse( |
| 48 URLRequest* request, NetworkDelegate* network_delegate) const; | 50 URLRequest* request, NetworkDelegate* network_delegate) const; |
| 49 | 51 |
| 50 // Returns true if the manager has a built-in handler for |scheme|. | 52 // Returns true if the manager has a built-in handler for |scheme|. |
| 51 static bool SupportsScheme(const std::string& scheme); | 53 static bool SupportsScheme(const std::string& scheme); |
| 52 | 54 |
| 53 private: | 55 private: |
| 54 friend struct DefaultSingletonTraits<URLRequestJobManager>; | 56 friend struct base::DefaultSingletonTraits<URLRequestJobManager>; |
| 55 | 57 |
| 56 URLRequestJobManager(); | 58 URLRequestJobManager(); |
| 57 ~URLRequestJobManager(); | 59 ~URLRequestJobManager(); |
| 58 | 60 |
| 59 // The first guy to call this function sets the allowed thread. This way we | 61 // The first guy to call this function sets the allowed thread. This way we |
| 60 // avoid needing to define that thread externally. Since we expect all | 62 // avoid needing to define that thread externally. Since we expect all |
| 61 // callers to be on the same thread, we don't worry about threads racing to | 63 // callers to be on the same thread, we don't worry about threads racing to |
| 62 // set the allowed thread. | 64 // set the allowed thread. |
| 63 bool IsAllowedThread() const { | 65 bool IsAllowedThread() const { |
| 64 #if 0 | 66 #if 0 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 80 return true; | 82 return true; |
| 81 } | 83 } |
| 82 #endif | 84 #endif |
| 83 | 85 |
| 84 DISALLOW_COPY_AND_ASSIGN(URLRequestJobManager); | 86 DISALLOW_COPY_AND_ASSIGN(URLRequestJobManager); |
| 85 }; | 87 }; |
| 86 | 88 |
| 87 } // namespace net | 89 } // namespace net |
| 88 | 90 |
| 89 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_ | 91 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_ |
| OLD | NEW |