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

Unified Diff: chrome/browser/image_decoder.cc

Issue 1129653002: Wait for pending requests to finish in ImageDecoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix kill test. Created 5 years, 7 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: 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() {
« no previous file with comments | « no previous file | chrome/browser/image_decoder_browsertest.cc » ('j') | chrome/browser/image_decoder_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698