| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1274 // Clear the error. | 1274 // Clear the error. |
| 1275 return true; | 1275 return true; |
| 1276 } | 1276 } |
| 1277 } | 1277 } |
| 1278 } | 1278 } |
| 1279 return false; | 1279 return false; |
| 1280 } | 1280 } |
| 1281 | 1281 |
| 1282 bool URLRequestHttpJob::ReadRawData(IOBuffer* buf, int buf_size, | 1282 bool URLRequestHttpJob::ReadRawData(IOBuffer* buf, int buf_size, |
| 1283 int* bytes_read) { | 1283 int* bytes_read) { |
| 1284 // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is fixed. |
| 1285 tracked_objects::ScopedTracker tracking_profile1( |
| 1286 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1287 "423948 URLRequestHttpJob::ReadRawData1")); |
| 1288 |
| 1284 DCHECK_NE(buf_size, 0); | 1289 DCHECK_NE(buf_size, 0); |
| 1285 DCHECK(bytes_read); | 1290 DCHECK(bytes_read); |
| 1286 DCHECK(!read_in_progress_); | 1291 DCHECK(!read_in_progress_); |
| 1287 | 1292 |
| 1288 int rv = transaction_->Read( | 1293 int rv = transaction_->Read( |
| 1289 buf, buf_size, | 1294 buf, buf_size, |
| 1290 base::Bind(&URLRequestHttpJob::OnReadCompleted, base::Unretained(this))); | 1295 base::Bind(&URLRequestHttpJob::OnReadCompleted, base::Unretained(this))); |
| 1291 | 1296 |
| 1292 if (ShouldFixMismatchedContentLength(rv)) | 1297 if (ShouldFixMismatchedContentLength(rv)) |
| 1293 rv = 0; | 1298 rv = 0; |
| 1294 | 1299 |
| 1295 if (rv >= 0) { | 1300 if (rv >= 0) { |
| 1296 *bytes_read = rv; | 1301 *bytes_read = rv; |
| 1297 if (!rv) | 1302 if (!rv) { |
| 1303 // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is |
| 1304 // fixed. |
| 1305 tracked_objects::ScopedTracker tracking_profile2( |
| 1306 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1307 "423948 URLRequestHttpJob::ReadRawData2")); |
| 1308 |
| 1298 DoneWithRequest(FINISHED); | 1309 DoneWithRequest(FINISHED); |
| 1310 } |
| 1299 return true; | 1311 return true; |
| 1300 } | 1312 } |
| 1301 | 1313 |
| 1302 if (rv == ERR_IO_PENDING) { | 1314 if (rv == ERR_IO_PENDING) { |
| 1303 read_in_progress_ = true; | 1315 read_in_progress_ = true; |
| 1304 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); | 1316 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); |
| 1305 } else { | 1317 } else { |
| 1306 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); | 1318 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); |
| 1307 } | 1319 } |
| 1308 | 1320 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1562 return override_response_headers_.get() ? | 1574 return override_response_headers_.get() ? |
| 1563 override_response_headers_.get() : | 1575 override_response_headers_.get() : |
| 1564 transaction_->GetResponseInfo()->headers.get(); | 1576 transaction_->GetResponseInfo()->headers.get(); |
| 1565 } | 1577 } |
| 1566 | 1578 |
| 1567 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1579 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1568 awaiting_callback_ = false; | 1580 awaiting_callback_ = false; |
| 1569 } | 1581 } |
| 1570 | 1582 |
| 1571 } // namespace net | 1583 } // namespace net |
| OLD | NEW |