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

Side by Side Diff: cc/paint/paint_image.h

Issue 2880813002: Revert of Add stable id to PaintImage. (Closed)
Patch Set: 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_PAINT_PAINT_IMAGE_H_ 5 #ifndef CC_PAINT_PAINT_IMAGE_H_
6 #define CC_PAINT_PAINT_IMAGE_H_ 6 #define CC_PAINT_PAINT_IMAGE_H_
7 7
8 #include "base/atomic_sequence_num.h"
9 #include "base/logging.h" 8 #include "base/logging.h"
10 #include "cc/paint/paint_export.h" 9 #include "cc/paint/paint_export.h"
11 #include "third_party/skia/include/core/SkImage.h" 10 #include "third_party/skia/include/core/SkImage.h"
12 11
13 namespace cc { 12 namespace cc {
14 13
15 // TODO(vmpstr): Add a persistent id to the paint image. 14 // TODO(vmpstr): Add a persistent id to the paint image.
16 class CC_PAINT_EXPORT PaintImage { 15 class CC_PAINT_EXPORT PaintImage {
17 public: 16 public:
18 using Id = int;
19
20 // An id that can be used for all non-lazy images. Note that if an image is
21 // not lazy, it does not mean that this id must be used; one can still use
22 // GetNextId to generate a stable id for such images.
23 static const Id kNonLazyStableId = -1;
24
25 // TODO(vmpstr): Work towards removing "UNKNOWN" value. 17 // TODO(vmpstr): Work towards removing "UNKNOWN" value.
26 enum class AnimationType { UNKNOWN, ANIMATED, VIDEO, STATIC }; 18 enum class AnimationType { UNKNOWN, ANIMATED, VIDEO, STATIC };
27 19
28 // TODO(vmpstr): Work towards removing "UNKNOWN" value. 20 // TODO(vmpstr): Work towards removing "UNKNOWN" value.
29 enum class CompletionState { UNKNOWN, DONE, PARTIALLY_DONE }; 21 enum class CompletionState { UNKNOWN, DONE, PARTIALLY_DONE };
30 22
31 static Id GetNextId();
32
33 PaintImage(); 23 PaintImage();
34 explicit PaintImage(Id id, 24 explicit PaintImage(sk_sp<SkImage> sk_image,
35 sk_sp<SkImage> sk_image,
36 AnimationType animation_type = AnimationType::STATIC, 25 AnimationType animation_type = AnimationType::STATIC,
37 CompletionState completion_state = CompletionState::DONE); 26 CompletionState completion_state = CompletionState::DONE);
38 PaintImage(const PaintImage& other); 27 PaintImage(const PaintImage& other);
39 PaintImage(PaintImage&& other); 28 PaintImage(PaintImage&& other);
40 ~PaintImage(); 29 ~PaintImage();
41 30
42 PaintImage& operator=(const PaintImage& other); 31 PaintImage& operator=(const PaintImage& other);
43 PaintImage& operator=(PaintImage&& other); 32 PaintImage& operator=(PaintImage&& other);
44 33
45 bool operator==(const PaintImage& other); 34 bool operator==(const PaintImage& other);
46 explicit operator bool() const { return sk_image_; } 35 explicit operator bool() const { return sk_image_; }
47 36
48 Id stable_id() const { return id_; }
49 const sk_sp<SkImage>& sk_image() const { return sk_image_; } 37 const sk_sp<SkImage>& sk_image() const { return sk_image_; }
50 AnimationType animation_type() const { return animation_type_; } 38 AnimationType animation_type() const { return animation_type_; }
51 CompletionState completion_state() const { return completion_state_; } 39 CompletionState completion_state() const { return completion_state_; }
52 40
53 private: 41 private:
54 static base::AtomicSequenceNumber s_next_id_;
55
56 Id id_;
57 sk_sp<SkImage> sk_image_; 42 sk_sp<SkImage> sk_image_;
58 AnimationType animation_type_ = AnimationType::UNKNOWN; 43 AnimationType animation_type_ = AnimationType::UNKNOWN;
59 CompletionState completion_state_ = CompletionState::UNKNOWN; 44 CompletionState completion_state_ = CompletionState::UNKNOWN;
60 }; 45 };
61 46
62 } // namespace cc 47 } // namespace cc
63 48
64 #endif // CC_PAINT_PAINT_IMAGE_H_ 49 #endif // CC_PAINT_PAINT_IMAGE_H_
OLDNEW
« 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