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

Unified Diff: cc/paint/paint_image.h

Issue 2873003002: Add stable id to PaintImage. (Closed)
Patch Set: rebase Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/paint/discardable_image_store.cc ('k') | cc/paint/paint_image.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/paint/paint_image.h
diff --git a/cc/paint/paint_image.h b/cc/paint/paint_image.h
index a79bcf02ca3e71085c7cfc57084eb186a3d84443..5aec3cfcdf21402c7813de51a8227295c5465ee1 100644
--- a/cc/paint/paint_image.h
+++ b/cc/paint/paint_image.h
@@ -14,14 +14,24 @@ namespace cc {
// TODO(vmpstr): Add a persistent id to the paint image.
class CC_PAINT_EXPORT PaintImage {
public:
+ using Id = int;
+
+ // An id that can be used for all non-lazy images. Note that if an image is
+ // not lazy, it does not mean that this id must be used; one can still use
+ // GetNextId to generate a stable id for such images.
+ static const Id kNonLazyStableId = -1;
+
// TODO(vmpstr): Work towards removing "UNKNOWN" value.
enum class AnimationType { UNKNOWN, ANIMATED, VIDEO, STATIC };
// TODO(vmpstr): Work towards removing "UNKNOWN" value.
enum class CompletionState { UNKNOWN, DONE, PARTIALLY_DONE };
+ static Id GetNextId();
+
PaintImage();
- explicit PaintImage(sk_sp<SkImage> sk_image,
+ explicit PaintImage(Id id,
+ sk_sp<SkImage> sk_image,
AnimationType animation_type = AnimationType::STATIC,
CompletionState completion_state = CompletionState::DONE);
PaintImage(const PaintImage& other);
@@ -34,11 +44,13 @@ class CC_PAINT_EXPORT PaintImage {
bool operator==(const PaintImage& other);
explicit operator bool() const { return sk_image_; }
+ Id stable_id() const { return id_; }
const sk_sp<SkImage>& sk_image() const { return sk_image_; }
AnimationType animation_type() const { return animation_type_; }
CompletionState completion_state() const { return completion_state_; }
private:
+ Id id_ = kNonLazyStableId;
sk_sp<SkImage> sk_image_;
AnimationType animation_type_ = AnimationType::UNKNOWN;
CompletionState completion_state_ = CompletionState::UNKNOWN;
« no previous file with comments | « cc/paint/discardable_image_store.cc ('k') | cc/paint/paint_image.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698