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

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: remove freeze 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
« no previous file with comments | « no previous file | chrome/browser/image_decoder_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/image_decoder.cc
diff --git a/chrome/browser/image_decoder.cc b/chrome/browser/image_decoder.cc
index a596bc57d4791e2720a3d7a948c6211ecfbe66b5..7d26e8053b1041e221efa4b2f7a865b535a22215 100644
--- a/chrome/browser/image_decoder.cc
+++ b/chrome/browser/image_decoder.cc
@@ -174,14 +174,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698