Chromium Code Reviews| Index: third_party/WebKit/Source/core/fetch/ResourceLoader.cpp |
| diff --git a/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp b/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp |
| index 2ff8e64f0f3caeb801343d7cdba34af92545fd17..052bec7207a49909f1a65272bbbf282cb9de7566 100644 |
| --- a/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp |
| +++ b/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp |
| @@ -69,7 +69,6 @@ ResourceLoader::ResourceLoader(ResourceFetcher* fetcher, Resource* resource, con |
| : m_fetcher(fetcher) |
| , m_notifiedLoadComplete(false) |
| , m_defersLoading(fetcher->defersLoading()) |
| - , m_loadingMultipartContent(false) |
| , m_options(options) |
| , m_resource(resource) |
| , m_state(Initialized) |
| @@ -202,8 +201,13 @@ void ResourceLoader::didDownloadData(WebURLLoader*, int length, int encodedDataL |
| void ResourceLoader::didFinishLoadingOnePart(double finishTime, int64_t encodedDataLength) |
| { |
| - // If load has been cancelled after finishing (which could happen with a |
| - // JavaScript that changes the window location), do nothing. |
| + ASSERT(m_state != Terminated); |
| + if (m_state != Finishing) { |
|
Nate Chapin
2016/03/08 17:57:52
This will need to be rebased.
Also, can this func
yhirano
2016/03/08 18:40:41
Done.
isFinishing() returns true when called from
|
| + // When loading a multipart resource, make the loader non-block when |
| + // finishing loading the first part. |
| + m_fetcher->subresourceLoaderFinishedLoadingOnePart(this); |
|
Nate Chapin
2016/03/08 17:57:52
Is it intentional to call this for non-multipart l
yhirano
2016/03/08 18:40:41
The assumption here is that
isFinishing() == !(lo
|
| + } |
| + |
| if (m_state == Terminated) |
| return; |
| @@ -322,10 +326,8 @@ void ResourceLoader::didReceiveResponse(WebURLLoader*, const WebURLResponse& res |
| // |rawHandle|'s ownership is transferred to the callee. |
| OwnPtr<WebDataConsumerHandle> handle = adoptPtr(rawHandle); |
| - bool isMultipartPayload = response.isMultipartPayload(); |
| bool isValidStateTransition = (m_connectionState == ConnectionStateStarted || m_connectionState == ConnectionStateReceivedResponse); |
| - // In the case of multipart loads, calls to didReceiveData & didReceiveResponse can be interleaved. |
| - RELEASE_ASSERT(isMultipartPayload || isValidStateTransition); |
| + RELEASE_ASSERT(isValidStateTransition); |
| m_connectionState = ConnectionStateReceivedResponse; |
| const ResourceResponse& resourceResponse = response.toResourceResponse(); |
| @@ -363,23 +365,6 @@ void ResourceLoader::didReceiveResponse(WebURLLoader*, const WebURLResponse& res |
| if (m_state == Terminated) |
| return; |
| - if (response.toResourceResponse().isMultipart()) { |
| - // We only support multipart for images, though the image may be loaded |
| - // as a main resource that we end up displaying through an ImageDocument. |
| - if (!m_resource->isImage() && m_resource->getType() != Resource::MainResource) { |
| - cancel(); |
| - return; |
| - } |
| - m_loadingMultipartContent = true; |
| - } else if (isMultipartPayload) { |
| - // Since a subresource loader does not load multipart sections progressively, data was delivered to the loader all at once. |
| - // After the first multipart section is complete, signal to delegates that this load is "finished" |
| - m_fetcher->subresourceLoaderFinishedLoadingOnePart(this); |
| - didFinishLoadingOnePart(0, WebURLLoaderClient::kUnknownEncodedDataLength); |
| - } |
| - if (m_state == Terminated) |
| - return; |
| - |
| if (m_resource->response().httpStatusCode() < 400 || m_resource->shouldIgnoreHTTPStatusCodeErrors()) |
| return; |
| m_state = Finishing; |