OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/image_decoder.h" | 5 #include "chrome/browser/image_decoder.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 ImageRequest* image_request; | 202 ImageRequest* image_request; |
203 { | 203 { |
204 base::AutoLock lock(map_lock_); | 204 base::AutoLock lock(map_lock_); |
205 auto it = image_request_id_map_.find(request_id); | 205 auto it = image_request_id_map_.find(request_id); |
206 if (it == image_request_id_map_.end()) | 206 if (it == image_request_id_map_.end()) |
207 return; | 207 return; |
208 image_request = it->second; | 208 image_request = it->second; |
209 image_request_id_map_.erase(it); | 209 image_request_id_map_.erase(it); |
210 } | 210 } |
211 | 211 |
212 DCHECK(image_request->task_runner()->RunsTasksOnCurrentThread()); | 212 DCHECK(image_request->task_runner()->RunsTasksInCurrentSequence()); |
213 image_request->OnImageDecoded(decoded_image); | 213 image_request->OnImageDecoded(decoded_image); |
214 } | 214 } |
215 | 215 |
216 void ImageDecoder::OnDecodeImageFailed(int request_id) { | 216 void ImageDecoder::OnDecodeImageFailed(int request_id) { |
217 ImageRequest* image_request; | 217 ImageRequest* image_request; |
218 { | 218 { |
219 base::AutoLock lock(map_lock_); | 219 base::AutoLock lock(map_lock_); |
220 auto it = image_request_id_map_.find(request_id); | 220 auto it = image_request_id_map_.find(request_id); |
221 if (it == image_request_id_map_.end()) | 221 if (it == image_request_id_map_.end()) |
222 return; | 222 return; |
223 image_request = it->second; | 223 image_request = it->second; |
224 image_request_id_map_.erase(it); | 224 image_request_id_map_.erase(it); |
225 } | 225 } |
226 | 226 |
227 DCHECK(image_request->task_runner()->RunsTasksOnCurrentThread()); | 227 DCHECK(image_request->task_runner()->RunsTasksInCurrentSequence()); |
228 image_request->OnDecodeImageFailed(); | 228 image_request->OnDecodeImageFailed(); |
229 } | 229 } |
OLD | NEW |