| Index: third_party/WebKit/Source/core/loader/ImageLoader.cpp
|
| diff --git a/third_party/WebKit/Source/core/loader/ImageLoader.cpp b/third_party/WebKit/Source/core/loader/ImageLoader.cpp
|
| index 8bc2bb5869f72a265c6d8ec119e5830984e57ee2..173390c048234a4bc1438f132617d7e62cea8a7b 100644
|
| --- a/third_party/WebKit/Source/core/loader/ImageLoader.cpp
|
| +++ b/third_party/WebKit/Source/core/loader/ImageLoader.cpp
|
| @@ -147,12 +147,10 @@ private:
|
|
|
| ImageLoader::ImageLoader(Element* element)
|
| : m_element(element)
|
| - , m_derefElementTimer(this, &ImageLoader::timerFired)
|
| , m_hasPendingLoadEvent(false)
|
| , m_hasPendingErrorEvent(false)
|
| , m_imageComplete(true)
|
| , m_loadingImageDocument(false)
|
| - , m_elementIsProtected(false)
|
| , m_suppressErrorEvents(false)
|
| {
|
| RESOURCE_LOADING_DVLOG(1) << "new ImageLoader " << this;
|
| @@ -184,10 +182,6 @@ DEFINE_TRACE(ImageLoader)
|
| void ImageLoader::setImage(ImageResource* newImage)
|
| {
|
| setImageWithoutConsideringPendingLoadEvent(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.
|
| - updatedHasPendingEvent();
|
| }
|
|
|
| void ImageLoader::setImageWithoutConsideringPendingLoadEvent(ImageResource* newImage)
|
| @@ -343,10 +337,6 @@ void ImageLoader::doUpdateFromElement(BypassMainWorldBehavior bypassBehavior, Up
|
|
|
| if (LayoutImageResource* imageResource = layoutImageResource())
|
| imageResource->resetAnimation();
|
| -
|
| - // 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.
|
| - updatedHasPendingEvent();
|
| }
|
|
|
| void ImageLoader::updateFromElement(UpdateFromElementBehavior updateBehavior, ReferrerPolicy referrerPolicy)
|
| @@ -466,16 +456,10 @@ void ImageLoader::imageNotifyFinished(ImageResource* resource)
|
| if (!m_suppressErrorEvents)
|
| dispatchErrorEvent();
|
|
|
| - // 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.
|
| - updatedHasPendingEvent();
|
| return;
|
| }
|
| if (resource->wasCanceled()) {
|
| 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.
|
| - updatedHasPendingEvent();
|
| return;
|
| }
|
| loadEventSender().dispatchEventSoon(this);
|
| @@ -517,33 +501,6 @@ void ImageLoader::updateLayoutObject()
|
| imageResource->setImageResource(m_image.get());
|
| }
|
|
|
| -void ImageLoader::updatedHasPendingEvent()
|
| -{
|
| - // 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.
|
| - bool wasProtected = m_elementIsProtected;
|
| - m_elementIsProtected = m_hasPendingLoadEvent || m_hasPendingErrorEvent;
|
| - if (wasProtected == m_elementIsProtected)
|
| - return;
|
| -
|
| - if (m_elementIsProtected) {
|
| - if (m_derefElementTimer.isActive())
|
| - m_derefElementTimer.stop();
|
| - else
|
| - m_keepAlive = m_element;
|
| - } else {
|
| - ASSERT(!m_derefElementTimer.isActive());
|
| - m_derefElementTimer.startOneShot(0, BLINK_FROM_HERE);
|
| - }
|
| -}
|
| -
|
| -void ImageLoader::timerFired(TimerBase*)
|
| -{
|
| - m_keepAlive.clear();
|
| -}
|
| -
|
| void ImageLoader::dispatchPendingEvent(ImageEventSender* eventSender)
|
| {
|
| RESOURCE_LOADING_DVLOG(1) << "ImageLoader::dispatchPendingEvent " << this;
|
| @@ -564,10 +521,6 @@ void ImageLoader::dispatchPendingLoadEvent()
|
| m_hasPendingLoadEvent = false;
|
| if (element()->document().frame())
|
| dispatchLoadEvent();
|
| -
|
| - // 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.
|
| - updatedHasPendingEvent();
|
| }
|
|
|
| void ImageLoader::dispatchPendingErrorEvent()
|
| @@ -578,10 +531,6 @@ void ImageLoader::dispatchPendingErrorEvent()
|
|
|
| if (element()->document().frame())
|
| element()->dispatchEvent(Event::create(EventTypeNames::error));
|
| -
|
| - // 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.
|
| - updatedHasPendingEvent();
|
| }
|
|
|
| bool ImageLoader::getImageAnimationPolicy(ImageAnimationPolicy& policy)
|
|
|