| 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 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
| 12 #include "base/threading/platform_thread.h" | 12 #include "base/threading/platform_thread.h" |
| 13 #include "net/base/net_export.h" |
| 13 #include "net/url_request/url_request.h" | 14 #include "net/url_request/url_request.h" |
| 14 | 15 |
| 15 template <typename T> struct DefaultSingletonTraits; | 16 template <typename T> struct DefaultSingletonTraits; |
| 16 | 17 |
| 17 namespace net { | 18 namespace net { |
| 18 | 19 |
| 19 // 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 |
| 20 // request interceptors that determine how an URLRequestJob gets created to | 21 // request interceptors that determine how an URLRequestJob gets created to |
| 21 // handle an URLRequest. | 22 // handle an URLRequest. |
| 22 // | 23 // |
| 23 // MULTI-THREADING NOTICE: | 24 // MULTI-THREADING NOTICE: |
| 24 // 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 |
| 25 // so no attempt is made to support Interceptor instances being | 26 // so no attempt is made to support Interceptor instances being |
| 26 // registered/unregistered or in any way poked on multiple threads. | 27 // registered/unregistered or in any way poked on multiple threads. |
| 27 class URLRequestJobManager { | 28 class NET_EXPORT URLRequestJobManager { |
| 28 public: | 29 public: |
| 29 // Returns the singleton instance. | 30 // Returns the singleton instance. |
| 30 static URLRequestJobManager* GetInstance(); | 31 static URLRequestJobManager* GetInstance(); |
| 31 | 32 |
| 32 // Instantiate an URLRequestJob implementation based on the registered | 33 // Instantiate an URLRequestJob implementation based on the registered |
| 33 // interceptors and protocol factories. This will always succeed in | 34 // interceptors and protocol factories. This will always succeed in |
| 34 // 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. |
| 35 URLRequestJob* CreateJob(URLRequest* request, | 36 URLRequestJob* CreateJob(URLRequest* request, |
| 36 NetworkDelegate* network_delegate) const; | 37 NetworkDelegate* network_delegate) const; |
| 37 | 38 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 #endif | 88 #endif |
| 88 | 89 |
| 89 mutable base::Lock lock_; | 90 mutable base::Lock lock_; |
| 90 | 91 |
| 91 DISALLOW_COPY_AND_ASSIGN(URLRequestJobManager); | 92 DISALLOW_COPY_AND_ASSIGN(URLRequestJobManager); |
| 92 }; | 93 }; |
| 93 | 94 |
| 94 } // namespace net | 95 } // namespace net |
| 95 | 96 |
| 96 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_ | 97 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_MANAGER_H_ |
| OLD | NEW |