| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 m_notifiedLoadComplete = true; | 289 m_notifiedLoadComplete = true; |
| 290 m_host->didFailLoading(m_resource, nonNullError); | 290 m_host->didFailLoading(m_resource, nonNullError); |
| 291 } | 291 } |
| 292 | 292 |
| 293 if (m_state == Finishing) | 293 if (m_state == Finishing) |
| 294 m_resource->error(Resource::LoadError); | 294 m_resource->error(Resource::LoadError); |
| 295 if (m_state != Terminated) | 295 if (m_state != Terminated) |
| 296 releaseResources(); | 296 releaseResources(); |
| 297 } | 297 } |
| 298 | 298 |
| 299 void ResourceLoader::willSendRequest(blink::WebURLLoader*, blink::WebURLRequest&
passedRequest, const blink::WebURLResponse& passedRedirectResponse) | 299 void ResourceLoader::willSendRequest(blink::WebURLLoader*, blink::WebURLRequest&
passedNewRequest, const blink::WebURLResponse& passedRedirectResponse) |
| 300 { | 300 { |
| 301 ASSERT(m_state != Terminated); | 301 ASSERT(m_state != Terminated); |
| 302 RefPtrWillBeRawPtr<ResourceLoader> protect(this); | 302 RefPtrWillBeRawPtr<ResourceLoader> protect(this); |
| 303 | 303 |
| 304 ResourceRequest& request(applyOptions(passedRequest.toMutableResourceRequest
())); | 304 ResourceRequest& newRequest(applyOptions(passedNewRequest.toMutableResourceR
equest())); |
| 305 | 305 |
| 306 ASSERT(!request.isNull()); | 306 ASSERT(!newRequest.isNull()); |
| 307 const ResourceResponse& redirectResponse(passedRedirectResponse.toResourceRe
sponse()); | 307 const ResourceResponse& redirectResponse(passedRedirectResponse.toResourceRe
sponse()); |
| 308 ASSERT(!redirectResponse.isNull()); | 308 ASSERT(!redirectResponse.isNull()); |
| 309 if (!m_host->canAccessRedirect(m_resource, request, redirectResponse, m_opti
ons)) { | 309 if (!m_host->canAccessRedirect(m_resource, newRequest, redirectResponse, m_o
ptions)) { |
| 310 cancel(); | 310 cancel(); |
| 311 return; | 311 return; |
| 312 } | 312 } |
| 313 ASSERT(m_state != Terminated); | 313 ASSERT(m_state != Terminated); |
| 314 | 314 |
| 315 applyOptions(request); // canAccessRedirect() can modify m_options so we sho
uld re-apply it. | 315 applyOptions(newRequest); // canAccessRedirect() can modify m_options so we
should re-apply it. |
| 316 m_host->redirectReceived(m_resource, redirectResponse); | 316 m_host->redirectReceived(m_resource, redirectResponse); |
| 317 ASSERT(m_state != Terminated); | 317 ASSERT(m_state != Terminated); |
| 318 m_resource->willSendRequest(request, redirectResponse); | 318 m_resource->willFollowRedirect(newRequest, redirectResponse); |
| 319 if (request.isNull() || m_state == Terminated) | 319 if (newRequest.isNull() || m_state == Terminated) |
| 320 return; | 320 return; |
| 321 | 321 |
| 322 m_host->willSendRequest(m_resource->identifier(), request, redirectResponse,
m_options.initiatorInfo); | 322 m_host->willSendRequest(m_resource->identifier(), newRequest, redirectRespon
se, m_options.initiatorInfo); |
| 323 ASSERT(m_state != Terminated); | 323 ASSERT(m_state != Terminated); |
| 324 ASSERT(!request.isNull()); | 324 ASSERT(!newRequest.isNull()); |
| 325 m_resource->updateRequest(request); | 325 m_resource->updateRequest(newRequest); |
| 326 m_request = request; | 326 m_request = newRequest; |
| 327 } | 327 } |
| 328 | 328 |
| 329 void ResourceLoader::didReceiveCachedMetadata(blink::WebURLLoader*, const char*
data, int length) | 329 void ResourceLoader::didReceiveCachedMetadata(blink::WebURLLoader*, const char*
data, int length) |
| 330 { | 330 { |
| 331 RELEASE_ASSERT(m_connectionState == ConnectionStateReceivedResponse || m_con
nectionState == ConnectionStateReceivingData); | 331 RELEASE_ASSERT(m_connectionState == ConnectionStateReceivedResponse || m_con
nectionState == ConnectionStateReceivingData); |
| 332 ASSERT(m_state == Initialized); | 332 ASSERT(m_state == Initialized); |
| 333 m_resource->setSerializedCachedMetadata(data, length); | 333 m_resource->setSerializedCachedMetadata(data, length); |
| 334 } | 334 } |
| 335 | 335 |
| 336 void ResourceLoader::didSendData(blink::WebURLLoader*, unsigned long long bytesS
ent, unsigned long long totalBytesToBeSent) | 336 void ResourceLoader::didSendData(blink::WebURLLoader*, unsigned long long bytesS
ent, unsigned long long totalBytesToBeSent) |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); | 548 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); |
| 549 } | 549 } |
| 550 | 550 |
| 551 ResourceRequest& ResourceLoader::applyOptions(ResourceRequest& request) const | 551 ResourceRequest& ResourceLoader::applyOptions(ResourceRequest& request) const |
| 552 { | 552 { |
| 553 request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredC
redentials); | 553 request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredC
redentials); |
| 554 return request; | 554 return request; |
| 555 } | 555 } |
| 556 | 556 |
| 557 } | 557 } |
| OLD | NEW |