| 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" |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 // the time stamps if it has that information. The default request_time is | 445 // the time stamps if it has that information. The default request_time is |
| 446 // set by URLRequest before it calls our Start method. | 446 // set by URLRequest before it calls our Start method. |
| 447 request_->response_info_.response_time = Time::Now(); | 447 request_->response_info_.response_time = Time::Now(); |
| 448 GetResponseInfo(&request_->response_info_); | 448 GetResponseInfo(&request_->response_info_); |
| 449 | 449 |
| 450 // When notifying the delegate, the delegate can release the request | 450 // When notifying the delegate, the delegate can release the request |
| 451 // (and thus release 'this'). After calling to the delgate, we must | 451 // (and thus release 'this'). After calling to the delgate, we must |
| 452 // check the request pointer to see if it still exists, and return | 452 // check the request pointer to see if it still exists, and return |
| 453 // immediately if it has been destroyed. self_preservation ensures our | 453 // immediately if it has been destroyed. self_preservation ensures our |
| 454 // survival until we can get out of this method. | 454 // survival until we can get out of this method. |
| 455 scoped_refptr<URLRequestJob> self_preservation = this; | 455 scoped_refptr<URLRequestJob> self_preservation(this); |
| 456 | 456 |
| 457 GURL new_location; | 457 GURL new_location; |
| 458 int http_status_code; | 458 int http_status_code; |
| 459 if (IsRedirectResponse(&new_location, &http_status_code)) { | 459 if (IsRedirectResponse(&new_location, &http_status_code)) { |
| 460 const GURL& url = request_->url(); | 460 const GURL& url = request_->url(); |
| 461 | 461 |
| 462 // Move the reference fragment of the old location to the new one if the | 462 // Move the reference fragment of the old location to the new one if the |
| 463 // new one has none. This duplicates mozilla's behavior. | 463 // new one has none. This duplicates mozilla's behavior. |
| 464 if (url.is_valid() && url.has_ref() && !new_location.has_ref()) { | 464 if (url.is_valid() && url.has_ref() && !new_location.has_ref()) { |
| 465 GURL::Replacements replacements; | 465 GURL::Replacements replacements; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 | 551 |
| 552 // Don't notify if we had an error. | 552 // Don't notify if we had an error. |
| 553 if (!request_->status().is_success()) | 553 if (!request_->status().is_success()) |
| 554 return; | 554 return; |
| 555 | 555 |
| 556 // When notifying the delegate, the delegate can release the request | 556 // When notifying the delegate, the delegate can release the request |
| 557 // (and thus release 'this'). After calling to the delgate, we must | 557 // (and thus release 'this'). After calling to the delgate, we must |
| 558 // check the request pointer to see if it still exists, and return | 558 // check the request pointer to see if it still exists, and return |
| 559 // immediately if it has been destroyed. self_preservation ensures our | 559 // immediately if it has been destroyed. self_preservation ensures our |
| 560 // survival until we can get out of this method. | 560 // survival until we can get out of this method. |
| 561 scoped_refptr<URLRequestJob> self_preservation = this; | 561 scoped_refptr<URLRequestJob> self_preservation(this); |
| 562 | 562 |
| 563 prefilter_bytes_read_ += bytes_read; | 563 prefilter_bytes_read_ += bytes_read; |
| 564 if (filter_.get()) { | 564 if (filter_.get()) { |
| 565 // Tell the filter that it has more data | 565 // Tell the filter that it has more data |
| 566 FilteredDataRead(bytes_read); | 566 FilteredDataRead(bytes_read); |
| 567 | 567 |
| 568 // Filter the data. | 568 // Filter the data. |
| 569 int filter_bytes_read = 0; | 569 int filter_bytes_read = 0; |
| 570 if (ReadFilteredData(&filter_bytes_read)) { | 570 if (ReadFilteredData(&filter_bytes_read)) { |
| 571 postfilter_bytes_read_ += filter_bytes_read; | 571 postfilter_bytes_read_ += filter_bytes_read; |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 return; | 923 return; |
| 924 } | 924 } |
| 925 | 925 |
| 926 if (is_compressed_) { | 926 if (is_compressed_) { |
| 927 COMPRESSION_HISTOGRAM("NoProxy.BytesBeforeCompression", compressed_B); | 927 COMPRESSION_HISTOGRAM("NoProxy.BytesBeforeCompression", compressed_B); |
| 928 COMPRESSION_HISTOGRAM("NoProxy.BytesAfterCompression", decompressed_B); | 928 COMPRESSION_HISTOGRAM("NoProxy.BytesAfterCompression", decompressed_B); |
| 929 } else { | 929 } else { |
| 930 COMPRESSION_HISTOGRAM("NoProxy.ShouldHaveBeenCompressed", decompressed_B); | 930 COMPRESSION_HISTOGRAM("NoProxy.ShouldHaveBeenCompressed", decompressed_B); |
| 931 } | 931 } |
| 932 } | 932 } |
| OLD | NEW |