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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 RELEASE_ASSERT(m_state == ConnectionStateReceivedResponse); | 122 RELEASE_ASSERT(m_state == ConnectionStateReceivedResponse); |
123 m_fetcher->didDownloadData(m_resource.get(), length, encodedDataLength); | 123 m_fetcher->didDownloadData(m_resource.get(), length, encodedDataLength); |
124 if (m_state == ConnectionStateReleased) | 124 if (m_state == ConnectionStateReleased) |
125 return; | 125 return; |
126 m_resource->didDownloadData(length); | 126 m_resource->didDownloadData(length); |
127 } | 127 } |
128 | 128 |
129 void ResourceLoader::didFinishLoadingOnePart(double finishTime, int64_t encodedD
ataLength) | 129 void ResourceLoader::didFinishLoadingOnePart(double finishTime, int64_t encodedD
ataLength) |
130 { | 130 { |
131 ASSERT(m_state != ConnectionStateReleased); | 131 ASSERT(m_state != ConnectionStateReleased); |
132 if (!isFinishing()) { | 132 if (isFinishing()) { |
| 133 m_fetcher->removeResourceLoader(this); |
| 134 } else { |
133 // When loading a multipart resource, make the loader non-block when | 135 // When loading a multipart resource, make the loader non-block when |
134 // finishing loading the first part. | 136 // finishing loading the first part. |
135 m_fetcher->subresourceLoaderFinishedLoadingOnePart(this); | 137 m_fetcher->moveResourceLoaderToNonBlocking(this); |
| 138 |
| 139 m_fetcher->didLoadResource(m_resource.get()); |
| 140 if (m_state == ConnectionStateReleased) |
| 141 return; |
136 } | 142 } |
137 | 143 |
138 if (m_state == ConnectionStateReleased) | |
139 return; | |
140 | |
141 if (m_notifiedLoadComplete) | 144 if (m_notifiedLoadComplete) |
142 return; | 145 return; |
143 m_notifiedLoadComplete = true; | 146 m_notifiedLoadComplete = true; |
144 m_fetcher->didFinishLoading(m_resource.get(), finishTime, encodedDataLength)
; | 147 m_fetcher->didFinishLoading(m_resource.get(), finishTime, encodedDataLength)
; |
145 } | 148 } |
146 | 149 |
147 void ResourceLoader::didChangePriority(ResourceLoadPriority loadPriority, int in
traPriorityValue) | 150 void ResourceLoader::didChangePriority(ResourceLoadPriority loadPriority, int in
traPriorityValue) |
148 { | 151 { |
149 ASSERT(m_state != ConnectionStateReleased); | 152 ASSERT(m_state != ConnectionStateReleased); |
150 if (m_loader) | 153 if (m_loader) |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 // empty buffer is a noop in most cases, but is destructive in the case of | 409 // empty buffer is a noop in most cases, but is destructive in the case of |
407 // a 304, where it will overwrite the cached data we should be reusing. | 410 // a 304, where it will overwrite the cached data we should be reusing. |
408 if (dataOut.size()) { | 411 if (dataOut.size()) { |
409 m_fetcher->didReceiveData(m_resource.get(), dataOut.data(), dataOut.size
(), encodedDataLength); | 412 m_fetcher->didReceiveData(m_resource.get(), dataOut.data(), dataOut.size
(), encodedDataLength); |
410 m_resource->setResourceBuffer(dataOut); | 413 m_resource->setResourceBuffer(dataOut); |
411 } | 414 } |
412 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); | 415 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); |
413 } | 416 } |
414 | 417 |
415 } // namespace blink | 418 } // namespace blink |
OLD | NEW |