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 #ifndef CHROME_BROWSER_IMAGE_DECODER_H_ | 5 #ifndef CHROME_BROWSER_IMAGE_DECODER_H_ |
6 #define CHROME_BROWSER_IMAGE_DECODER_H_ | 6 #define CHROME_BROWSER_IMAGE_DECODER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 virtual ~ImageRequest(); | 51 virtual ~ImageRequest(); |
52 | 52 |
53 private: | 53 private: |
54 // The thread to post OnImageDecoded or OnDecodeImageFailed once the | 54 // The thread to post OnImageDecoded or OnDecodeImageFailed once the |
55 // the image has been decoded. | 55 // the image has been decoded. |
56 const scoped_refptr<base::SequencedTaskRunner> task_runner_; | 56 const scoped_refptr<base::SequencedTaskRunner> task_runner_; |
57 }; | 57 }; |
58 | 58 |
59 enum ImageCodec { | 59 enum ImageCodec { |
60 DEFAULT_CODEC = 0, // Uses WebKit image decoding (via WebImage). | 60 DEFAULT_CODEC = 0, // Uses WebKit image decoding (via WebImage). |
61 #if defined(OS_CHROMEOS) | |
61 ROBUST_JPEG_CODEC, // Restrict decoding to robust jpeg codec. | 62 ROBUST_JPEG_CODEC, // Restrict decoding to robust jpeg codec. |
sky
2015/05/06 21:44:27
Could we (separately) get a more descriptive name
Ed Baker
2015/05/07 00:31:41
Acknowledged.
| |
63 #endif // defined(OS_CHROMEOS) | |
62 }; | 64 }; |
63 | 65 |
64 // Calls StartWithOptions with ImageCodec::DEFAULT_CODEC and | 66 // Calls StartWithOptions with ImageCodec::DEFAULT_CODEC and |
65 // shrink_to_fit = false. | 67 // shrink_to_fit = false. |
66 static void Start(ImageRequest* image_request, | 68 static void Start(ImageRequest* image_request, |
67 const std::string& image_data); | 69 const std::string& image_data); |
68 | 70 |
69 // Starts asynchronous image decoding. Once finished, the callback will be | 71 // Starts asynchronous image decoding. Once finished, the callback will be |
70 // posted back to image_request's |task_runner_|. | 72 // posted back to image_request's |task_runner_|. |
71 static void StartWithOptions(ImageRequest* image_request, | 73 static void StartWithOptions(ImageRequest* image_request, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 // Calls StopBatchMode after kBatchModeTimeoutSeconds have elapsed. | 129 // Calls StopBatchMode after kBatchModeTimeoutSeconds have elapsed. |
128 base::RepeatingTimer<ImageDecoder> batch_mode_timer_; | 130 base::RepeatingTimer<ImageDecoder> batch_mode_timer_; |
129 | 131 |
130 // The time Start was last called. | 132 // The time Start was last called. |
131 base::TimeTicks last_request_; | 133 base::TimeTicks last_request_; |
132 | 134 |
133 DISALLOW_COPY_AND_ASSIGN(ImageDecoder); | 135 DISALLOW_COPY_AND_ASSIGN(ImageDecoder); |
134 }; | 136 }; |
135 | 137 |
136 #endif // CHROME_BROWSER_IMAGE_DECODER_H_ | 138 #endif // CHROME_BROWSER_IMAGE_DECODER_H_ |
OLD | NEW |