| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ | 5 #ifndef CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ |
| 6 #define CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ | 6 #define CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 // Get the decoded draw image for the given key and draw_image. Note that this | 204 // Get the decoded draw image for the given key and draw_image. Note that this |
| 205 // function has to be called with no lock acquired, since it will acquire its | 205 // function has to be called with no lock acquired, since it will acquire its |
| 206 // own locks and might call DecodeImageInternal above. Also note that this | 206 // own locks and might call DecodeImageInternal above. Also note that this |
| 207 // function will use the provided key, even if | 207 // function will use the provided key, even if |
| 208 // ImageKey::FromDrawImage(draw_image) would return a different key. | 208 // ImageKey::FromDrawImage(draw_image) would return a different key. |
| 209 // Note that when used internally, we still require that | 209 // Note that when used internally, we still require that |
| 210 // DrawWithImageFinished() is called afterwards. | 210 // DrawWithImageFinished() is called afterwards. |
| 211 DecodedDrawImage GetDecodedImageForDrawInternal(const ImageKey& key, | 211 DecodedDrawImage GetDecodedImageForDrawInternal(const ImageKey& key, |
| 212 const DrawImage& draw_image); | 212 const DrawImage& draw_image); |
| 213 | 213 |
| 214 // GetOriginalImageDecode is called by DecodeImageInternal when the quality |
| 215 // does not scale the image. Like DecodeImageInternal, it should be called |
| 216 // with no lock acquired and it returns nullptr if the decoding failed. |
| 217 std::unique_ptr<DecodedImage> GetOriginalImageDecode(const ImageKey& key, |
| 218 const SkImage& image); |
| 219 |
| 220 // GetScaledImageDecode is called by DecodeImageInternal when the quality |
| 221 // requires the image be scaled. Like DecodeImageInternal, it should be |
| 222 // called with no lock acquired and it returns nullptr if the decoding or |
| 223 // scaling failed. |
| 224 std::unique_ptr<DecodedImage> GetScaledImageDecode(const ImageKey& key, |
| 225 const SkImage& image); |
| 226 |
| 214 void SanityCheckState(int line, bool lock_acquired); | 227 void SanityCheckState(int line, bool lock_acquired); |
| 215 void RefImage(const ImageKey& key); | 228 void RefImage(const ImageKey& key); |
| 216 void RefAtRasterImage(const ImageKey& key); | 229 void RefAtRasterImage(const ImageKey& key); |
| 217 void UnrefAtRasterImage(const ImageKey& key); | 230 void UnrefAtRasterImage(const ImageKey& key); |
| 218 | 231 |
| 219 // These functions indicate whether the images can be handled and cached by | 232 // These functions indicate whether the images can be handled and cached by |
| 220 // ImageDecodeController or whether they will fall through to Skia (with | 233 // ImageDecodeController or whether they will fall through to Skia (with |
| 221 // exception of possibly prerolling them). Over time these should return | 234 // exception of possibly prerolling them). Over time these should return |
| 222 // "false" in less cases, as the ImageDecodeController should start handling | 235 // "false" in less cases, as the ImageDecodeController should start handling |
| 223 // more of them. | 236 // more of them. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 253 | 266 |
| 254 ResourceFormat format_; | 267 ResourceFormat format_; |
| 255 | 268 |
| 256 // Used to uniquely identify DecodedImages for memory traces. | 269 // Used to uniquely identify DecodedImages for memory traces. |
| 257 base::AtomicSequenceNumber next_tracing_id_; | 270 base::AtomicSequenceNumber next_tracing_id_; |
| 258 }; | 271 }; |
| 259 | 272 |
| 260 } // namespace cc | 273 } // namespace cc |
| 261 | 274 |
| 262 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ | 275 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ |
| OLD | NEW |