| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "net/url_request/url_request_job_manager.h" | 5 #include "net/url_request/url_request_job_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "base/singleton.h" |
| 10 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 11 #include "net/base/load_flags.h" | 12 #include "net/base/load_flags.h" |
| 12 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
| 13 #include "net/url_request/url_request_about_job.h" | 14 #include "net/url_request/url_request_about_job.h" |
| 14 #include "net/url_request/url_request_data_job.h" | 15 #include "net/url_request/url_request_data_job.h" |
| 15 #include "net/url_request/url_request_error_job.h" | 16 #include "net/url_request/url_request_error_job.h" |
| 16 #include "net/url_request/url_request_file_job.h" | 17 #include "net/url_request/url_request_file_job.h" |
| 17 #include "net/url_request/url_request_ftp_job.h" | 18 #include "net/url_request/url_request_ftp_job.h" |
| 18 #include "net/url_request/url_request_http_job.h" | 19 #include "net/url_request/url_request_http_job.h" |
| 19 | 20 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 38 | 39 |
| 39 URLRequestJobManager::URLRequestJobManager() : enable_file_access_(false) { | 40 URLRequestJobManager::URLRequestJobManager() : enable_file_access_(false) { |
| 40 #ifndef NDEBUG | 41 #ifndef NDEBUG |
| 41 allowed_thread_ = 0; | 42 allowed_thread_ = 0; |
| 42 allowed_thread_initialized_ = false; | 43 allowed_thread_initialized_ = false; |
| 43 #endif | 44 #endif |
| 44 } | 45 } |
| 45 | 46 |
| 46 URLRequestJobManager::~URLRequestJobManager() {} | 47 URLRequestJobManager::~URLRequestJobManager() {} |
| 47 | 48 |
| 49 // static |
| 50 URLRequestJobManager* URLRequestJobManager::GetInstance() { |
| 51 return Singleton<URLRequestJobManager>::get(); |
| 52 } |
| 53 |
| 48 URLRequestJob* URLRequestJobManager::CreateJob(net::URLRequest* request) const { | 54 URLRequestJob* URLRequestJobManager::CreateJob(net::URLRequest* request) const { |
| 49 #ifndef NDEBUG | 55 #ifndef NDEBUG |
| 50 DCHECK(IsAllowedThread()); | 56 DCHECK(IsAllowedThread()); |
| 51 #endif | 57 #endif |
| 52 | 58 |
| 53 // If we are given an invalid URL, then don't even try to inspect the scheme. | 59 // If we are given an invalid URL, then don't even try to inspect the scheme. |
| 54 if (!request->url().is_valid()) | 60 if (!request->url().is_valid()) |
| 55 return new URLRequestErrorJob(request, net::ERR_INVALID_URL); | 61 return new URLRequestErrorJob(request, net::ERR_INVALID_URL); |
| 56 | 62 |
| 57 // We do this here to avoid asking interceptors about unsupported schemes. | 63 // We do this here to avoid asking interceptors about unsupported schemes. |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 DCHECK(IsAllowedThread()); | 204 DCHECK(IsAllowedThread()); |
| 199 #endif | 205 #endif |
| 200 | 206 |
| 201 AutoLock locked(lock_); | 207 AutoLock locked(lock_); |
| 202 | 208 |
| 203 InterceptorList::iterator i = | 209 InterceptorList::iterator i = |
| 204 std::find(interceptors_.begin(), interceptors_.end(), interceptor); | 210 std::find(interceptors_.begin(), interceptors_.end(), interceptor); |
| 205 DCHECK(i != interceptors_.end()); | 211 DCHECK(i != interceptors_.end()); |
| 206 interceptors_.erase(i); | 212 interceptors_.erase(i); |
| 207 } | 213 } |
| OLD | NEW |