OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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.h" | 5 #include "net/url_request/url_request_job.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "net/base/auth.h" | 11 #include "net/base/auth.h" |
12 #include "net/base/io_buffer.h" | 12 #include "net/base/io_buffer.h" |
13 #include "net/base/load_flags.h" | 13 #include "net/base/load_flags.h" |
14 #include "net/base/mime_util.h" | 14 #include "net/base/mime_util.h" |
15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
16 #include "net/http/http_response_headers.h" | 16 #include "net/http/http_response_headers.h" |
17 #include "net/url_request/url_request.h" | 17 #include "net/url_request/url_request.h" |
18 #include "net/url_request/url_request_job_metrics.h" | 18 #include "net/url_request/url_request_job_metrics.h" |
19 #include "net/url_request/url_request_job_tracker.h" | 19 #include "net/url_request/url_request_job_tracker.h" |
20 | 20 |
21 using base::Time; | 21 using base::Time; |
22 using base::TimeTicks; | 22 using base::TimeTicks; |
23 | 23 |
24 // Buffer size allocated when de-compressing data. | 24 // Buffer size allocated when de-compressing data. |
25 // static | 25 // static |
26 const int URLRequestJob::kFilterBufSize = 32 * 1024; | 26 const int URLRequestJob::kFilterBufSize = 32 * 1024; |
wtc
2010/11/30 21:51:34
This static (const) member of URLRequestJob should
| |
27 | 27 |
28 namespace net { | |
29 | |
28 URLRequestJob::URLRequestJob(URLRequest* request) | 30 URLRequestJob::URLRequestJob(URLRequest* request) |
29 : request_(request), | 31 : request_(request), |
30 prefilter_bytes_read_(0), | 32 prefilter_bytes_read_(0), |
31 postfilter_bytes_read_(0), | 33 postfilter_bytes_read_(0), |
32 is_compressible_content_(false), | 34 is_compressible_content_(false), |
33 is_compressed_(false), | 35 is_compressed_(false), |
34 done_(false), | 36 done_(false), |
35 filter_needs_more_output_space_(false), | 37 filter_needs_more_output_space_(false), |
36 filtered_read_buffer_len_(0), | 38 filtered_read_buffer_len_(0), |
37 has_handled_response_(false), | 39 has_handled_response_(false), |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
436 if (!request_ || !request_->delegate()) | 438 if (!request_ || !request_->delegate()) |
437 return; // The request was destroyed, so there is no more work to do. | 439 return; // The request was destroyed, so there is no more work to do. |
438 | 440 |
439 if (has_handled_response_) | 441 if (has_handled_response_) |
440 return; | 442 return; |
441 | 443 |
442 DCHECK(!request_->status().is_io_pending()); | 444 DCHECK(!request_->status().is_io_pending()); |
443 | 445 |
444 // Initialize to the current time, and let the subclass optionally override | 446 // Initialize to the current time, and let the subclass optionally override |
445 // the time stamps if it has that information. The default request_time is | 447 // the time stamps if it has that information. The default request_time is |
446 // set by URLRequest before it calls our Start method. | 448 // set by net::URLRequest before it calls our Start method. |
447 request_->response_info_.response_time = Time::Now(); | 449 request_->response_info_.response_time = Time::Now(); |
448 GetResponseInfo(&request_->response_info_); | 450 GetResponseInfo(&request_->response_info_); |
449 | 451 |
450 // When notifying the delegate, the delegate can release the request | 452 // When notifying the delegate, the delegate can release the request |
451 // (and thus release 'this'). After calling to the delgate, we must | 453 // (and thus release 'this'). After calling to the delgate, we must |
452 // check the request pointer to see if it still exists, and return | 454 // check the request pointer to see if it still exists, and return |
453 // immediately if it has been destroyed. self_preservation ensures our | 455 // immediately if it has been destroyed. self_preservation ensures our |
454 // survival until we can get out of this method. | 456 // survival until we can get out of this method. |
455 scoped_refptr<URLRequestJob> self_preservation(this); | 457 scoped_refptr<URLRequestJob> self_preservation(this); |
456 | 458 |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
923 return; | 925 return; |
924 } | 926 } |
925 | 927 |
926 if (is_compressed_) { | 928 if (is_compressed_) { |
927 COMPRESSION_HISTOGRAM("NoProxy.BytesBeforeCompression", compressed_B); | 929 COMPRESSION_HISTOGRAM("NoProxy.BytesBeforeCompression", compressed_B); |
928 COMPRESSION_HISTOGRAM("NoProxy.BytesAfterCompression", decompressed_B); | 930 COMPRESSION_HISTOGRAM("NoProxy.BytesAfterCompression", decompressed_B); |
929 } else { | 931 } else { |
930 COMPRESSION_HISTOGRAM("NoProxy.ShouldHaveBeenCompressed", decompressed_B); | 932 COMPRESSION_HISTOGRAM("NoProxy.ShouldHaveBeenCompressed", decompressed_B); |
931 } | 933 } |
932 } | 934 } |
935 | |
936 } // namespace net | |
OLD | NEW |