| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. |
| 3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com) | 3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com) |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 return; | 508 return; |
| 509 } | 509 } |
| 510 didFail(0, errorOut); | 510 didFail(0, errorOut); |
| 511 return; | 511 return; |
| 512 } | 512 } |
| 513 didReceiveResponse(0, responseOut); | 513 didReceiveResponse(0, responseOut); |
| 514 if (m_state == Terminated) | 514 if (m_state == Terminated) |
| 515 return; | 515 return; |
| 516 RefPtr<ResourceLoadInfo> resourceLoadInfo = responseOut.toResourceResponse()
.resourceLoadInfo(); | 516 RefPtr<ResourceLoadInfo> resourceLoadInfo = responseOut.toResourceResponse()
.resourceLoadInfo(); |
| 517 int64_t encodedDataLength = resourceLoadInfo ? resourceLoadInfo->encodedData
Length : WebURLLoaderClient::kUnknownEncodedDataLength; | 517 int64_t encodedDataLength = resourceLoadInfo ? resourceLoadInfo->encodedData
Length : WebURLLoaderClient::kUnknownEncodedDataLength; |
| 518 m_fetcher->didReceiveData(m_resource, dataOut.data(), dataOut.size(), encode
dDataLength); | 518 |
| 519 m_resource->setResourceBuffer(dataOut); | 519 // Follow the async case convention of not calling didReceiveData or |
| 520 // appending data to m_resource if the response body is empty. Copying the |
| 521 // empty buffer is a noop in most cases, but is destructive in the case of |
| 522 // a 304, where it will overwrite the cached data we should be reusing. |
| 523 if (dataOut.size()) { |
| 524 m_fetcher->didReceiveData(m_resource, dataOut.data(), dataOut.size(), en
codedDataLength); |
| 525 m_resource->setResourceBuffer(dataOut); |
| 526 } |
| 520 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); | 527 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); |
| 521 } | 528 } |
| 522 | 529 |
| 523 ResourceRequest& ResourceLoader::applyOptions(ResourceRequest& request) const | 530 ResourceRequest& ResourceLoader::applyOptions(ResourceRequest& request) const |
| 524 { | 531 { |
| 525 request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredC
redentials); | 532 request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredC
redentials); |
| 526 return request; | 533 return request; |
| 527 } | 534 } |
| 528 | 535 |
| 529 } | 536 } |
| OLD | NEW |