Changeset 181849 in webkit
- Timestamp:
- Mar 23, 2015 2:14:19 AM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r181845 r181849 1 2015-03-23 Yoav Weiss <yoav@yoav.ws> 2 3 Refactor ImageLoader's setting of CachedImage 4 https://bugs.webkit.org/show_bug.cgi?id=142825 5 6 Reviewed by Chris Dumez. 7 8 No new tests, since there's no functional change. 9 10 setImage and setImageWithoutConsideringPendingLoadEvent were not called with new 11 CachedImages and were not used as originally intended. That resulted in some dead code, 12 and confusion when going over the code. 13 This patch renames these methods into equivalent clearImage* methods, and deletes resulting dead code. 14 15 * html/HTMLObjectElement.cpp: 16 (WebCore::HTMLObjectElement::renderFallbackContent): Changed setImage call to clearImage. 17 * loader/ImageLoader.cpp: 18 (WebCore::ImageLoader::clearImage): 19 (WebCore::ImageLoader::clearImageWithoutConsideringPendingLoadEvent): 20 (WebCore::ImageLoader::notifyFinished): 21 (WebCore::ImageLoader::elementDidMoveToNewDocument): 22 (WebCore::ImageLoader::setImage): Deleted. 23 (WebCore::ImageLoader::setImageWithoutConsideringPendingLoadEvent): Deleted. 24 * loader/ImageLoader.h: 25 1 26 2015-03-22 Benjamin Poulain <benjamin@webkit.org> 2 27 -
trunk/Source/WebCore/html/HTMLObjectElement.cpp
r181507 r181849 383 383 if (!isImageType()) { 384 384 // If we don't think we have an image type anymore, then clear the image from the loader. 385 loader-> setImage(nullptr);385 loader->clearImage(); 386 386 return; 387 387 } -
trunk/Source/WebCore/loader/ImageLoader.cpp
r181412 r181849 124 124 } 125 125 126 void ImageLoader:: setImage(CachedImage* newImage)127 { 128 setImageWithoutConsideringPendingLoadEvent(newImage);126 void ImageLoader::clearImage() 127 { 128 clearImageWithoutConsideringPendingLoadEvent(); 129 129 130 130 // Only consider updating the protection ref-count of the Element immediately before returning … … 133 133 } 134 134 135 void ImageLoader:: setImageWithoutConsideringPendingLoadEvent(CachedImage* newImage)135 void ImageLoader::clearImageWithoutConsideringPendingLoadEvent() 136 136 { 137 137 ASSERT(m_failedLoadURL.isEmpty()); 138 138 CachedImage* oldImage = m_image.get(); 139 if ( newImage !=oldImage) {140 m_image = n ewImage;139 if (oldImage) { 140 m_image = nullptr; 141 141 if (m_hasPendingBeforeLoadEvent) { 142 142 beforeLoadEventSender().cancelEvent(*this); … … 152 152 } 153 153 m_imageComplete = true; 154 if (newImage)155 newImage->addClient(this);156 154 if (oldImage) 157 155 oldImage->removeClient(this); … … 289 287 && !resource->passesAccessControlCheck(element().document().securityOrigin())) { 290 288 291 setImageWithoutConsideringPendingLoadEvent(0);289 clearImageWithoutConsideringPendingLoadEvent(); 292 290 293 291 m_hasPendingErrorEvent = true; … … 467 465 { 468 466 clearFailedLoadURL(); 469 setImage(0);467 clearImage(); 470 468 } 471 469 -
trunk/Source/WebCore/loader/ImageLoader.h
r181412 r181849 59 59 60 60 CachedImage* image() const { return m_image.get(); } 61 void setImage(CachedImage*); // Cancels pending beforeload and load events, and doesn't dispatch new ones.61 void clearImage(); // Cancels pending beforeload and load events, and doesn't dispatch new ones. 62 62 63 63 void setLoadManually(bool loadManually) { m_loadManually = loadManually; } … … 89 89 void updateRenderer(); 90 90 91 void setImageWithoutConsideringPendingLoadEvent(CachedImage*);91 void clearImageWithoutConsideringPendingLoadEvent(); 92 92 void clearFailedLoadURL(); 93 93
Note: See TracChangeset
for help on using the changeset viewer.