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