Index: chrome/browser/image_decoder.cc |
diff --git a/chrome/browser/image_decoder.cc b/chrome/browser/image_decoder.cc |
index cb758e585e3403b2876e324ca7a562ea54ff5188..df7ac96cc24935def04b98f14033c336e570ae0e 100644 |
--- a/chrome/browser/image_decoder.cc |
+++ b/chrome/browser/image_decoder.cc |
@@ -172,14 +172,19 @@ void ImageDecoder::StartBatchMode() { |
void ImageDecoder::StopBatchMode() { |
DCHECK_CURRENTLY_ON(BrowserThread::IO); |
+ { |
+ // Check for outstanding requests and wait for them to finish. |
+ base::AutoLock lock(map_lock_); |
+ if (!image_request_id_map_.empty()) { |
+ batch_mode_timer_->Reset(); |
+ return; |
+ } |
+ } |
+ |
if (utility_process_host_) { |
utility_process_host_->EndBatchMode(); |
utility_process_host_.reset(); |
} |
- |
- // There could be outstanding request that are taking too long. Fail these so |
- // that there aren't any dangling requests. |
- FailAllRequests(); |
} |
void ImageDecoder::FailAllRequests() { |