Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(498)

Unified Diff: third_party/WebKit/Source/core/loader/ImageLoader.cpp

Issue 1706083002: Split ImageResourceClient into ResourceClient and ImageResourceObserver [1/2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit refine. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 82527934f49c6cd17c63d9a3b45a5eb7c7d32817..43d96f1bca6a319c23352a7f3cb78f492ed7d85d 100644
--- a/third_party/WebKit/Source/core/loader/ImageLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/ImageLoader.cpp
@@ -182,6 +182,7 @@ void ImageLoader::dispose()
if (m_image) {
m_image->removeClient(this);
+ m_image->removeObserver(this);
m_image = nullptr;
}
@@ -226,10 +227,14 @@ void ImageLoader::setImageWithoutConsideringPendingLoadEvent(ImageResource* newI
m_hasPendingErrorEvent = false;
}
m_imageComplete = true;
- if (newImage)
+ if (newImage) {
newImage->addClient(this);
- if (oldImage)
+ newImage->addObserver(this);
+ }
+ if (oldImage) {
oldImage->removeClient(this);
+ oldImage->removeObserver(this);
+ }
}
if (LayoutImageResource* imageResource = layoutImageResource())
@@ -369,11 +374,14 @@ void ImageLoader::doUpdateFromElement(BypassMainWorldBehavior bypassBehavior, Up
updateLayoutObject();
// If newImage exists and is cached, addClient() will result in the load event
// being queued to fire. Ensure this happens after beforeload is dispatched.
- if (newImage)
+ if (newImage) {
newImage->addClient(this);
-
- if (oldImage)
+ newImage->addObserver(this);
+ }
+ if (oldImage) {
oldImage->removeClient(this);
+ oldImage->removeObserver(this);
+ }
}
if (LayoutImageResource* imageResource = layoutImageResource())
@@ -411,8 +419,10 @@ void ImageLoader::updateFromElement(UpdateFromElementBehavior updateBehavior, Re
// an asynchronous load completes.
if (imageSourceURL.isEmpty()) {
ImageResource* image = m_image.get();
- if (image)
+ if (image) {
image->removeClient(this);
+ image->removeObserver(this);
+ }
m_image = nullptr;
}
@@ -607,7 +617,7 @@ void ImageLoader::dispatchPendingErrorEvent()
updatedHasPendingEvent();
}
-bool ImageLoader::getImageAnimationPolicy(ImageResource*, ImageAnimationPolicy& policy)
+bool ImageLoader::getImageAnimationPolicy(ImageAnimationPolicy& policy)
{
if (!element()->document().settings())
return false;

Powered by Google App Engine
This is Rietveld 408576698