Chromium Code Reviews| 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) |