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

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

Issue 2929493002: Plumb PaintImage for the img.decode instead of SkImage. (Closed)
Patch Set: Created 3 years, 6 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 | « no previous file | 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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "cc/cc_export.h" 12 #include "cc/cc_export.h"
13 #include "cc/tiles/image_controller.h" 13 #include "cc/tiles/image_controller.h"
14 14
15 class SkImage;
16
17 namespace cc { 15 namespace cc {
18 16
19 // This class is the main interface for the rest of the system to request 17 // 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 18 // decodes. It is responsible for keeping the decodes locked for a number of
21 // frames, specified as |kNumFramesToLock| in the implementation file. 19 // frames, specified as |kNumFramesToLock| in the implementation file.
22 // 20 //
23 // Note that it is safe to replace ImageController's cache without doing 21 // 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 22 // 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 23 // requests. When defunct ids are then used to try and unlock the image, they
26 // are silently ignored. 24 // are silently ignored.
27 class CC_EXPORT DecodedImageTracker { 25 class CC_EXPORT DecodedImageTracker {
28 public: 26 public:
29 DecodedImageTracker(); 27 DecodedImageTracker();
30 ~DecodedImageTracker(); 28 ~DecodedImageTracker();
31 29
32 // Request that the given image be decoded. This issues a callback upon 30 // Request that the given image be decoded. This issues a callback upon
33 // completion. The callback takes a bool indicating whether the decode was 31 // completion. The callback takes a bool indicating whether the decode was
34 // successful or not. 32 // successful or not.
35 void QueueImageDecode(sk_sp<const SkImage> image, 33 void QueueImageDecode(const PaintImage& image,
36 const base::Callback<void(bool)>& callback); 34 const base::Callback<void(bool)>& callback);
37 void NotifyFrameFinished(); 35 void NotifyFrameFinished();
38 36
39 private: 37 private:
40 friend class TileManager; 38 friend class TileManager;
41 friend class DecodedImageTrackerTest; 39 friend class DecodedImageTrackerTest;
42 40
43 void set_image_controller(ImageController* controller) { 41 void set_image_controller(ImageController* controller) {
44 image_controller_ = controller; 42 image_controller_ = controller;
45 } 43 }
46 44
47 void ImageDecodeFinished(const base::Callback<void(bool)>& callback, 45 void ImageDecodeFinished(const base::Callback<void(bool)>& callback,
48 ImageController::ImageDecodeRequestId id, 46 ImageController::ImageDecodeRequestId id,
49 ImageController::ImageDecodeResult result); 47 ImageController::ImageDecodeResult result);
50 48
51 ImageController* image_controller_ = nullptr; 49 ImageController* image_controller_ = nullptr;
52 std::vector<std::pair<ImageController::ImageDecodeRequestId, int>> 50 std::vector<std::pair<ImageController::ImageDecodeRequestId, int>>
53 locked_images_; 51 locked_images_;
54 52
55 DISALLOW_COPY_AND_ASSIGN(DecodedImageTracker); 53 DISALLOW_COPY_AND_ASSIGN(DecodedImageTracker);
56 }; 54 };
57 55
58 } // namespace cc 56 } // namespace cc
59 57
60 #endif // CC_TILES_DECODED_IMAGE_TRACKER_H_ 58 #endif // CC_TILES_DECODED_IMAGE_TRACKER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/tiles/decoded_image_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698