| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_TILES_DECODED_IMAGE_TRACKER_H_ | |
| 6 #define CC_TILES_DECODED_IMAGE_TRACKER_H_ | |
| 7 | |
| 8 #include <utility> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/bind.h" | |
| 12 #include "cc/base/cc_export.h" | |
| 13 #include "cc/tiles/image_controller.h" | |
| 14 | |
| 15 class SkImage; | |
| 16 | |
| 17 namespace cc { | |
| 18 | |
| 19 // This class is the main interface for the rest of the system to request | |
| 20 // decodes. It is responsible for keeping the decodes locked for a number of | |
| 21 // frames, specified as |kNumFramesToLock| in the implementation file. | |
| 22 // | |
| 23 // Note that it is safe to replace ImageController's cache without doing | |
| 24 // anything special with this class, since it retains only ids to the decode | |
| 25 // requests. When defunct ids are then used to try and unlock the image, they | |
| 26 // are silently ignored. | |
| 27 class CC_EXPORT DecodedImageTracker { | |
| 28 public: | |
| 29 DecodedImageTracker(); | |
| 30 ~DecodedImageTracker(); | |
| 31 | |
| 32 void QueueImageDecode(sk_sp<const SkImage> image, | |
| 33 const base::Closure& callback); | |
| 34 void NotifyFrameFinished(); | |
| 35 | |
| 36 private: | |
| 37 friend class TileManager; | |
| 38 friend class DecodedImageTrackerTest; | |
| 39 | |
| 40 void set_image_controller(ImageController* controller) { | |
| 41 image_controller_ = controller; | |
| 42 } | |
| 43 | |
| 44 void ImageDecodeFinished(const base::Closure& callback, | |
| 45 ImageController::ImageDecodeRequestId id); | |
| 46 | |
| 47 ImageController* image_controller_ = nullptr; | |
| 48 std::vector<std::pair<ImageController::ImageDecodeRequestId, int>> | |
| 49 locked_images_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(DecodedImageTracker); | |
| 52 }; | |
| 53 | |
| 54 } // namespace cc | |
| 55 | |
| 56 #endif // CC_TILES_DECODED_IMAGE_TRACKER_H_ | |
| OLD | NEW |