Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: cc/tiles/decoded_image_tracker.h

Issue 2703633004: cc: Make image controller return a status with the callback. (Closed)
Patch Set: update Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/tiles/checker_image_tracker_unittest.cc ('k') | cc/tiles/decoded_image_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_DECODED_IMAGE_TRACKER_H_ 5 #ifndef CC_TILES_DECODED_IMAGE_TRACKER_H_
6 #define CC_TILES_DECODED_IMAGE_TRACKER_H_ 6 #define CC_TILES_DECODED_IMAGE_TRACKER_H_
7 7
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 11 matching lines...) Expand all
22 // 22 //
23 // Note that it is safe to replace ImageController's cache without doing 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 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 25 // requests. When defunct ids are then used to try and unlock the image, they
26 // are silently ignored. 26 // are silently ignored.
27 class CC_EXPORT DecodedImageTracker { 27 class CC_EXPORT DecodedImageTracker {
28 public: 28 public:
29 DecodedImageTracker(); 29 DecodedImageTracker();
30 ~DecodedImageTracker(); 30 ~DecodedImageTracker();
31 31
32 // Request that the given image be decoded. This issues a callback upon
33 // completion. The callback takes a bool indicating whether the decode was
34 // successful or not.
32 void QueueImageDecode(sk_sp<const SkImage> image, 35 void QueueImageDecode(sk_sp<const SkImage> image,
33 const base::Closure& callback); 36 const base::Callback<void(bool)>& callback);
34 void NotifyFrameFinished(); 37 void NotifyFrameFinished();
35 38
36 private: 39 private:
37 friend class TileManager; 40 friend class TileManager;
38 friend class DecodedImageTrackerTest; 41 friend class DecodedImageTrackerTest;
39 42
40 void set_image_controller(ImageController* controller) { 43 void set_image_controller(ImageController* controller) {
41 image_controller_ = controller; 44 image_controller_ = controller;
42 } 45 }
43 46
44 void ImageDecodeFinished(const base::Closure& callback, 47 void ImageDecodeFinished(const base::Callback<void(bool)>& callback,
45 ImageController::ImageDecodeRequestId id); 48 ImageController::ImageDecodeRequestId id,
49 ImageController::ImageDecodeResult result);
46 50
47 ImageController* image_controller_ = nullptr; 51 ImageController* image_controller_ = nullptr;
48 std::vector<std::pair<ImageController::ImageDecodeRequestId, int>> 52 std::vector<std::pair<ImageController::ImageDecodeRequestId, int>>
49 locked_images_; 53 locked_images_;
50 54
51 DISALLOW_COPY_AND_ASSIGN(DecodedImageTracker); 55 DISALLOW_COPY_AND_ASSIGN(DecodedImageTracker);
52 }; 56 };
53 57
54 } // namespace cc 58 } // namespace cc
55 59
56 #endif // CC_TILES_DECODED_IMAGE_TRACKER_H_ 60 #endif // CC_TILES_DECODED_IMAGE_TRACKER_H_
OLDNEW
« no previous file with comments | « cc/tiles/checker_image_tracker_unittest.cc ('k') | cc/tiles/decoded_image_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698