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