| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 { | 253 { |
| 254 cancel(ResourceError()); | 254 cancel(ResourceError()); |
| 255 } | 255 } |
| 256 | 256 |
| 257 void ResourceLoader::cancel(const ResourceError& error) | 257 void ResourceLoader::cancel(const ResourceError& error) |
| 258 { | 258 { |
| 259 // If the load has already completed - succeeded, failed, or previously canc
elled - do nothing. | 259 // If the load has already completed - succeeded, failed, or previously canc
elled - do nothing. |
| 260 if (m_reachedTerminalState) | 260 if (m_reachedTerminalState) |
| 261 return; | 261 return; |
| 262 | 262 |
| 263 ResourceError nonNullError = error.isNull() ? cancelledError() : error; | 263 ResourceError nonNullError = error.isNull() ? ResourceError::cancelledError(
m_request.url()) : error; |
| 264 | 264 |
| 265 // This function calls out to clients at several points that might do | 265 // This function calls out to clients at several points that might do |
| 266 // something that causes the last reference to this object to go away. | 266 // something that causes the last reference to this object to go away. |
| 267 RefPtr<ResourceLoader> protector(this); | 267 RefPtr<ResourceLoader> protector(this); |
| 268 | 268 |
| 269 // If we re-enter cancel() from inside this if() block, we want to pick up f
rom where we left | 269 // If we re-enter cancel() from inside this if() block, we want to pick up f
rom where we left |
| 270 // off without re-running it | 270 // off without re-running it |
| 271 if (m_state == Initialized) { | 271 if (m_state == Initialized) { |
| 272 LOG(ResourceLoading, "Cancelled load of '%s'.\n", m_resource->url().stri
ng().latin1().data()); | 272 LOG(ResourceLoading, "Cancelled load of '%s'.\n", m_resource->url().stri
ng().latin1().data()); |
| 273 m_state = Finishing; | 273 m_state = Finishing; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 295 frameLoader()->notifier()->didFailToLoad(this, nonNullError); | 295 frameLoader()->notifier()->didFailToLoad(this, nonNullError); |
| 296 } | 296 } |
| 297 | 297 |
| 298 // If cancel() completed from within the call to willCancel() or didFailToLo
ad(), | 298 // If cancel() completed from within the call to willCancel() or didFailToLo
ad(), |
| 299 // we don't want to redo didCancel() or releasesResources(). | 299 // we don't want to redo didCancel() or releasesResources(). |
| 300 if (m_reachedTerminalState) | 300 if (m_reachedTerminalState) |
| 301 return; | 301 return; |
| 302 releaseResources(); | 302 releaseResources(); |
| 303 } | 303 } |
| 304 | 304 |
| 305 ResourceError ResourceLoader::cancelledError() | |
| 306 { | |
| 307 return frameLoader()->cancelledError(m_request); | |
| 308 } | |
| 309 | |
| 310 ResourceError ResourceLoader::cannotShowURLError() | |
| 311 { | |
| 312 return frameLoader()->client()->cannotShowURLError(m_request); | |
| 313 } | |
| 314 | |
| 315 void ResourceLoader::willSendRequest(ResourceHandle*, ResourceRequest& request,
const ResourceResponse& redirectResponse) | 305 void ResourceLoader::willSendRequest(ResourceHandle*, ResourceRequest& request,
const ResourceResponse& redirectResponse) |
| 316 { | 306 { |
| 317 if (documentLoader()->applicationCacheHost()->maybeLoadFallbackForRedirect(t
his, request, redirectResponse)) | 307 if (documentLoader()->applicationCacheHost()->maybeLoadFallbackForRedirect(t
his, request, redirectResponse)) |
| 318 return; | 308 return; |
| 319 | 309 |
| 320 // Store the previous URL because we may modify it. | 310 // Store the previous URL because we may modify it. |
| 321 KURL previousURL = m_request.url(); | 311 KURL previousURL = m_request.url(); |
| 322 RefPtr<ResourceLoader> protect(this); | 312 RefPtr<ResourceLoader> protect(this); |
| 323 | 313 |
| 324 ASSERT(!request.isNull()); | 314 ASSERT(!request.isNull()); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 info.addMember(m_request, "request"); | 520 info.addMember(m_request, "request"); |
| 531 info.addMember(m_originalRequest, "originalRequest"); | 521 info.addMember(m_originalRequest, "originalRequest"); |
| 532 info.addMember(m_deferredRequest, "deferredRequest"); | 522 info.addMember(m_deferredRequest, "deferredRequest"); |
| 533 info.addMember(m_options, "options"); | 523 info.addMember(m_options, "options"); |
| 534 info.addMember(m_resource, "resource"); | 524 info.addMember(m_resource, "resource"); |
| 535 info.addMember(m_documentLoader, "documentLoader"); | 525 info.addMember(m_documentLoader, "documentLoader"); |
| 536 info.addMember(m_requestCountTracker, "requestCountTracker"); | 526 info.addMember(m_requestCountTracker, "requestCountTracker"); |
| 537 } | 527 } |
| 538 | 528 |
| 539 } | 529 } |
| OLD | NEW |