Chromium Code Reviews| Index: chrome/browser/image_decoder.h |
| diff --git a/chrome/browser/image_decoder.h b/chrome/browser/image_decoder.h |
| index 438622c442d48a9b2bc5b125b11a8d299faccbd1..8f1d94d7838abd788b28c2d37c6fc8bd028d2f81 100644 |
| --- a/chrome/browser/image_decoder.h |
| +++ b/chrome/browser/image_decoder.h |
| @@ -75,9 +75,13 @@ class ImageDecoder : public content::UtilityProcessHostClient { |
| // Removes all instances of image_request from |image_request_id_map_|, |
| // ensuring callbacks are not made to the image_request after it is destroyed. |
| + // May be called from any thread. |
| + // NOTE: This may block if called from a different thread than the |
| + // ImageRequest's rask runner. |
|
Lei Zhang
2015/04/08 01:30:10
typo
Anand Mistry (off Chromium)
2015/04/08 03:13:46
Done.
|
| static void Cancel(ImageRequest* image_request); |
| private: |
| + class Job; |
| friend struct base::DefaultLazyInstanceTraits<ImageDecoder>; |
| ImageDecoder(); |
| @@ -87,14 +91,18 @@ class ImageDecoder : public content::UtilityProcessHostClient { |
| // Sends a request to the sandboxed process to decode the image. Starts |
| // batch mode if necessary. If the utility process fails to start, |
| // an OnDecodeImageFailed task is posted to image_request's |task_runner_|. |
| - void DecodeImageInSandbox(ImageRequest* image_request, |
| + void DecodeImageInSandbox(int request_id, |
| const std::vector<unsigned char>& image_data, |
| ImageCodec image_codec, |
| bool shrink_to_fit); |
| + void StartWithOptionsImpl(ImageRequest* image_request, |
| + const std::string& image_data, |
| + ImageCodec image_codec, |
| + bool shrink_to_fit); |
| void CancelImpl(ImageRequest* image_request); |
| - using RequestMap = std::map<int, ImageRequest*>; |
| + using RequestMap = std::map<int, scoped_refptr<Job>>; |
| // Starts UtilityProcessHost in batch mode and starts |batch_mode_timer_|. |
| // If the utility process fails to start, the method resets |
| @@ -112,6 +120,9 @@ class ImageDecoder : public content::UtilityProcessHostClient { |
| void OnDecodeImageSucceeded(const SkBitmap& decoded_image, int request_id); |
| void OnDecodeImageFailed(int request_id); |
| + // Removes the job from the map of requests. |
| + void RemoveJob(const scoped_refptr<Job>& job); |
| + |
| // id to use for the next Start request that comes in. |
| int image_request_id_counter_; |