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