| 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 24 matching lines...) Expand all Loading... |
| 35 #include "core/loader/FrameLoader.h" | 35 #include "core/loader/FrameLoader.h" |
| 36 #include "core/loader/FrameLoaderClient.h" | 36 #include "core/loader/FrameLoaderClient.h" |
| 37 #include "core/loader/UniqueIdentifier.h" | 37 #include "core/loader/UniqueIdentifier.h" |
| 38 #include "core/loader/appcache/ApplicationCacheHost.h" | 38 #include "core/loader/appcache/ApplicationCacheHost.h" |
| 39 #include "core/loader/cache/CachedResourceLoader.h" | 39 #include "core/loader/cache/CachedResourceLoader.h" |
| 40 #include "core/page/Frame.h" | 40 #include "core/page/Frame.h" |
| 41 #include "core/page/Page.h" | 41 #include "core/page/Page.h" |
| 42 #include "core/platform/Logging.h" | 42 #include "core/platform/Logging.h" |
| 43 #include "core/platform/network/ResourceError.h" | 43 #include "core/platform/network/ResourceError.h" |
| 44 #include "core/platform/network/ResourceHandle.h" | 44 #include "core/platform/network/ResourceHandle.h" |
| 45 #include "weborigin/SecurityOrigin.h" | |
| 46 | 45 |
| 47 namespace WebCore { | 46 namespace WebCore { |
| 48 | 47 |
| 49 ResourceLoader::RequestCountTracker::RequestCountTracker(CachedResourceLoader* c
achedResourceLoader, CachedResource* resource) | 48 ResourceLoader::RequestCountTracker::RequestCountTracker(CachedResourceLoader* c
achedResourceLoader, CachedResource* resource) |
| 50 : m_cachedResourceLoader(cachedResourceLoader) | 49 : m_cachedResourceLoader(cachedResourceLoader) |
| 51 , m_resource(resource) | 50 , m_resource(resource) |
| 52 { | 51 { |
| 53 m_cachedResourceLoader->incrementRequestCount(m_resource); | 52 m_cachedResourceLoader->incrementRequestCount(m_resource); |
| 54 } | 53 } |
| 55 | 54 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 121 } |
| 123 | 122 |
| 124 m_deferredRequest = ResourceRequest(); | 123 m_deferredRequest = ResourceRequest(); |
| 125 } | 124 } |
| 126 | 125 |
| 127 bool ResourceLoader::init(const ResourceRequest& r) | 126 bool ResourceLoader::init(const ResourceRequest& r) |
| 128 { | 127 { |
| 129 ASSERT(!m_handle); | 128 ASSERT(!m_handle); |
| 130 ASSERT(m_request.isNull()); | 129 ASSERT(m_request.isNull()); |
| 131 ASSERT(m_deferredRequest.isNull()); | 130 ASSERT(m_deferredRequest.isNull()); |
| 132 ASSERT(!m_documentLoader->isSubstituteLoadPending(this)); | |
| 133 | 131 |
| 134 ResourceRequest clientRequest(r); | 132 ResourceRequest clientRequest(r); |
| 135 | 133 |
| 136 m_identifier = createUniqueIdentifier(); | 134 m_identifier = createUniqueIdentifier(); |
| 137 willSendRequest(0, clientRequest, ResourceResponse()); | 135 willSendRequest(0, clientRequest, ResourceResponse()); |
| 138 if (clientRequest.isNull()) { | 136 if (clientRequest.isNull()) { |
| 139 cancel(); | 137 cancel(); |
| 140 return false; | 138 return false; |
| 141 } | 139 } |
| 142 ASSERT(m_state != Terminated); | 140 ASSERT(m_state != Terminated); |
| 143 | 141 |
| 144 m_originalRequest = m_request = clientRequest; | 142 m_originalRequest = m_request = clientRequest; |
| 145 m_state = Initialized; | 143 m_state = Initialized; |
| 146 m_documentLoader->addResourceLoader(this); | 144 m_documentLoader->addResourceLoader(this); |
| 147 return true; | 145 return true; |
| 148 } | 146 } |
| 149 | 147 |
| 150 void ResourceLoader::start() | 148 void ResourceLoader::start() |
| 151 { | 149 { |
| 152 ASSERT(!m_handle); | 150 ASSERT(!m_handle); |
| 153 ASSERT(!m_request.isNull()); | 151 ASSERT(!m_request.isNull()); |
| 154 ASSERT(m_deferredRequest.isNull()); | 152 ASSERT(m_deferredRequest.isNull()); |
| 155 | 153 |
| 156 if (m_documentLoader->scheduleArchiveLoad(this, m_request)) | |
| 157 return; | |
| 158 | |
| 159 m_documentLoader->applicationCacheHost()->willStartLoadingResource(m_request
); | 154 m_documentLoader->applicationCacheHost()->willStartLoadingResource(m_request
); |
| 160 | 155 |
| 161 if (m_defersLoading) { | 156 if (m_defersLoading) { |
| 162 m_deferredRequest = m_request; | 157 m_deferredRequest = m_request; |
| 163 return; | 158 return; |
| 164 } | 159 } |
| 165 | 160 |
| 166 if (m_state != Terminated) | 161 if (m_state != Terminated) |
| 167 m_handle = ResourceHandle::create(m_frame->loader()->networkingContext()
, m_request, this, m_defersLoading, m_options.sniffContent == SniffContent, m_op
tions.allowCredentials); | 162 m_handle = ResourceHandle::create(m_frame->loader()->networkingContext()
, m_request, this, m_defersLoading, m_options.sniffContent == SniffContent, m_op
tions.allowCredentials); |
| 168 } | 163 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 // This function calls out to clients at several points that might do | 236 // This function calls out to clients at several points that might do |
| 242 // something that causes the last reference to this object to go away. | 237 // something that causes the last reference to this object to go away. |
| 243 RefPtr<ResourceLoader> protector(this); | 238 RefPtr<ResourceLoader> protector(this); |
| 244 | 239 |
| 245 LOG(ResourceLoading, "Cancelled load of '%s'.\n", m_resource->url().string()
.latin1().data()); | 240 LOG(ResourceLoading, "Cancelled load of '%s'.\n", m_resource->url().string()
.latin1().data()); |
| 246 m_state = Finishing; | 241 m_state = Finishing; |
| 247 m_resource->setResourceError(nonNullError); | 242 m_resource->setResourceError(nonNullError); |
| 248 if (m_resource->resourceToRevalidate()) | 243 if (m_resource->resourceToRevalidate()) |
| 249 m_resource->revalidationFailed(); | 244 m_resource->revalidationFailed(); |
| 250 | 245 |
| 251 m_documentLoader->cancelPendingSubstituteLoad(this); | |
| 252 if (m_handle) { | 246 if (m_handle) { |
| 253 m_handle->cancel(); | 247 m_handle->cancel(); |
| 254 m_handle = 0; | 248 m_handle = 0; |
| 255 } | 249 } |
| 256 | 250 |
| 257 if (m_options.sendLoadCallbacks == SendCallbacks && m_identifier && !m_notif
iedLoadComplete) | 251 if (m_options.sendLoadCallbacks == SendCallbacks && m_identifier && !m_notif
iedLoadComplete) |
| 258 frameLoader()->notifier()->didFailToLoad(this, nonNullError); | 252 frameLoader()->notifier()->didFailToLoad(this, nonNullError); |
| 259 | 253 |
| 260 m_resource->error(CachedResource::LoadError); | 254 m_resource->error(CachedResource::LoadError); |
| 261 if (m_state != Terminated) | 255 if (m_state != Terminated) |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 info.addMember(m_request, "request"); | 453 info.addMember(m_request, "request"); |
| 460 info.addMember(m_originalRequest, "originalRequest"); | 454 info.addMember(m_originalRequest, "originalRequest"); |
| 461 info.addMember(m_deferredRequest, "deferredRequest"); | 455 info.addMember(m_deferredRequest, "deferredRequest"); |
| 462 info.addMember(m_options, "options"); | 456 info.addMember(m_options, "options"); |
| 463 info.addMember(m_resource, "resource"); | 457 info.addMember(m_resource, "resource"); |
| 464 info.addMember(m_documentLoader, "documentLoader"); | 458 info.addMember(m_documentLoader, "documentLoader"); |
| 465 info.addMember(m_requestCountTracker, "requestCountTracker"); | 459 info.addMember(m_requestCountTracker, "requestCountTracker"); |
| 466 } | 460 } |
| 467 | 461 |
| 468 } | 462 } |
| OLD | NEW |