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

Unified Diff: third_party/WebKit/Source/core/layout/ImageQualityController.cpp

Issue 1909063003: ImageQualityController should not post hundreds of canceled tasks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/ImageQualityController.cpp
diff --git a/third_party/WebKit/Source/core/layout/ImageQualityController.cpp b/third_party/WebKit/Source/core/layout/ImageQualityController.cpp
index c9ef4c3fb973653d65d7e64b3b328bafb1085180..9b4923996e82540fab0e2df2ff72370a019a2b89 100644
--- a/third_party/WebKit/Source/core/layout/ImageQualityController.cpp
+++ b/third_party/WebKit/Source/core/layout/ImageQualityController.cpp
@@ -142,7 +142,12 @@ void ImageQualityController::highQualityRepaintTimerFired(Timer<ImageQualityCont
void ImageQualityController::restartTimer()
{
- m_timer->startOneShot(cLowQualityTimeThreshold, BLINK_FROM_HERE);
+ // Avoid reposting the timer if it's already active. While it does cancel
chrishtr 2016/04/21 20:30:59 restartTimer() is called in order to push the 500m
+ // the previous one, the MessageLoop does not actually support cancelation
+ // which means on a page with hundreds of images we end up processing
+ // hundreds of cancelled tasks.
+ if (!m_timer->isActive())
+ m_timer->startOneShot(cLowQualityTimeThreshold, BLINK_FROM_HERE);
}
bool ImageQualityController::shouldPaintAtLowQuality(const LayoutObject& object, Image* image, const void *layer, const LayoutSize& layoutSize)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698