Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
flutter::RasterCacheKeyID Class Reference

#include <raster_cache_key.h>

Public Member Functions

 RasterCacheKeyID (uint64_t unique_id, RasterCacheKeyType type)
 
 RasterCacheKeyID (std::vector< RasterCacheKeyID > child_ids, RasterCacheKeyType type)
 
uint64_t unique_id () const
 
RasterCacheKeyType type () const
 
const std::vector< RasterCacheKeyID > & child_ids () const
 
std::size_t GetHash () const
 
bool operator== (const RasterCacheKeyID &other) const
 
bool operator!= (const RasterCacheKeyID &other) const
 

Static Public Member Functions

static std::optional< std::vector< RasterCacheKeyID > > LayerChildrenIds (const Layer *layer)
 

Static Public Attributes

static constexpr uint64_t kDefaultUniqueID = 0
 

Detailed Description

Definition at line 25 of file raster_cache_key.h.

Constructor & Destructor Documentation

◆ RasterCacheKeyID() [1/2]

flutter::RasterCacheKeyID::RasterCacheKeyID ( uint64_t  unique_id,
RasterCacheKeyType  type 
)
inline

Definition at line 29 of file raster_cache_key.h.

30 : unique_id_(unique_id), type_(type) {}
RasterCacheKeyType type() const
uint64_t unique_id() const

◆ RasterCacheKeyID() [2/2]

flutter::RasterCacheKeyID::RasterCacheKeyID ( std::vector< RasterCacheKeyID child_ids,
RasterCacheKeyType  type 
)
inline

Definition at line 32 of file raster_cache_key.h.

34 : unique_id_(kDefaultUniqueID),
35 type_(type),
36 child_ids_(std::move(child_ids)) {}
static constexpr uint64_t kDefaultUniqueID
const std::vector< RasterCacheKeyID > & child_ids() const

Member Function Documentation

◆ child_ids()

const std::vector< RasterCacheKeyID > & flutter::RasterCacheKeyID::child_ids ( ) const
inline

Definition at line 42 of file raster_cache_key.h.

42{ return child_ids_; }

◆ GetHash()

std::size_t flutter::RasterCacheKeyID::GetHash ( ) const
inline

Definition at line 47 of file raster_cache_key.h.

47 {
48 if (cached_hash_) {
49 return cached_hash_.value();
50 }
51 std::size_t seed = fml::HashCombine();
52 fml::HashCombineSeed(seed, unique_id_);
53 fml::HashCombineSeed(seed, type_);
54 for (auto& child_id : child_ids_) {
55 fml::HashCombineSeed(seed, child_id.GetHash());
56 }
57 cached_hash_ = seed;
58 return seed;
59 }
constexpr std::size_t HashCombine()
Definition: hash_combine.h:25
constexpr void HashCombineSeed(std::size_t &seed, Type arg)
Definition: hash_combine.h:13

◆ LayerChildrenIds()

std::optional< std::vector< RasterCacheKeyID > > flutter::RasterCacheKeyID::LayerChildrenIds ( const Layer layer)
static

Definition at line 15 of file raster_cache_key.cc.

16 {
17 FML_DCHECK(layer->as_container_layer());
18 auto& children_layers = layer->as_container_layer()->layers();
19 auto children_count = children_layers.size();
20 if (children_count == 0) {
21 return std::nullopt;
22 }
23 std::vector<RasterCacheKeyID> ids;
25 children_layers.begin(), children_layers.end(), std::back_inserter(ids),
26 [](auto& layer) -> RasterCacheKeyID { return layer->caching_key_id(); });
27 return ids;
28}
RasterCacheKeyID(uint64_t unique_id, RasterCacheKeyType type)
#define FML_DCHECK(condition)
Definition: logging.h:103
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
Definition: p3.cpp:47

◆ operator!=()

bool flutter::RasterCacheKeyID::operator!= ( const RasterCacheKeyID other) const
inline

Definition at line 66 of file raster_cache_key.h.

66 {
67 return !operator==(other);
68 }
bool operator==(const RasterCacheKeyID &other) const

◆ operator==()

bool flutter::RasterCacheKeyID::operator== ( const RasterCacheKeyID other) const
inline

Definition at line 61 of file raster_cache_key.h.

61 {
62 return unique_id_ == other.unique_id_ && type_ == other.type_ &&
63 GetHash() == other.GetHash() && child_ids_ == other.child_ids_;
64 }
std::size_t GetHash() const

◆ type()

RasterCacheKeyType flutter::RasterCacheKeyID::type ( ) const
inline

Definition at line 40 of file raster_cache_key.h.

40{ return type_; }

◆ unique_id()

uint64_t flutter::RasterCacheKeyID::unique_id ( ) const
inline

Definition at line 38 of file raster_cache_key.h.

38{ return unique_id_; }

Member Data Documentation

◆ kDefaultUniqueID

constexpr uint64_t flutter::RasterCacheKeyID::kDefaultUniqueID = 0
staticconstexpr

Definition at line 27 of file raster_cache_key.h.


The documentation for this class was generated from the following files: