| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.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 18 matching lines...) Expand all Loading... |
| 29 filter_input_byte_count_(0), | 29 filter_input_byte_count_(0), |
| 30 filter_needs_more_output_space_(false), | 30 filter_needs_more_output_space_(false), |
| 31 filtered_read_buffer_len_(0), | 31 filtered_read_buffer_len_(0), |
| 32 has_handled_response_(false), | 32 has_handled_response_(false), |
| 33 expected_content_size_(-1), | 33 expected_content_size_(-1), |
| 34 deferred_redirect_status_code_(-1), | 34 deferred_redirect_status_code_(-1), |
| 35 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { | 35 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { |
| 36 g_url_request_job_tracker.AddNewJob(this); | 36 g_url_request_job_tracker.AddNewJob(this); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void URLRequestJob::SetUpload(net::UploadData* upload) { | 39 void URLRequestJob::SetUpload(UploadData* upload) { |
| 40 } | 40 } |
| 41 | 41 |
| 42 void URLRequestJob::SetExtraRequestHeaders( | 42 void URLRequestJob::SetExtraRequestHeaders( |
| 43 const net::HttpRequestHeaders& headers) { | 43 const HttpRequestHeaders& headers) { |
| 44 } | 44 } |
| 45 | 45 |
| 46 void URLRequestJob::Kill() { | 46 void URLRequestJob::Kill() { |
| 47 // Make sure the request is notified that we are done. We assume that the | 47 // Make sure the request is notified that we are done. We assume that the |
| 48 // request took care of setting its error status before calling Kill. | 48 // request took care of setting its error status before calling Kill. |
| 49 if (request_) | 49 if (request_) |
| 50 NotifyCanceled(); | 50 NotifyCanceled(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void URLRequestJob::DetachRequest() { | 53 void URLRequestJob::DetachRequest() { |
| 54 request_ = NULL; | 54 request_ = NULL; |
| 55 } | 55 } |
| 56 | 56 |
| 57 // This function calls ReadData to get stream data. If a filter exists, passes | 57 // This function calls ReadData to get stream data. If a filter exists, passes |
| 58 // the data to the attached filter. Then returns the output from filter back to | 58 // the data to the attached filter. Then returns the output from filter back to |
| 59 // the caller. | 59 // the caller. |
| 60 bool URLRequestJob::Read(net::IOBuffer* buf, int buf_size, int *bytes_read) { | 60 bool URLRequestJob::Read(IOBuffer* buf, int buf_size, int *bytes_read) { |
| 61 bool rv = false; | 61 bool rv = false; |
| 62 | 62 |
| 63 DCHECK_LT(buf_size, 1000000); // sanity check | 63 DCHECK_LT(buf_size, 1000000); // sanity check |
| 64 DCHECK(buf); | 64 DCHECK(buf); |
| 65 DCHECK(bytes_read); | 65 DCHECK(bytes_read); |
| 66 DCHECK(filtered_read_buffer_ == NULL); | 66 DCHECK(filtered_read_buffer_ == NULL); |
| 67 DCHECK_EQ(0, filtered_read_buffer_len_); | 67 DCHECK_EQ(0, filtered_read_buffer_len_); |
| 68 | 68 |
| 69 *bytes_read = 0; | 69 *bytes_read = 0; |
| 70 | 70 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 85 } | 85 } |
| 86 if (rv && *bytes_read == 0) | 86 if (rv && *bytes_read == 0) |
| 87 NotifyDone(URLRequestStatus()); | 87 NotifyDone(URLRequestStatus()); |
| 88 return rv; | 88 return rv; |
| 89 } | 89 } |
| 90 | 90 |
| 91 void URLRequestJob::StopCaching() { | 91 void URLRequestJob::StopCaching() { |
| 92 // Nothing to do here. | 92 // Nothing to do here. |
| 93 } | 93 } |
| 94 | 94 |
| 95 net::LoadState URLRequestJob::GetLoadState() const { | 95 LoadState URLRequestJob::GetLoadState() const { |
| 96 return net::LOAD_STATE_IDLE; | 96 return LOAD_STATE_IDLE; |
| 97 } | 97 } |
| 98 | 98 |
| 99 uint64 URLRequestJob::GetUploadProgress() const { | 99 uint64 URLRequestJob::GetUploadProgress() const { |
| 100 return 0; | 100 return 0; |
| 101 } | 101 } |
| 102 | 102 |
| 103 bool URLRequestJob::GetCharset(std::string* charset) { | 103 bool URLRequestJob::GetCharset(std::string* charset) { |
| 104 return false; | 104 return false; |
| 105 } | 105 } |
| 106 | 106 |
| 107 void URLRequestJob::GetResponseInfo(net::HttpResponseInfo* info) { | 107 void URLRequestJob::GetResponseInfo(HttpResponseInfo* info) { |
| 108 } | 108 } |
| 109 | 109 |
| 110 bool URLRequestJob::GetResponseCookies(std::vector<std::string>* cookies) { | 110 bool URLRequestJob::GetResponseCookies(std::vector<std::string>* cookies) { |
| 111 return false; | 111 return false; |
| 112 } | 112 } |
| 113 | 113 |
| 114 Filter* URLRequestJob::SetupFilter() const { | 114 Filter* URLRequestJob::SetupFilter() const { |
| 115 return NULL; | 115 return NULL; |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool URLRequestJob::IsRedirectResponse(GURL* location, | 118 bool URLRequestJob::IsRedirectResponse(GURL* location, |
| 119 int* http_status_code) { | 119 int* http_status_code) { |
| 120 // For non-HTTP jobs, headers will be null. | 120 // For non-HTTP jobs, headers will be null. |
| 121 net::HttpResponseHeaders* headers = request_->response_headers(); | 121 HttpResponseHeaders* headers = request_->response_headers(); |
| 122 if (!headers) | 122 if (!headers) |
| 123 return false; | 123 return false; |
| 124 | 124 |
| 125 std::string value; | 125 std::string value; |
| 126 if (!headers->IsRedirect(&value)) | 126 if (!headers->IsRedirect(&value)) |
| 127 return false; | 127 return false; |
| 128 | 128 |
| 129 *location = request_->url().Resolve(value); | 129 *location = request_->url().Resolve(value); |
| 130 *http_status_code = headers->response_code(); | 130 *http_status_code = headers->response_code(); |
| 131 return true; | 131 return true; |
| 132 } | 132 } |
| 133 | 133 |
| 134 bool URLRequestJob::IsSafeRedirect(const GURL& location) { | 134 bool URLRequestJob::IsSafeRedirect(const GURL& location) { |
| 135 return true; | 135 return true; |
| 136 } | 136 } |
| 137 | 137 |
| 138 bool URLRequestJob::NeedsAuth() { | 138 bool URLRequestJob::NeedsAuth() { |
| 139 return false; | 139 return false; |
| 140 } | 140 } |
| 141 | 141 |
| 142 void URLRequestJob::GetAuthChallengeInfo( | 142 void URLRequestJob::GetAuthChallengeInfo( |
| 143 scoped_refptr<net::AuthChallengeInfo>* auth_info) { | 143 scoped_refptr<AuthChallengeInfo>* auth_info) { |
| 144 // This will only be called if NeedsAuth() returns true, in which | 144 // This will only be called if NeedsAuth() returns true, in which |
| 145 // case the derived class should implement this! | 145 // case the derived class should implement this! |
| 146 NOTREACHED(); | 146 NOTREACHED(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void URLRequestJob::SetAuth(const string16& username, | 149 void URLRequestJob::SetAuth(const string16& username, |
| 150 const string16& password) { | 150 const string16& password) { |
| 151 // This will only be called if NeedsAuth() returns true, in which | 151 // This will only be called if NeedsAuth() returns true, in which |
| 152 // case the derived class should implement this! | 152 // case the derived class should implement this! |
| 153 NOTREACHED(); | 153 NOTREACHED(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void URLRequestJob::CancelAuth() { | 156 void URLRequestJob::CancelAuth() { |
| 157 // This will only be called if NeedsAuth() returns true, in which | 157 // This will only be called if NeedsAuth() returns true, in which |
| 158 // case the derived class should implement this! | 158 // case the derived class should implement this! |
| 159 NOTREACHED(); | 159 NOTREACHED(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 void URLRequestJob::ContinueWithCertificate( | 162 void URLRequestJob::ContinueWithCertificate( |
| 163 net::X509Certificate* client_cert) { | 163 X509Certificate* client_cert) { |
| 164 // The derived class should implement this! | 164 // The derived class should implement this! |
| 165 NOTREACHED(); | 165 NOTREACHED(); |
| 166 } | 166 } |
| 167 | 167 |
| 168 void URLRequestJob::ContinueDespiteLastError() { | 168 void URLRequestJob::ContinueDespiteLastError() { |
| 169 // Implementations should know how to recover from errors they generate. | 169 // Implementations should know how to recover from errors they generate. |
| 170 // If this code was reached, we are trying to recover from an error that | 170 // If this code was reached, we are trying to recover from an error that |
| 171 // we don't know how to recover from. | 171 // we don't know how to recover from. |
| 172 NOTREACHED(); | 172 NOTREACHED(); |
| 173 } | 173 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 if (!request_ || !request_->delegate()) | 211 if (!request_ || !request_->delegate()) |
| 212 return; // The request was destroyed, so there is no more work to do. | 212 return; // The request was destroyed, so there is no more work to do. |
| 213 | 213 |
| 214 if (has_handled_response_) | 214 if (has_handled_response_) |
| 215 return; | 215 return; |
| 216 | 216 |
| 217 DCHECK(!request_->status().is_io_pending()); | 217 DCHECK(!request_->status().is_io_pending()); |
| 218 | 218 |
| 219 // Initialize to the current time, and let the subclass optionally override | 219 // Initialize to the current time, and let the subclass optionally override |
| 220 // the time stamps if it has that information. The default request_time is | 220 // the time stamps if it has that information. The default request_time is |
| 221 // set by net::URLRequest before it calls our Start method. | 221 // set by URLRequest before it calls our Start method. |
| 222 request_->response_info_.response_time = base::Time::Now(); | 222 request_->response_info_.response_time = base::Time::Now(); |
| 223 GetResponseInfo(&request_->response_info_); | 223 GetResponseInfo(&request_->response_info_); |
| 224 | 224 |
| 225 // When notifying the delegate, the delegate can release the request | 225 // When notifying the delegate, the delegate can release the request |
| 226 // (and thus release 'this'). After calling to the delgate, we must | 226 // (and thus release 'this'). After calling to the delgate, we must |
| 227 // check the request pointer to see if it still exists, and return | 227 // check the request pointer to see if it still exists, and return |
| 228 // immediately if it has been destroyed. self_preservation ensures our | 228 // immediately if it has been destroyed. self_preservation ensures our |
| 229 // survival until we can get out of this method. | 229 // survival until we can get out of this method. |
| 230 scoped_refptr<URLRequestJob> self_preservation(this); | 230 scoped_refptr<URLRequestJob> self_preservation(this); |
| 231 | 231 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 256 if (request_->status().is_success()) { | 256 if (request_->status().is_success()) { |
| 257 if (defer_redirect) { | 257 if (defer_redirect) { |
| 258 deferred_redirect_url_ = new_location; | 258 deferred_redirect_url_ = new_location; |
| 259 deferred_redirect_status_code_ = http_status_code; | 259 deferred_redirect_status_code_ = http_status_code; |
| 260 } else { | 260 } else { |
| 261 FollowRedirect(new_location, http_status_code); | 261 FollowRedirect(new_location, http_status_code); |
| 262 } | 262 } |
| 263 return; | 263 return; |
| 264 } | 264 } |
| 265 } else if (NeedsAuth()) { | 265 } else if (NeedsAuth()) { |
| 266 scoped_refptr<net::AuthChallengeInfo> auth_info; | 266 scoped_refptr<AuthChallengeInfo> auth_info; |
| 267 GetAuthChallengeInfo(&auth_info); | 267 GetAuthChallengeInfo(&auth_info); |
| 268 // Need to check for a NULL auth_info because the server may have failed | 268 // Need to check for a NULL auth_info because the server may have failed |
| 269 // to send a challenge with the 401 response. | 269 // to send a challenge with the 401 response. |
| 270 if (auth_info) { | 270 if (auth_info) { |
| 271 request_->delegate()->OnAuthRequired(request_, auth_info); | 271 request_->delegate()->OnAuthRequired(request_, auth_info); |
| 272 // Wait for SetAuth or CancelAuth to be called. | 272 // Wait for SetAuth or CancelAuth to be called. |
| 273 return; | 273 return; |
| 274 } | 274 } |
| 275 } | 275 } |
| 276 | 276 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 } else { | 395 } else { |
| 396 has_handled_response_ = true; | 396 has_handled_response_ = true; |
| 397 request_->ResponseStarted(); | 397 request_->ResponseStarted(); |
| 398 } | 398 } |
| 399 } | 399 } |
| 400 } | 400 } |
| 401 | 401 |
| 402 void URLRequestJob::NotifyCanceled() { | 402 void URLRequestJob::NotifyCanceled() { |
| 403 if (!done_) { | 403 if (!done_) { |
| 404 NotifyDone(URLRequestStatus(URLRequestStatus::CANCELED, | 404 NotifyDone(URLRequestStatus(URLRequestStatus::CANCELED, |
| 405 net::ERR_ABORTED)); | 405 ERR_ABORTED)); |
| 406 } | 406 } |
| 407 } | 407 } |
| 408 | 408 |
| 409 void URLRequestJob::NotifyRestartRequired() { | 409 void URLRequestJob::NotifyRestartRequired() { |
| 410 DCHECK(!has_handled_response_); | 410 DCHECK(!has_handled_response_); |
| 411 if (GetStatus().status() != URLRequestStatus::CANCELED) | 411 if (GetStatus().status() != URLRequestStatus::CANCELED) |
| 412 request_->Restart(); | 412 request_->Restart(); |
| 413 } | 413 } |
| 414 | 414 |
| 415 bool URLRequestJob::ReadRawData(net::IOBuffer* buf, int buf_size, | 415 bool URLRequestJob::ReadRawData(IOBuffer* buf, int buf_size, |
| 416 int *bytes_read) { | 416 int *bytes_read) { |
| 417 DCHECK(bytes_read); | 417 DCHECK(bytes_read); |
| 418 *bytes_read = 0; | 418 *bytes_read = 0; |
| 419 NotifyDone(URLRequestStatus()); | 419 NotifyDone(URLRequestStatus()); |
| 420 return false; | 420 return false; |
| 421 } | 421 } |
| 422 | 422 |
| 423 void URLRequestJob::FilteredDataRead(int bytes_read) { | 423 void URLRequestJob::FilteredDataRead(int bytes_read) { |
| 424 DCHECK(filter_.get()); // don't add data if there is no filter | 424 DCHECK(filter_.get()); // don't add data if there is no filter |
| 425 filter_->FlushStreamBuffer(bytes_read); | 425 filter_->FlushStreamBuffer(bytes_read); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 case Filter::FILTER_OK: { | 499 case Filter::FILTER_OK: { |
| 500 filter_needs_more_output_space_ = | 500 filter_needs_more_output_space_ = |
| 501 (filtered_data_len == output_buffer_size); | 501 (filtered_data_len == output_buffer_size); |
| 502 *bytes_read = filtered_data_len; | 502 *bytes_read = filtered_data_len; |
| 503 rv = true; | 503 rv = true; |
| 504 break; | 504 break; |
| 505 } | 505 } |
| 506 case Filter::FILTER_ERROR: { | 506 case Filter::FILTER_ERROR: { |
| 507 filter_needs_more_output_space_ = false; | 507 filter_needs_more_output_space_ = false; |
| 508 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, | 508 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, |
| 509 net::ERR_CONTENT_DECODING_FAILED)); | 509 ERR_CONTENT_DECODING_FAILED)); |
| 510 rv = false; | 510 rv = false; |
| 511 break; | 511 break; |
| 512 } | 512 } |
| 513 default: { | 513 default: { |
| 514 NOTREACHED(); | 514 NOTREACHED(); |
| 515 filter_needs_more_output_space_ = false; | 515 filter_needs_more_output_space_ = false; |
| 516 rv = false; | 516 rv = false; |
| 517 break; | 517 break; |
| 518 } | 518 } |
| 519 } | 519 } |
| 520 } else { | 520 } else { |
| 521 // we are done, or there is no data left. | 521 // we are done, or there is no data left. |
| 522 rv = true; | 522 rv = true; |
| 523 } | 523 } |
| 524 | 524 |
| 525 if (rv) { | 525 if (rv) { |
| 526 // When we successfully finished a read, we no longer need to | 526 // When we successfully finished a read, we no longer need to |
| 527 // save the caller's buffers. Release our reference. | 527 // save the caller's buffers. Release our reference. |
| 528 filtered_read_buffer_ = NULL; | 528 filtered_read_buffer_ = NULL; |
| 529 filtered_read_buffer_len_ = 0; | 529 filtered_read_buffer_len_ = 0; |
| 530 } | 530 } |
| 531 return rv; | 531 return rv; |
| 532 } | 532 } |
| 533 | 533 |
| 534 const URLRequestStatus URLRequestJob::GetStatus() { | 534 const URLRequestStatus URLRequestJob::GetStatus() { |
| 535 if (request_) | 535 if (request_) |
| 536 return request_->status(); | 536 return request_->status(); |
| 537 // If the request is gone, we must be cancelled. | 537 // If the request is gone, we must be cancelled. |
| 538 return URLRequestStatus(URLRequestStatus::CANCELED, | 538 return URLRequestStatus(URLRequestStatus::CANCELED, |
| 539 net::ERR_ABORTED); | 539 ERR_ABORTED); |
| 540 } | 540 } |
| 541 | 541 |
| 542 void URLRequestJob::SetStatus(const URLRequestStatus &status) { | 542 void URLRequestJob::SetStatus(const URLRequestStatus &status) { |
| 543 if (request_) | 543 if (request_) |
| 544 request_->set_status(status); | 544 request_->set_status(status); |
| 545 } | 545 } |
| 546 | 546 |
| 547 bool URLRequestJob::ReadRawDataForFilter(int* bytes_read) { | 547 bool URLRequestJob::ReadRawDataForFilter(int* bytes_read) { |
| 548 bool rv = false; | 548 bool rv = false; |
| 549 | 549 |
| 550 DCHECK(bytes_read); | 550 DCHECK(bytes_read); |
| 551 DCHECK(filter_.get()); | 551 DCHECK(filter_.get()); |
| 552 | 552 |
| 553 *bytes_read = 0; | 553 *bytes_read = 0; |
| 554 | 554 |
| 555 // Get more pre-filtered data if needed. | 555 // Get more pre-filtered data if needed. |
| 556 // TODO(mbelshe): is it possible that the filter needs *MORE* data | 556 // TODO(mbelshe): is it possible that the filter needs *MORE* data |
| 557 // when there is some data already in the buffer? | 557 // when there is some data already in the buffer? |
| 558 if (!filter_->stream_data_len() && !is_done()) { | 558 if (!filter_->stream_data_len() && !is_done()) { |
| 559 net::IOBuffer* stream_buffer = filter_->stream_buffer(); | 559 IOBuffer* stream_buffer = filter_->stream_buffer(); |
| 560 int stream_buffer_size = filter_->stream_buffer_size(); | 560 int stream_buffer_size = filter_->stream_buffer_size(); |
| 561 rv = ReadRawDataHelper(stream_buffer, stream_buffer_size, bytes_read); | 561 rv = ReadRawDataHelper(stream_buffer, stream_buffer_size, bytes_read); |
| 562 } | 562 } |
| 563 return rv; | 563 return rv; |
| 564 } | 564 } |
| 565 | 565 |
| 566 bool URLRequestJob::ReadRawDataHelper(net::IOBuffer* buf, int buf_size, | 566 bool URLRequestJob::ReadRawDataHelper(IOBuffer* buf, int buf_size, |
| 567 int* bytes_read) { | 567 int* bytes_read) { |
| 568 DCHECK(!request_->status().is_io_pending()); | 568 DCHECK(!request_->status().is_io_pending()); |
| 569 DCHECK(raw_read_buffer_ == NULL); | 569 DCHECK(raw_read_buffer_ == NULL); |
| 570 | 570 |
| 571 // Keep a pointer to the read buffer, so we have access to it in the | 571 // Keep a pointer to the read buffer, so we have access to it in the |
| 572 // OnRawReadComplete() callback in the event that the read completes | 572 // OnRawReadComplete() callback in the event that the read completes |
| 573 // asynchronously. | 573 // asynchronously. |
| 574 raw_read_buffer_ = buf; | 574 raw_read_buffer_ = buf; |
| 575 bool rv = ReadRawData(buf, buf_size, bytes_read); | 575 bool rv = ReadRawData(buf, buf_size, bytes_read); |
| 576 | 576 |
| 577 if (!request_->status().is_io_pending()) { | 577 if (!request_->status().is_io_pending()) { |
| 578 // If the read completes synchronously, either success or failure, | 578 // If the read completes synchronously, either success or failure, |
| 579 // invoke the OnRawReadComplete callback so we can account for the | 579 // invoke the OnRawReadComplete callback so we can account for the |
| 580 // completed read. | 580 // completed read. |
| 581 OnRawReadComplete(*bytes_read); | 581 OnRawReadComplete(*bytes_read); |
| 582 } | 582 } |
| 583 return rv; | 583 return rv; |
| 584 } | 584 } |
| 585 | 585 |
| 586 void URLRequestJob::FollowRedirect(const GURL& location, int http_status_code) { | 586 void URLRequestJob::FollowRedirect(const GURL& location, int http_status_code) { |
| 587 g_url_request_job_tracker.OnJobRedirect(this, location, http_status_code); | 587 g_url_request_job_tracker.OnJobRedirect(this, location, http_status_code); |
| 588 | 588 |
| 589 int rv = request_->Redirect(location, http_status_code); | 589 int rv = request_->Redirect(location, http_status_code); |
| 590 if (rv != net::OK) | 590 if (rv != OK) |
| 591 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); | 591 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); |
| 592 } | 592 } |
| 593 | 593 |
| 594 void URLRequestJob::OnRawReadComplete(int bytes_read) { | 594 void URLRequestJob::OnRawReadComplete(int bytes_read) { |
| 595 DCHECK(raw_read_buffer_); | 595 DCHECK(raw_read_buffer_); |
| 596 if (bytes_read > 0) { | 596 if (bytes_read > 0) { |
| 597 RecordBytesRead(bytes_read); | 597 RecordBytesRead(bytes_read); |
| 598 } | 598 } |
| 599 raw_read_buffer_ = NULL; | 599 raw_read_buffer_ = NULL; |
| 600 } | 600 } |
| 601 | 601 |
| 602 void URLRequestJob::RecordBytesRead(int bytes_read) { | 602 void URLRequestJob::RecordBytesRead(int bytes_read) { |
| 603 filter_input_byte_count_ += bytes_read; | 603 filter_input_byte_count_ += bytes_read; |
| 604 UpdatePacketReadTimes(); // Facilitate stats recording if it is active. | 604 UpdatePacketReadTimes(); // Facilitate stats recording if it is active. |
| 605 g_url_request_job_tracker.OnBytesRead(this, raw_read_buffer_->data(), | 605 g_url_request_job_tracker.OnBytesRead(this, raw_read_buffer_->data(), |
| 606 bytes_read); | 606 bytes_read); |
| 607 } | 607 } |
| 608 | 608 |
| 609 bool URLRequestJob::FilterHasData() { | 609 bool URLRequestJob::FilterHasData() { |
| 610 return filter_.get() && filter_->stream_data_len(); | 610 return filter_.get() && filter_->stream_data_len(); |
| 611 } | 611 } |
| 612 | 612 |
| 613 void URLRequestJob::UpdatePacketReadTimes() { | 613 void URLRequestJob::UpdatePacketReadTimes() { |
| 614 } | 614 } |
| 615 | 615 |
| 616 } // namespace net | 616 } // namespace net |
| OLD | NEW |