Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 23 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 27 of file raster_cache_key.h.

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

◆ RasterCacheKeyID() [2/2]

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

Definition at line 30 of file raster_cache_key.h.

32 : unique_id_(kDefaultUniqueID),
33 type_(type),
34 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 40 of file raster_cache_key.h.

40{ return child_ids_; }

◆ GetHash()

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

Definition at line 45 of file raster_cache_key.h.

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

◆ LayerChildrenIds()

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

Definition at line 14 of file raster_cache_key.cc.

15 {
16 FML_DCHECK(layer->as_container_layer());
17 auto& children_layers = layer->as_container_layer()->layers();
18 auto children_count = children_layers.size();
19 if (children_count == 0) {
20 return std::nullopt;
21 }
22 std::vector<RasterCacheKeyID> ids;
23 std::transform(
24 children_layers.begin(), children_layers.end(), std::back_inserter(ids),
25 [](auto& layer) -> RasterCacheKeyID { return layer->caching_key_id(); });
26 return ids;
27}
#define FML_DCHECK(condition)
Definition logging.h:103

◆ operator!=()

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

Definition at line 64 of file raster_cache_key.h.

64 {
65 return !operator==(other);
66 }
bool operator==(const RasterCacheKeyID &other) const

◆ operator==()

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

Definition at line 59 of file raster_cache_key.h.

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

◆ type()

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

Definition at line 38 of file raster_cache_key.h.

38{ return type_; }

◆ unique_id()

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

Definition at line 36 of file raster_cache_key.h.

36{ return unique_id_; }

Member Data Documentation

◆ kDefaultUniqueID

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

Definition at line 25 of file raster_cache_key.h.


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