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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 if (document() && document()->hasActiveParser()) | 295 if (document() && document()->hasActiveParser()) |
296 return true; | 296 return true; |
297 | 297 |
298 return isLoadingMainResource() || !m_resourceLoaders.isEmpty(); | 298 return isLoadingMainResource() || !m_resourceLoaders.isEmpty(); |
299 } | 299 } |
300 | 300 |
301 void DocumentLoader::notifyFinished(CachedResource* resource) | 301 void DocumentLoader::notifyFinished(CachedResource* resource) |
302 { | 302 { |
303 ASSERT_UNUSED(resource, m_mainResource == resource); | 303 ASSERT_UNUSED(resource, m_mainResource == resource); |
304 ASSERT(m_mainResource); | 304 ASSERT(m_mainResource); |
305 | |
306 RefPtr<DocumentLoader> protect(this); | |
307 | |
308 if (!m_mainResource->errorOccurred() && !m_mainResource->wasCanceled()) { | 305 if (!m_mainResource->errorOccurred() && !m_mainResource->wasCanceled()) { |
309 finishedLoading(m_mainResource->loadFinishTime()); | 306 finishedLoading(m_mainResource->loadFinishTime()); |
310 return; | 307 return; |
311 } | 308 } |
312 | 309 |
313 mainReceivedError(m_mainResource->resourceError()); | 310 mainReceivedError(m_mainResource->resourceError()); |
314 } | 311 } |
315 | 312 |
316 void DocumentLoader::finishedLoading(double finishTime) | 313 void DocumentLoader::finishedLoading(double finishTime) |
317 { | 314 { |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 const KURL& DocumentLoader::unreachableURL() const | 863 const KURL& DocumentLoader::unreachableURL() const |
867 { | 864 { |
868 return m_substituteData.failingURL(); | 865 return m_substituteData.failingURL(); |
869 } | 866 } |
870 | 867 |
871 void DocumentLoader::setDefersLoading(bool defers) | 868 void DocumentLoader::setDefersLoading(bool defers) |
872 { | 869 { |
873 // Multiple frames may be loading the same main resource simultaneously. If
deferral state changes, | 870 // Multiple frames may be loading the same main resource simultaneously. If
deferral state changes, |
874 // each frame's DocumentLoader will try to send a setDefersLoading() to the
same underlying ResourceLoader. Ensure only | 871 // each frame's DocumentLoader will try to send a setDefersLoading() to the
same underlying ResourceLoader. Ensure only |
875 // the "owning" DocumentLoader does so, as setDefersLoading() is not resilie
nt to setting the same value repeatedly. | 872 // the "owning" DocumentLoader does so, as setDefersLoading() is not resilie
nt to setting the same value repeatedly. |
876 if (mainResourceLoader() && mainResourceLoader()->isLoadedBy(m_cachedResourc
eLoader.get())) | 873 if (mainResourceLoader() && mainResourceLoader()->documentLoader() == this) |
877 mainResourceLoader()->setDefersLoading(defers); | 874 mainResourceLoader()->setDefersLoading(defers); |
878 | 875 |
879 setAllDefersLoading(m_resourceLoaders, defers); | 876 setAllDefersLoading(m_resourceLoaders, defers); |
880 } | 877 } |
881 | 878 |
882 void DocumentLoader::stopLoadingSubresources() | 879 void DocumentLoader::stopLoadingSubresources() |
883 { | 880 { |
884 cancelAll(m_resourceLoaders); | 881 cancelAll(m_resourceLoaders); |
885 } | 882 } |
886 | 883 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) | 1065 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) |
1069 { | 1066 { |
1070 m_frame->loader()->stopAllLoaders(); | 1067 m_frame->loader()->stopAllLoaders(); |
1071 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url(
), mimeType(), m_writer ? m_writer->encoding() : "", m_writer ? m_writer->encod
ingWasChosenByUser() : false, true); | 1068 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url(
), mimeType(), m_writer ? m_writer->encoding() : "", m_writer ? m_writer->encod
ingWasChosenByUser() : false, true); |
1072 if (!source.isNull()) | 1069 if (!source.isNull()) |
1073 m_writer->appendReplacingData(source); | 1070 m_writer->appendReplacingData(source); |
1074 endWriting(m_writer.get()); | 1071 endWriting(m_writer.get()); |
1075 } | 1072 } |
1076 | 1073 |
1077 } // namespace WebCore | 1074 } // namespace WebCore |
OLD | NEW |