| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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.h" | 5 #include "net/url_request/url_request.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/process_util.h" | 8 #include "base/process_util.h" |
| 9 #include "base/singleton.h" | 9 #include "base/singleton.h" |
| 10 #include "base/stats_counters.h" | 10 #include "base/stats_counters.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "net/base/load_flags.h" | 12 #include "net/base/load_flags.h" |
| 13 #include "net/base/load_log.h" |
| 13 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 14 #include "net/base/ssl_cert_request_info.h" | 15 #include "net/base/ssl_cert_request_info.h" |
| 15 #include "net/base/upload_data.h" | 16 #include "net/base/upload_data.h" |
| 16 #include "net/http/http_response_headers.h" | 17 #include "net/http/http_response_headers.h" |
| 17 #include "net/http/http_util.h" | 18 #include "net/http/http_util.h" |
| 18 #include "net/url_request/url_request_context.h" | 19 #include "net/url_request/url_request_context.h" |
| 19 #include "net/url_request/url_request_job.h" | 20 #include "net/url_request/url_request_job.h" |
| 20 #include "net/url_request/url_request_job_manager.h" | 21 #include "net/url_request/url_request_job_manager.h" |
| 21 | 22 |
| 22 #ifndef NDEBUG | 23 #ifndef NDEBUG |
| 23 URLRequestMetrics url_request_metrics; | 24 URLRequestMetrics url_request_metrics; |
| 24 #endif | 25 #endif |
| 25 | 26 |
| 26 using base::Time; | 27 using base::Time; |
| 27 using net::UploadData; | 28 using net::UploadData; |
| 28 using std::string; | 29 using std::string; |
| 29 using std::wstring; | 30 using std::wstring; |
| 30 | 31 |
| 31 // Max number of http redirects to follow. Same number as gecko. | 32 // Max number of http redirects to follow. Same number as gecko. |
| 32 static const int kMaxRedirects = 20; | 33 static const int kMaxRedirects = 20; |
| 33 | 34 |
| 34 static URLRequestJobManager* GetJobManager() { | 35 static URLRequestJobManager* GetJobManager() { |
| 35 return Singleton<URLRequestJobManager>::get(); | 36 return Singleton<URLRequestJobManager>::get(); |
| 36 } | 37 } |
| 37 | 38 |
| 38 /////////////////////////////////////////////////////////////////////////////// | 39 /////////////////////////////////////////////////////////////////////////////// |
| 39 // URLRequest | 40 // URLRequest |
| 40 | 41 |
| 41 URLRequest::URLRequest(const GURL& url, Delegate* delegate) | 42 URLRequest::URLRequest(const GURL& url, Delegate* delegate) |
| 42 : url_(url), | 43 : load_log_(new net::LoadLog), |
| 44 url_(url), |
| 43 original_url_(url), | 45 original_url_(url), |
| 44 method_("GET"), | 46 method_("GET"), |
| 45 load_flags_(net::LOAD_NORMAL), | 47 load_flags_(net::LOAD_NORMAL), |
| 46 delegate_(delegate), | 48 delegate_(delegate), |
| 47 is_pending_(false), | 49 is_pending_(false), |
| 48 enable_profiling_(false), | 50 enable_profiling_(false), |
| 49 redirect_limit_(kMaxRedirects), | 51 redirect_limit_(kMaxRedirects), |
| 50 final_upload_progress_(0), | 52 final_upload_progress_(0), |
| 51 priority_(0) { | 53 priority_(0) { |
| 52 URLREQUEST_COUNT_CTOR(); | 54 URLREQUEST_COUNT_CTOR(); |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 } | 493 } |
| 492 | 494 |
| 493 #ifndef NDEBUG | 495 #ifndef NDEBUG |
| 494 | 496 |
| 495 URLRequestMetrics::~URLRequestMetrics() { | 497 URLRequestMetrics::~URLRequestMetrics() { |
| 496 DLOG_IF(WARNING, object_count != 0) << | 498 DLOG_IF(WARNING, object_count != 0) << |
| 497 "Leaking " << object_count << " URLRequest object(s)"; | 499 "Leaking " << object_count << " URLRequest object(s)"; |
| 498 } | 500 } |
| 499 | 501 |
| 500 #endif | 502 #endif |
| OLD | NEW |