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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 { | 55 { |
56 RefPtrWillBeRawPtr<ResourceLoader> loader(adoptRefWillBeNoop(new ResourceLoa
der(fetcher, resource, options))); | 56 RefPtrWillBeRawPtr<ResourceLoader> loader(adoptRefWillBeNoop(new ResourceLoa
der(fetcher, resource, options))); |
57 loader->init(request); | 57 loader->init(request); |
58 return loader.release(); | 58 return loader.release(); |
59 } | 59 } |
60 | 60 |
61 ResourceLoader::ResourceLoader(ResourceFetcher* fetcher, Resource* resource, con
st ResourceLoaderOptions& options) | 61 ResourceLoader::ResourceLoader(ResourceFetcher* fetcher, Resource* resource, con
st ResourceLoaderOptions& options) |
62 : m_fetcher(fetcher) | 62 : m_fetcher(fetcher) |
63 , m_notifiedLoadComplete(false) | 63 , m_notifiedLoadComplete(false) |
64 , m_defersLoading(fetcher->defersLoading()) | 64 , m_defersLoading(fetcher->defersLoading()) |
| 65 , m_loadingMultipartContent(false) |
65 , m_options(options) | 66 , m_options(options) |
66 , m_resource(resource) | 67 , m_resource(resource) |
67 , m_state(Initialized) | 68 , m_state(Initialized) |
68 , m_connectionState(ConnectionStateNew) | 69 , m_connectionState(ConnectionStateNew) |
69 { | 70 { |
70 } | 71 } |
71 | 72 |
72 ResourceLoader::~ResourceLoader() | 73 ResourceLoader::~ResourceLoader() |
73 { | 74 { |
74 ASSERT(m_state == Terminated); | 75 ASSERT(m_state == Terminated); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 RefPtrWillBeRawPtr<ResourceLoader> protect(this); | 370 RefPtrWillBeRawPtr<ResourceLoader> protect(this); |
370 m_resource->responseReceived(resourceResponse, handle.release()); | 371 m_resource->responseReceived(resourceResponse, handle.release()); |
371 if (m_state == Terminated) | 372 if (m_state == Terminated) |
372 return; | 373 return; |
373 | 374 |
374 m_fetcher->didReceiveResponse(m_resource, resourceResponse); | 375 m_fetcher->didReceiveResponse(m_resource, resourceResponse); |
375 if (m_state == Terminated) | 376 if (m_state == Terminated) |
376 return; | 377 return; |
377 | 378 |
378 if (response.toResourceResponse().isMultipart()) { | 379 if (response.toResourceResponse().isMultipart()) { |
379 if (!m_resource->isImage()) { | 380 // We only support multipart for images, though the image may be loaded |
| 381 // as a main resource that we end up displaying through an ImageDocument
. |
| 382 if (!m_resource->isImage() && m_resource->type() != Resource::MainResour
ce) { |
380 cancel(); | 383 cancel(); |
381 return; | 384 return; |
382 } | 385 } |
| 386 m_loadingMultipartContent = true; |
383 } else if (isMultipartPayload) { | 387 } else if (isMultipartPayload) { |
384 // Since a subresource loader does not load multipart sections progressi
vely, data was delivered to the loader all at once. | 388 // Since a subresource loader does not load multipart sections progressi
vely, data was delivered to the loader all at once. |
385 // After the first multipart section is complete, signal to delegates th
at this load is "finished" | 389 // After the first multipart section is complete, signal to delegates th
at this load is "finished" |
386 m_fetcher->subresourceLoaderFinishedLoadingOnePart(this); | 390 m_fetcher->subresourceLoaderFinishedLoadingOnePart(this); |
387 didFinishLoadingOnePart(0, WebURLLoaderClient::kUnknownEncodedDataLength
); | 391 didFinishLoadingOnePart(0, WebURLLoaderClient::kUnknownEncodedDataLength
); |
388 } | 392 } |
389 if (m_state == Terminated) | 393 if (m_state == Terminated) |
390 return; | 394 return; |
391 | 395 |
392 if (m_resource->response().httpStatusCode() < 400 || m_resource->shouldIgnor
eHTTPStatusCodeErrors()) | 396 if (m_resource->response().httpStatusCode() < 400 || m_resource->shouldIgnor
eHTTPStatusCodeErrors()) |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); | 536 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); |
533 } | 537 } |
534 | 538 |
535 ResourceRequest& ResourceLoader::applyOptions(ResourceRequest& request) const | 539 ResourceRequest& ResourceLoader::applyOptions(ResourceRequest& request) const |
536 { | 540 { |
537 request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredC
redentials); | 541 request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredC
redentials); |
538 return request; | 542 return request; |
539 } | 543 } |
540 | 544 |
541 } | 545 } |
OLD | NEW |