| 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 22 matching lines...) Expand all Loading... |
| 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 "platform/Logging.h" | 36 #include "platform/Logging.h" |
| 37 #include "platform/SharedBuffer.h" | 37 #include "platform/SharedBuffer.h" |
| 38 #include "platform/exported/WrappedResourceRequest.h" | 38 #include "platform/exported/WrappedResourceRequest.h" |
| 39 #include "platform/exported/WrappedResourceResponse.h" | 39 #include "platform/exported/WrappedResourceResponse.h" |
| 40 #include "platform/network/ResourceError.h" | 40 #include "platform/network/ResourceError.h" |
| 41 #include "public/platform/Platform.h" | 41 #include "public/platform/Platform.h" |
| 42 #include "public/platform/WebData.h" | 42 #include "public/platform/WebData.h" |
| 43 #include "public/platform/WebThreadedDataReceiver.h" |
| 43 #include "public/platform/WebURLError.h" | 44 #include "public/platform/WebURLError.h" |
| 44 #include "public/platform/WebURLRequest.h" | 45 #include "public/platform/WebURLRequest.h" |
| 45 #include "public/platform/WebURLResponse.h" | 46 #include "public/platform/WebURLResponse.h" |
| 46 #include "wtf/Assertions.h" | 47 #include "wtf/Assertions.h" |
| 47 #include "wtf/CurrentTime.h" | 48 #include "wtf/CurrentTime.h" |
| 48 | 49 |
| 49 namespace WebCore { | 50 namespace WebCore { |
| 50 | 51 |
| 51 ResourceLoader::RequestCountTracker::RequestCountTracker(ResourceLoaderHost* hos
t, Resource* resource) | 52 ResourceLoader::RequestCountTracker::RequestCountTracker(ResourceLoaderHost* hos
t, Resource* resource) |
| 52 : m_host(host) | 53 : m_host(host) |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 m_defersLoading = defers; | 173 m_defersLoading = defers; |
| 173 if (m_loader) | 174 if (m_loader) |
| 174 m_loader->setDefersLoading(defers); | 175 m_loader->setDefersLoading(defers); |
| 175 if (!defers && !m_deferredRequest.isNull()) { | 176 if (!defers && !m_deferredRequest.isNull()) { |
| 176 m_request = applyOptions(m_deferredRequest); | 177 m_request = applyOptions(m_deferredRequest); |
| 177 m_deferredRequest = ResourceRequest(); | 178 m_deferredRequest = ResourceRequest(); |
| 178 start(); | 179 start(); |
| 179 } | 180 } |
| 180 } | 181 } |
| 181 | 182 |
| 183 void ResourceLoader::attachThreadedDataReceiver(PassOwnPtr<blink::WebThreadedDat
aReceiver> threadedDataReceiver) |
| 184 { |
| 185 if (m_loader) { |
| 186 // The implementor of the WebURLLoader assumes ownership of the |
| 187 // threaded data receiver if it signals that it got successfully |
| 188 // attached. |
| 189 blink::WebThreadedDataReceiver* rawThreadedDataReceiver = threadedDataRe
ceiver.leakPtr(); |
| 190 if (!m_loader->attachThreadedDataReceiver(rawThreadedDataReceiver)) |
| 191 delete rawThreadedDataReceiver; |
| 192 } |
| 193 } |
| 194 |
| 182 void ResourceLoader::didDownloadData(blink::WebURLLoader*, int length, int encod
edDataLength) | 195 void ResourceLoader::didDownloadData(blink::WebURLLoader*, int length, int encod
edDataLength) |
| 183 { | 196 { |
| 184 RefPtr<ResourceLoader> protect(this); | 197 RefPtr<ResourceLoader> protect(this); |
| 185 RELEASE_ASSERT(m_connectionState == ConnectionStateReceivedResponse); | 198 RELEASE_ASSERT(m_connectionState == ConnectionStateReceivedResponse); |
| 186 m_host->didDownloadData(m_resource, length, encodedDataLength); | 199 m_host->didDownloadData(m_resource, length, encodedDataLength); |
| 187 m_resource->didDownloadData(length); | 200 m_resource->didDownloadData(length); |
| 188 } | 201 } |
| 189 | 202 |
| 190 void ResourceLoader::didFinishLoadingOnePart(double finishTime, int64 encodedDat
aLength) | 203 void ResourceLoader::didFinishLoadingOnePart(double finishTime, int64 encodedDat
aLength) |
| 191 { | 204 { |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); | 491 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); |
| 479 } | 492 } |
| 480 | 493 |
| 481 ResourceRequest& ResourceLoader::applyOptions(ResourceRequest& request) const | 494 ResourceRequest& ResourceLoader::applyOptions(ResourceRequest& request) const |
| 482 { | 495 { |
| 483 request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredC
redentials); | 496 request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredC
redentials); |
| 484 return request; | 497 return request; |
| 485 } | 498 } |
| 486 | 499 |
| 487 } | 500 } |
| OLD | NEW |