Chromium Code Reviews| Index: cc/tiles/image_controller.cc |
| diff --git a/cc/tiles/image_controller.cc b/cc/tiles/image_controller.cc |
| index f0d1bb9666c9cde5de93e7879041193d1e74851f..235a3595a05f5b98e1b3c0c08eb274cf6ef58ff4 100644 |
| --- a/cc/tiles/image_controller.cc |
| +++ b/cc/tiles/image_controller.cc |
| @@ -77,9 +77,10 @@ void ImageController::StopWorkerTasks() { |
| ImageDecodeRequestId id = request_to_complete.first; |
| ImageDecodeRequest& request = request_to_complete.second; |
| - // The task (if one exists) would have run already, so we just need to |
| - // complete it. |
| - if (request.task) |
| + // The task (if one exists) would have run already, we just need to make |
| + // sure it was completed. Multiple requests for the same image use the same |
| + // task so it could have already been completed. |
| + if (request.task && !request.task->HasCompleted()) |
| request.task->DidComplete(); |
| // Issue the callback, and unref the image immediately. This is so that any |
| @@ -106,7 +107,9 @@ void ImageController::StopWorkerTasks() { |
| // several different image deque requests for the same image. |
| if (request.task->state().IsNew()) |
| request.task->state().DidCancel(); |
| - request.task->DidComplete(); |
| + |
| + if (!request.task->HasCompleted()) |
| + request.task->DidComplete(); |
| } |
| // Run the callback and unref the image. |
| request.callback.Run(id); |
| @@ -120,7 +123,10 @@ void ImageController::SetImageDecodeCache(ImageDecodeCache* cache) { |
| SetPredecodeImages(std::vector<DrawImage>(), |
| ImageDecodeCache::TracingInfo()); |
| StopWorkerTasks(); |
| + } else if (cache_ && cache_ != cache) { |
|
vmpstr
2017/02/17 21:15:13
Don't do this... We specifically talked about it a
Khushal
2017/02/17 21:17:35
Should I add a DCHECK for that then? Makes it obvi
vmpstr
2017/02/17 21:22:09
Yeah I'm not sure why we don't have a DCHECK, ther
|
| + StopWorkerTasks(); |
| } |
| + |
| cache_ = cache; |
| } |