From ee4c86d1990a9e26277a6948e7027ad8d525ebfa Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 18 Oct 2012 10:55:06 +0200 Subject: Imported WebKit commit 795dcd25a9649fccaf1c9b685f6e2ffedaf7e620 (http://svn.webkit.org/repository/webkit/trunk@131718) New snapshot that includes the return of -fkeep-memory at link time to reduce memory pressure as well as modularized documentation --- Source/WebCore/loader/ImageLoader.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'Source/WebCore/loader/ImageLoader.cpp') diff --git a/Source/WebCore/loader/ImageLoader.cpp b/Source/WebCore/loader/ImageLoader.cpp index 0523b3a89..a6da61e65 100644 --- a/Source/WebCore/loader/ImageLoader.cpp +++ b/Source/WebCore/loader/ImageLoader.cpp @@ -129,7 +129,7 @@ void ImageLoader::setImage(CachedImage* newImage) // Only consider updating the protection ref-count of the Element immediately before returning // from this function as doing so might result in the destruction of this ImageLoader. - updatedHasPendingLoadEvent(); + updatedHasPendingEvent(); } void ImageLoader::setImageWithoutConsideringPendingLoadEvent(CachedImage* newImage) @@ -248,7 +248,7 @@ void ImageLoader::updateFromElement() // Only consider updating the protection ref-count of the Element immediately before returning // from this function as doing so might result in the destruction of this ImageLoader. - updatedHasPendingLoadEvent(); + updatedHasPendingEvent(); } void ImageLoader::updateFromElementIgnoringPreviousError() @@ -286,7 +286,7 @@ void ImageLoader::notifyFinished(CachedResource* resource) // Only consider updating the protection ref-count of the Element immediately before returning // from this function as doing so might result in the destruction of this ImageLoader. - updatedHasPendingLoadEvent(); + updatedHasPendingEvent(); return; } @@ -294,7 +294,7 @@ void ImageLoader::notifyFinished(CachedResource* resource) m_hasPendingLoadEvent = false; // Only consider updating the protection ref-count of the Element immediately before returning // from this function as doing so might result in the destruction of this ImageLoader. - updatedHasPendingLoadEvent(); + updatedHasPendingEvent(); return; } @@ -341,18 +341,17 @@ void ImageLoader::updateRenderer() imageResource->setCachedImage(m_image.get()); } -void ImageLoader::updatedHasPendingLoadEvent() +void ImageLoader::updatedHasPendingEvent() { - // If an Element that does image loading is removed from the DOM the load event for the image is still observable. + // If an Element that does image loading is removed from the DOM the load/error event for the image is still observable. // As long as the ImageLoader is actively loading, the Element itself needs to be ref'ed to keep it from being // destroyed by DOM manipulation or garbage collection. // If such an Element wishes for the load to stop when removed from the DOM it needs to stop the ImageLoader explicitly. - - if (m_hasPendingLoadEvent == m_elementIsProtected) + bool wasProtected = m_elementIsProtected; + m_elementIsProtected = m_hasPendingLoadEvent || m_hasPendingErrorEvent; + if (wasProtected == m_elementIsProtected) return; - m_elementIsProtected = m_hasPendingLoadEvent; - if (m_elementIsProtected) client()->refSourceElement(); else @@ -397,7 +396,7 @@ void ImageLoader::dispatchPendingBeforeLoadEvent() // Only consider updating the protection ref-count of the Element immediately before returning // from this function as doing so might result in the destruction of this ImageLoader. - updatedHasPendingLoadEvent(); + updatedHasPendingEvent(); } void ImageLoader::dispatchPendingLoadEvent() @@ -413,7 +412,7 @@ void ImageLoader::dispatchPendingLoadEvent() // Only consider updating the protection ref-count of the Element immediately before returning // from this function as doing so might result in the destruction of this ImageLoader. - updatedHasPendingLoadEvent(); + updatedHasPendingEvent(); } void ImageLoader::dispatchPendingErrorEvent() -- cgit v1.2.1