| 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 return m_options.corsEnabled == IsCORSEnabled; | 319 return m_options.corsEnabled == IsCORSEnabled; |
| 320 } | 320 } |
| 321 | 321 |
| 322 void ResourceLoader::didReceiveResponse(WebURLLoader*, const WebURLResponse& res
ponse, WebDataConsumerHandle* rawHandle) | 322 void ResourceLoader::didReceiveResponse(WebURLLoader*, const WebURLResponse& res
ponse, WebDataConsumerHandle* rawHandle) |
| 323 { | 323 { |
| 324 ASSERT(!response.isNull()); | 324 ASSERT(!response.isNull()); |
| 325 ASSERT(m_state == Initialized); | 325 ASSERT(m_state == Initialized); |
| 326 // |rawHandle|'s ownership is transferred to the callee. | 326 // |rawHandle|'s ownership is transferred to the callee. |
| 327 OwnPtr<WebDataConsumerHandle> handle = adoptPtr(rawHandle); | 327 OwnPtr<WebDataConsumerHandle> handle = adoptPtr(rawHandle); |
| 328 | 328 |
| 329 bool isMultipartPayload = response.isMultipartPayload(); | |
| 330 bool isValidStateTransition = (m_connectionState == ConnectionStateStarted |
| m_connectionState == ConnectionStateReceivedResponse); | 329 bool isValidStateTransition = (m_connectionState == ConnectionStateStarted |
| m_connectionState == ConnectionStateReceivedResponse); |
| 331 // In the case of multipart loads, calls to didReceiveData & didReceiveRespo
nse can be interleaved. | 330 RELEASE_ASSERT(isValidStateTransition); |
| 332 RELEASE_ASSERT(isMultipartPayload || isValidStateTransition); | |
| 333 m_connectionState = ConnectionStateReceivedResponse; | 331 m_connectionState = ConnectionStateReceivedResponse; |
| 334 | 332 |
| 335 const ResourceResponse& resourceResponse = response.toResourceResponse(); | 333 const ResourceResponse& resourceResponse = response.toResourceResponse(); |
| 336 | 334 |
| 337 if (responseNeedsAccessControlCheck()) { | 335 if (responseNeedsAccessControlCheck()) { |
| 338 if (response.wasFetchedViaServiceWorker()) { | 336 if (response.wasFetchedViaServiceWorker()) { |
| 339 if (response.wasFallbackRequiredByServiceWorker()) { | 337 if (response.wasFallbackRequiredByServiceWorker()) { |
| 340 m_loader->cancel(); | 338 m_loader->cancel(); |
| 341 m_loader.clear(); | 339 m_loader.clear(); |
| 342 m_connectionState = ConnectionStateStarted; | 340 m_connectionState = ConnectionStateStarted; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); | 506 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); |
| 509 } | 507 } |
| 510 | 508 |
| 511 ResourceRequest& ResourceLoader::applyOptions(ResourceRequest& request) const | 509 ResourceRequest& ResourceLoader::applyOptions(ResourceRequest& request) const |
| 512 { | 510 { |
| 513 request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredC
redentials); | 511 request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredC
redentials); |
| 514 return request; | 512 return request; |
| 515 } | 513 } |
| 516 | 514 |
| 517 } // namespace blink | 515 } // namespace blink |
| OLD | NEW |