Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::ClassSerializationCluster Class Reference
Inheritance diagram for dart::ClassSerializationCluster:
dart::SerializationCluster dart::ZoneAllocated

Public Member Functions

 ClassSerializationCluster (intptr_t num_cids)
 
 ~ClassSerializationCluster ()
 
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 ()
 
virtual void Trace (Serializer *serializer, ObjectPtr object)=0
 
virtual void WriteAlloc (Serializer *serializer)=0
 
virtual void WriteFill (Serializer *serializer)=0
 
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 985 of file app_snapshot.cc.

Constructor & Destructor Documentation

◆ ClassSerializationCluster()

dart::ClassSerializationCluster::ClassSerializationCluster ( intptr_t  num_cids)
inlineexplicit

Definition at line 987 of file app_snapshot.cc.

988 : SerializationCluster("Class",
989 kClassCid,
991 predefined_(kNumPredefinedCids),
992 objects_(num_cids) {}
SerializationCluster(const char *name, intptr_t cid, intptr_t target_instance_size=kSizeVaries, bool is_canonical=false)
@ kNumPredefinedCids
Definition: class_id.h:257

◆ ~ClassSerializationCluster()

dart::ClassSerializationCluster::~ClassSerializationCluster ( )
inline

Definition at line 993 of file app_snapshot.cc.

993{}

Member Function Documentation

◆ Trace()

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

Implements dart::SerializationCluster.

Definition at line 995 of file app_snapshot.cc.

995 {
996 ClassPtr cls = Class::RawCast(object);
997 intptr_t class_id = cls->untag()->id_;
998
999 if (class_id == kIllegalCid) {
1000 // Classes expected to be dropped by the precompiler should not be traced.
1001 s->UnexpectedObject(cls, "Class with illegal cid");
1002 }
1003 if (class_id < kNumPredefinedCids) {
1004 // These classes are allocated by Object::Init or Object::InitOnce, so the
1005 // deserializer must find them in the class table instead of allocating
1006 // them.
1007 predefined_.Add(cls);
1008 } else {
1009 objects_.Add(cls);
1010 }
1011
1012 PushFromTo(cls);
1013 }
#define PushFromTo(obj,...)
void Add(const T &value)
static ObjectPtr RawCast(ObjectPtr obj)
Definition: object.h:325
struct MyStruct s
@ kIllegalCid
Definition: class_id.h:214

◆ WriteAlloc()

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

Implements dart::SerializationCluster.

Definition at line 1015 of file app_snapshot.cc.

1015 {
1016 intptr_t count = predefined_.length();
1017 s->WriteUnsigned(count);
1018 for (intptr_t i = 0; i < count; i++) {
1019 ClassPtr cls = predefined_[i];
1020 s->AssignRef(cls);
1021 AutoTraceObject(cls);
1022 intptr_t class_id = cls->untag()->id_;
1023 s->WriteCid(class_id);
1024 }
1025 count = objects_.length();
1026 s->WriteUnsigned(count);
1027 for (intptr_t i = 0; i < count; i++) {
1028 ClassPtr cls = objects_[i];
1029 s->AssignRef(cls);
1030 }
1031 }
int count
Definition: FontMgrTest.cpp:50
#define AutoTraceObject(obj)
intptr_t length() const

◆ WriteFill()

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

Implements dart::SerializationCluster.

Definition at line 1033 of file app_snapshot.cc.

1033 {
1034 intptr_t count = predefined_.length();
1035 for (intptr_t i = 0; i < count; i++) {
1036 WriteClass(s, predefined_[i]);
1037 }
1038 count = objects_.length();
1039 for (intptr_t i = 0; i < count; i++) {
1040 WriteClass(s, objects_[i]);
1041 }
1042 }

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