| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 if (document() && document()->hasActiveParser()) | 300 if (document() && document()->hasActiveParser()) |
| 301 return true; | 301 return true; |
| 302 | 302 |
| 303 return isLoadingMainResource() || !m_resourceLoaders.isEmpty(); | 303 return isLoadingMainResource() || !m_resourceLoaders.isEmpty(); |
| 304 } | 304 } |
| 305 | 305 |
| 306 void DocumentLoader::notifyFinished(CachedResource* resource) | 306 void DocumentLoader::notifyFinished(CachedResource* resource) |
| 307 { | 307 { |
| 308 ASSERT_UNUSED(resource, m_mainResource == resource); | 308 ASSERT_UNUSED(resource, m_mainResource == resource); |
| 309 ASSERT(m_mainResource); | 309 ASSERT(m_mainResource); |
| 310 |
| 311 RefPtr<DocumentLoader> protect(this); |
| 312 |
| 310 if (!m_mainResource->errorOccurred() && !m_mainResource->wasCanceled()) { | 313 if (!m_mainResource->errorOccurred() && !m_mainResource->wasCanceled()) { |
| 311 finishedLoading(m_mainResource->loadFinishTime()); | 314 finishedLoading(m_mainResource->loadFinishTime()); |
| 312 return; | 315 return; |
| 313 } | 316 } |
| 314 | 317 |
| 315 mainReceivedError(m_mainResource->resourceError()); | 318 mainReceivedError(m_mainResource->resourceError()); |
| 316 } | 319 } |
| 317 | 320 |
| 318 void DocumentLoader::finishedLoading(double finishTime) | 321 void DocumentLoader::finishedLoading(double finishTime) |
| 319 { | 322 { |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 const KURL& DocumentLoader::unreachableURL() const | 900 const KURL& DocumentLoader::unreachableURL() const |
| 898 { | 901 { |
| 899 return m_substituteData.failingURL(); | 902 return m_substituteData.failingURL(); |
| 900 } | 903 } |
| 901 | 904 |
| 902 void DocumentLoader::setDefersLoading(bool defers) | 905 void DocumentLoader::setDefersLoading(bool defers) |
| 903 { | 906 { |
| 904 // Multiple frames may be loading the same main resource simultaneously. If
deferral state changes, | 907 // Multiple frames may be loading the same main resource simultaneously. If
deferral state changes, |
| 905 // each frame's DocumentLoader will try to send a setDefersLoading() to the
same underlying ResourceLoader. Ensure only | 908 // each frame's DocumentLoader will try to send a setDefersLoading() to the
same underlying ResourceLoader. Ensure only |
| 906 // the "owning" DocumentLoader does so, as setDefersLoading() is not resilie
nt to setting the same value repeatedly. | 909 // the "owning" DocumentLoader does so, as setDefersLoading() is not resilie
nt to setting the same value repeatedly. |
| 907 if (mainResourceLoader() && mainResourceLoader()->documentLoader() == this) | 910 if (mainResourceLoader() && mainResourceLoader()->isLoadedBy(m_cachedResourc
eLoader.get())) |
| 908 mainResourceLoader()->setDefersLoading(defers); | 911 mainResourceLoader()->setDefersLoading(defers); |
| 909 | 912 |
| 910 setAllDefersLoading(m_resourceLoaders, defers); | 913 setAllDefersLoading(m_resourceLoaders, defers); |
| 911 } | 914 } |
| 912 | 915 |
| 913 void DocumentLoader::stopLoadingSubresources() | 916 void DocumentLoader::stopLoadingSubresources() |
| 914 { | 917 { |
| 915 cancelAll(m_resourceLoaders); | 918 cancelAll(m_resourceLoaders); |
| 916 } | 919 } |
| 917 | 920 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) | 1102 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) |
| 1100 { | 1103 { |
| 1101 m_frame->loader()->stopAllLoaders(); | 1104 m_frame->loader()->stopAllLoaders(); |
| 1102 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url(
), mimeType(), m_writer ? m_writer->encoding() : "", m_writer ? m_writer->encod
ingWasChosenByUser() : false, true); | 1105 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url(
), mimeType(), m_writer ? m_writer->encoding() : "", m_writer ? m_writer->encod
ingWasChosenByUser() : false, true); |
| 1103 if (!source.isNull()) | 1106 if (!source.isNull()) |
| 1104 m_writer->appendReplacingData(source); | 1107 m_writer->appendReplacingData(source); |
| 1105 endWriting(m_writer.get()); | 1108 endWriting(m_writer.get()); |
| 1106 } | 1109 } |
| 1107 | 1110 |
| 1108 } // namespace WebCore | 1111 } // namespace WebCore |
| OLD | NEW |