Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dart::DeltaEncodedTypedDataSerializationCluster Class Reference
Inheritance diagram for dart::DeltaEncodedTypedDataSerializationCluster:
dart::SerializationCluster dart::ZoneAllocated

Public Member Functions

 DeltaEncodedTypedDataSerializationCluster ()
 
 ~DeltaEncodedTypedDataSerializationCluster ()
 
void Trace (Serializer *s, ObjectPtr object)
 
void WriteAlloc (Serializer *s)
 
void WriteFill (Serializer *s)
 
- Public Member Functions inherited from dart::SerializationCluster
 SerializationCluster (const char *name, intptr_t cid, intptr_t target_instance_size=kSizeVaries, bool is_canonical=false)
 
virtual ~SerializationCluster ()
 
void WriteAndMeasureAlloc (Serializer *serializer)
 
void WriteAndMeasureFill (Serializer *serializer)
 
const char * name () const
 
intptr_t cid () const
 
bool is_canonical () const
 
bool is_immutable () const
 
intptr_t size () const
 
intptr_t num_objects () const
 
intptr_t target_memory_size () const
 
- Public Member Functions inherited from dart::ZoneAllocated
 ZoneAllocated ()
 
void * operator new (size_t size)
 
void * operator new (size_t size, Zone *zone)
 
void operator delete (void *pointer)
 

Additional Inherited Members

- Static Public Attributes inherited from dart::SerializationCluster
static constexpr intptr_t kSizeVaries = -1
 
- Protected Attributes inherited from dart::SerializationCluster
const char *const name_
 
const intptr_t cid_
 
const intptr_t target_instance_size_
 
const bool is_canonical_
 
const bool is_immutable_
 
intptr_t size_ = 0
 
intptr_t num_objects_ = 0
 
intptr_t target_memory_size_ = 0
 

Detailed Description

Definition at line 5903 of file app_snapshot.cc.

Constructor & Destructor Documentation

◆ DeltaEncodedTypedDataSerializationCluster()

dart::DeltaEncodedTypedDataSerializationCluster::DeltaEncodedTypedDataSerializationCluster ( )
inline

Definition at line 5905 of file app_snapshot.cc.

5906 : SerializationCluster("DeltaEncodedTypedData",
5907 kDeltaEncodedTypedDataCid) {}
SerializationCluster(const char *name, intptr_t cid, intptr_t target_instance_size=kSizeVaries, bool is_canonical=false)

◆ ~DeltaEncodedTypedDataSerializationCluster()

dart::DeltaEncodedTypedDataSerializationCluster::~DeltaEncodedTypedDataSerializationCluster ( )
inline

Definition at line 5908 of file app_snapshot.cc.

5908{}

Member Function Documentation

◆ Trace()

void dart::DeltaEncodedTypedDataSerializationCluster::Trace ( Serializer s,
ObjectPtr  object 
)
inlinevirtual

Implements dart::SerializationCluster.

Definition at line 5910 of file app_snapshot.cc.

5910 {
5911 TypedDataPtr data = TypedData::RawCast(object);
5912 objects_.Add(data);
5913 }
void Add(const T &value)
static ObjectPtr RawCast(ObjectPtr obj)
Definition object.h:325
static int8_t data[kExtLength]

◆ WriteAlloc()

void dart::DeltaEncodedTypedDataSerializationCluster::WriteAlloc ( Serializer s)
inlinevirtual

Implements dart::SerializationCluster.

Definition at line 5915 of file app_snapshot.cc.

5915 {
5916 const intptr_t count = objects_.length();
5917 s->WriteUnsigned(count);
5918 for (intptr_t i = 0; i < count; i++) {
5919 const TypedDataPtr data = objects_[i];
5920 const intptr_t element_size =
5921 TypedData::ElementSizeInBytes(data->GetClassId());
5922 s->AssignRef(data);
5924 const intptr_t length_in_bytes =
5925 Smi::Value(data->untag()->length()) * element_size;
5926 s->WriteUnsigned(length_in_bytes);
5928 compiler::target::TypedData::InstanceSize(length_in_bytes);
5929 }
5930 }
int count
static size_t element_size(Layout layout, SkSLType type)
#define AutoTraceObject(obj)
intptr_t length() const
intptr_t Value() const
Definition object.h:9969
intptr_t ElementSizeInBytes() const
Definition object.h:11505
struct MyStruct s

◆ WriteFill()

void dart::DeltaEncodedTypedDataSerializationCluster::WriteFill ( Serializer s)
inlinevirtual

Implements dart::SerializationCluster.

Definition at line 5932 of file app_snapshot.cc.

5932 {
5933 const intptr_t count = objects_.length();
5934 TypedData& typed_data = TypedData::Handle(s->zone());
5935 for (intptr_t i = 0; i < count; i++) {
5936 const TypedDataPtr data = objects_[i];
5938 const intptr_t cid = data->GetClassId();
5939 // Only Uint16 and Uint32 typed data is supported at the moment. So encode
5940 // which this is in the low bit of the length. Uint16 is 0, Uint32 is 1.
5941 ASSERT(cid == kTypedDataUint16ArrayCid ||
5942 cid == kTypedDataUint32ArrayCid);
5943 const intptr_t cid_flag = cid == kTypedDataUint16ArrayCid ? 0 : 1;
5944 const intptr_t length = Smi::Value(data->untag()->length());
5945 const intptr_t encoded_length = (length << 1) | cid_flag;
5946 s->WriteUnsigned(encoded_length);
5947 intptr_t prev = 0;
5948 typed_data = data;
5949 for (intptr_t j = 0; j < length; ++j) {
5950 const intptr_t value = (cid == kTypedDataUint16ArrayCid)
5951 ? typed_data.GetUint16(j << 1)
5952 : typed_data.GetUint32(j << 2);
5953 ASSERT(value >= prev);
5954 s->WriteUnsigned(value - prev);
5955 prev = value;
5956 }
5957 }
5958 }
static float prev(float f)
static Object & Handle()
Definition object.h:407
#define ASSERT(E)
uint8_t value
size_t length

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