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 15 matching lines...) Expand all Loading... |
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 */ | 28 */ |
29 | 29 |
30 #include "config.h" | 30 #include "config.h" |
31 #include "core/fetch/ResourceLoader.h" | 31 #include "core/fetch/ResourceLoader.h" |
32 | 32 |
33 #include "core/fetch/Resource.h" | 33 #include "core/fetch/Resource.h" |
34 #include "core/fetch/ResourceLoaderHost.h" | 34 #include "core/fetch/ResourceLoaderHost.h" |
35 #include "core/fetch/ResourcePtr.h" | 35 #include "core/fetch/ResourcePtr.h" |
| 36 #include "core/html/parser/ThreadedDataReceiver.h" |
36 #include "platform/Logging.h" | 37 #include "platform/Logging.h" |
37 #include "platform/SharedBuffer.h" | 38 #include "platform/SharedBuffer.h" |
38 #include "platform/exported/WrappedResourceRequest.h" | 39 #include "platform/exported/WrappedResourceRequest.h" |
39 #include "platform/exported/WrappedResourceResponse.h" | 40 #include "platform/exported/WrappedResourceResponse.h" |
40 #include "platform/network/ResourceError.h" | 41 #include "platform/network/ResourceError.h" |
41 #include "public/platform/Platform.h" | 42 #include "public/platform/Platform.h" |
42 #include "public/platform/WebData.h" | 43 #include "public/platform/WebData.h" |
43 #include "public/platform/WebThreadedDataReceiver.h" | 44 #include "public/platform/WebThreadedDataReceiver.h" |
44 #include "public/platform/WebURLError.h" | 45 #include "public/platform/WebURLError.h" |
45 #include "public/platform/WebURLRequest.h" | 46 #include "public/platform/WebURLRequest.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 m_defersLoading = defers; | 165 m_defersLoading = defers; |
165 if (m_loader) | 166 if (m_loader) |
166 m_loader->setDefersLoading(defers); | 167 m_loader->setDefersLoading(defers); |
167 if (!defers && !m_deferredRequest.isNull()) { | 168 if (!defers && !m_deferredRequest.isNull()) { |
168 m_request = applyOptions(m_deferredRequest); | 169 m_request = applyOptions(m_deferredRequest); |
169 m_deferredRequest = ResourceRequest(); | 170 m_deferredRequest = ResourceRequest(); |
170 start(); | 171 start(); |
171 } | 172 } |
172 } | 173 } |
173 | 174 |
174 void ResourceLoader::attachThreadedDataReceiver(PassOwnPtr<blink::WebThreadedDat
aReceiver> threadedDataReceiver) | 175 void ResourceLoader::attachThreadedDataReceiver(PassRefPtrWillBeRawPtr<ThreadedD
ataReceiver> threadedDataReceiver) |
175 { | 176 { |
176 if (m_loader) { | 177 if (m_loader) { |
177 // The implementor of the WebURLLoader assumes ownership of the | 178 // The implementor of the WebURLLoader assumes ownership of the |
178 // threaded data receiver if it signals that it got successfully | 179 // threaded data receiver if it signals that it got successfully |
179 // attached. | 180 // attached. |
180 blink::WebThreadedDataReceiver* rawThreadedDataReceiver = threadedDataRe
ceiver.leakPtr(); | 181 WebThreadedDataReceiver* webDataReceiver = new WebThreadedDataReceiver(t
hreadedDataReceiver); |
181 if (!m_loader->attachThreadedDataReceiver(rawThreadedDataReceiver)) | 182 if (!m_loader->attachThreadedDataReceiver(webDataReceiver)) |
182 delete rawThreadedDataReceiver; | 183 delete webDataReceiver; |
183 } | 184 } |
184 } | 185 } |
185 | 186 |
186 void ResourceLoader::didDownloadData(blink::WebURLLoader*, int length, int encod
edDataLength) | 187 void ResourceLoader::didDownloadData(blink::WebURLLoader*, int length, int encod
edDataLength) |
187 { | 188 { |
188 ASSERT(m_state != Terminated); | 189 ASSERT(m_state != Terminated); |
189 RefPtrWillBeRawPtr<ResourceLoader> protect(this); | 190 RefPtrWillBeRawPtr<ResourceLoader> protect(this); |
190 RELEASE_ASSERT(m_connectionState == ConnectionStateReceivedResponse); | 191 RELEASE_ASSERT(m_connectionState == ConnectionStateReceivedResponse); |
191 m_host->didDownloadData(m_resource, length, encodedDataLength); | 192 m_host->didDownloadData(m_resource, length, encodedDataLength); |
192 if (m_state == Terminated) | 193 if (m_state == Terminated) |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); | 524 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); |
524 } | 525 } |
525 | 526 |
526 ResourceRequest& ResourceLoader::applyOptions(ResourceRequest& request) const | 527 ResourceRequest& ResourceLoader::applyOptions(ResourceRequest& request) const |
527 { | 528 { |
528 request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredC
redentials); | 529 request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredC
redentials); |
529 return request; | 530 return request; |
530 } | 531 } |
531 | 532 |
532 } | 533 } |
OLD | NEW |