| 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/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "net/base/load_flags.h" | 11 #include "net/base/load_flags.h" |
| 12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 13 #include "net/url_request/url_request_about_job.h" | 13 #include "net/url_request/url_request_about_job.h" |
| 14 #include "net/url_request/url_request_data_job.h" |
| 14 #include "net/url_request/url_request_error_job.h" | 15 #include "net/url_request/url_request_error_job.h" |
| 15 #include "net/url_request/url_request_file_job.h" | 16 #include "net/url_request/url_request_file_job.h" |
| 16 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 17 #include "net/url_request/url_request_ftp_job.h" | 18 #include "net/url_request/url_request_ftp_job.h" |
| 18 #else | 19 #else |
| 19 #include "net/url_request/url_request_new_ftp_job.h" | 20 #include "net/url_request/url_request_new_ftp_job.h" |
| 20 #endif | 21 #endif |
| 21 #include "net/url_request/url_request_http_job.h" | 22 #include "net/url_request/url_request_http_job.h" |
| 22 | 23 |
| 23 // The built-in set of protocol factories | 24 // The built-in set of protocol factories |
| 24 namespace { | 25 namespace { |
| 25 | 26 |
| 26 struct SchemeToFactory { | 27 struct SchemeToFactory { |
| 27 const char* scheme; | 28 const char* scheme; |
| 28 URLRequest::ProtocolFactory* factory; | 29 URLRequest::ProtocolFactory* factory; |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 } // namespace | 32 } // namespace |
| 32 | 33 |
| 33 static const SchemeToFactory kBuiltinFactories[] = { | 34 static const SchemeToFactory kBuiltinFactories[] = { |
| 34 { "http", URLRequestHttpJob::Factory }, | 35 { "http", URLRequestHttpJob::Factory }, |
| 35 { "https", URLRequestHttpJob::Factory }, | 36 { "https", URLRequestHttpJob::Factory }, |
| 36 { "file", URLRequestFileJob::Factory }, | 37 { "file", URLRequestFileJob::Factory }, |
| 37 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
| 38 { "ftp", URLRequestFtpJob::Factory }, | 39 { "ftp", URLRequestFtpJob::Factory }, |
| 39 #else | 40 #else |
| 40 { "ftp", URLRequestNewFtpJob::Factory }, | 41 { "ftp", URLRequestNewFtpJob::Factory }, |
| 41 #endif | 42 #endif |
| 42 { "about", URLRequestAboutJob::Factory }, | 43 { "about", URLRequestAboutJob::Factory }, |
| 44 { "data", URLRequestDataJob::Factory }, |
| 43 }; | 45 }; |
| 44 | 46 |
| 45 URLRequestJobManager::URLRequestJobManager() { | 47 URLRequestJobManager::URLRequestJobManager() { |
| 46 #ifndef NDEBUG | 48 #ifndef NDEBUG |
| 47 allowed_thread_ = 0; | 49 allowed_thread_ = 0; |
| 48 allowed_thread_initialized_ = false; | 50 allowed_thread_initialized_ = false; |
| 49 #endif | 51 #endif |
| 50 } | 52 } |
| 51 | 53 |
| 52 URLRequestJob* URLRequestJobManager::CreateJob(URLRequest* request) const { | 54 URLRequestJob* URLRequestJobManager::CreateJob(URLRequest* request) const { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 DCHECK(IsAllowedThread()); | 204 DCHECK(IsAllowedThread()); |
| 203 #endif | 205 #endif |
| 204 | 206 |
| 205 AutoLock locked(lock_); | 207 AutoLock locked(lock_); |
| 206 | 208 |
| 207 InterceptorList::iterator i = | 209 InterceptorList::iterator i = |
| 208 std::find(interceptors_.begin(), interceptors_.end(), interceptor); | 210 std::find(interceptors_.begin(), interceptors_.end(), interceptor); |
| 209 DCHECK(i != interceptors_.end()); | 211 DCHECK(i != interceptors_.end()); |
| 210 interceptors_.erase(i); | 212 interceptors_.erase(i); |
| 211 } | 213 } |
| OLD | NEW |