Flutter Engine
The Flutter Engine
Public Member Functions | Protected Attributes | List of all members
dart::BaseSerializer Class Reference
Inheritance diagram for dart::BaseSerializer:
dart::StackResource dart::ApiMessageSerializer dart::MessageSerializer

Public Member Functions

 BaseSerializer (Thread *thread, Zone *zone)
 
 ~BaseSerializer ()
 
template<typename T >
void Write (T value)
 
void WriteUnsigned (intptr_t value)
 
void WriteWordWith32BitWrites (uword value)
 
void WriteBytes (const void *addr, intptr_t len)
 
void WriteAscii (const String &str)
 
MessageSerializationClusterNewClusterForClass (intptr_t cid, bool is_canonical)
 
void WriteCluster (MessageSerializationCluster *cluster)
 
std::unique_ptr< MessageFinish (Dart_Port dest_port, Message::Priority priority)
 
Zonezone () const
 
MessageFinalizableDatafinalizable_data () const
 
intptr_t next_ref_index () const
 
- Public Member Functions inherited from dart::StackResource
 StackResource (ThreadState *thread)
 
virtual ~StackResource ()
 
ThreadStatethread () const
 

Protected Attributes

Zone *const zone_
 
MallocWriteStream stream_
 
MessageFinalizableDatafinalizable_data_
 
GrowableArray< MessageSerializationCluster * > clusters_
 
intptr_t num_base_objects_
 
intptr_t num_written_objects_
 
intptr_t next_ref_index_
 

Additional Inherited Members

- Static Public Member Functions inherited from dart::StackResource
static void Unwind (ThreadState *thread)
 
static void UnwindAbove (ThreadState *thread, StackResource *new_top)
 

Detailed Description

Definition at line 147 of file message_snapshot.cc.

Constructor & Destructor Documentation

◆ BaseSerializer()

dart::BaseSerializer::BaseSerializer ( Thread thread,
Zone zone 
)

Definition at line 2691 of file message_snapshot.cc.

2693 zone_(zone),
2694 stream_(100),
2695 finalizable_data_(new MessageFinalizableData()),
2696 clusters_(zone, 0),
GrowableArray< MessageSerializationCluster * > clusters_
MessageFinalizableData * finalizable_data_
MallocWriteStream stream_
ThreadState * thread() const
Definition: allocation.h:33
StackResource(ThreadState *thread)
Definition: allocation.h:25
static constexpr intptr_t kFirstReference

◆ ~BaseSerializer()

dart::BaseSerializer::~BaseSerializer ( )

Definition at line 2701 of file message_snapshot.cc.

2701 {
2702 delete finalizable_data_;
2703}

Member Function Documentation

◆ finalizable_data()

MessageFinalizableData * dart::BaseSerializer::finalizable_data ( ) const
inline

Definition at line 191 of file message_snapshot.cc.

191{ return finalizable_data_; }

◆ Finish()

std::unique_ptr< Message > dart::BaseSerializer::Finish ( Dart_Port  dest_port,
Message::Priority  priority 
)
inline

Definition at line 180 of file message_snapshot.cc.

181 {
182 MessageFinalizableData* finalizable_data = finalizable_data_;
183 finalizable_data_ = nullptr;
185 intptr_t size;
186 uint8_t* buffer = stream_.Steal(&size);
187 return Message::New(dest_port, buffer, size, finalizable_data, priority);
188 }
MessageFinalizableData * finalizable_data() const
uint8_t * Steal(intptr_t *length)
Definition: datastream.h:633
static std::unique_ptr< Message > New(Args &&... args)
Definition: message.h:72
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

◆ NewClusterForClass()

MessageSerializationCluster * dart::BaseSerializer::NewClusterForClass ( intptr_t  cid,
bool  is_canonical 
)

Definition at line 3069 of file message_snapshot.cc.

3071 {
3072 Zone* Z = zone_;
3076 return new (Z) TypedDataViewMessageSerializationCluster(Z, cid);
3077 }
3079 return new (Z) ExternalTypedDataMessageSerializationCluster(Z, cid);
3080 }
3081 if (IsTypedDataClassId(cid)) {
3082 return new (Z) TypedDataMessageSerializationCluster(Z, cid);
3083 }
3084
3085 switch (cid) {
3086 case kNativePointer:
3087 return new (Z) NativePointerMessageSerializationCluster(Z);
3088 case kClassCid:
3089 return new (Z) ClassMessageSerializationCluster();
3090 case kTypeArgumentsCid:
3091 return new (Z) TypeArgumentsMessageSerializationCluster(is_canonical);
3092 case kTypeCid:
3093 return new (Z) TypeMessageSerializationCluster(is_canonical);
3094 case kSmiCid:
3095 return new (Z) SmiMessageSerializationCluster(Z);
3096 case kMintCid:
3097 return new (Z) MintMessageSerializationCluster(Z, is_canonical);
3098 case kDoubleCid:
3099 return new (Z) DoubleMessageSerializationCluster(Z, is_canonical);
3100 case kGrowableObjectArrayCid:
3101 return new (Z) GrowableObjectArrayMessageSerializationCluster();
3102 case kSendPortCid:
3103 return new (Z) SendPortMessageSerializationCluster(Z);
3104 case kCapabilityCid:
3105 return new (Z) CapabilityMessageSerializationCluster(Z);
3106 case kTransferableTypedDataCid:
3107 return new (Z) TransferableTypedDataMessageSerializationCluster();
3108 case kMapCid:
3109 case kConstMapCid:
3110 return new (Z) MapMessageSerializationCluster(Z, is_canonical, cid);
3111 case kSetCid:
3112 case kConstSetCid:
3113 return new (Z) SetMessageSerializationCluster(Z, is_canonical, cid);
3114 case kArrayCid:
3115 case kImmutableArrayCid:
3116 return new (Z) ArrayMessageSerializationCluster(Z, is_canonical, cid);
3117 case kOneByteStringCid:
3118 return new (Z) OneByteStringMessageSerializationCluster(Z, is_canonical);
3119 case kTwoByteStringCid:
3120 return new (Z) TwoByteStringMessageSerializationCluster(Z, is_canonical);
3121 case kInt32x4Cid:
3122 case kFloat32x4Cid:
3123 case kFloat64x2Cid:
3124 return new (Z) Simd128MessageSerializationCluster(cid);
3125 default:
3126 break;
3127 }
3128
3129 FATAL("No cluster defined for cid %" Pd, cid);
3130 return nullptr;
3131}
#define Z
#define FATAL(error)
bool IsTypedDataViewClassId(intptr_t index)
Definition: class_id.h:439
bool IsTypedDataClassId(intptr_t index)
Definition: class_id.h:433
bool IsUnmodifiableTypedDataViewClassId(intptr_t index)
Definition: class_id.h:453
@ kNativePointer
Definition: class_id.h:218
@ kByteDataViewCid
Definition: class_id.h:244
@ kUnmodifiableByteDataViewCid
Definition: class_id.h:245
const intptr_t cid
bool IsExternalTypedDataClassId(intptr_t index)
Definition: class_id.h:447
#define Pd
Definition: globals.h:408

◆ next_ref_index()

intptr_t dart::BaseSerializer::next_ref_index ( ) const
inline

Definition at line 192 of file message_snapshot.cc.

192{ return next_ref_index_; }

◆ Write()

template<typename T >
void dart::BaseSerializer::Write ( T  value)
inline

Definition at line 155 of file message_snapshot.cc.

155 {
156 BaseWriteStream::Raw<sizeof(T), T>::Write(&stream_, value);
157 }
uint8_t value
#define T
Definition: precompiler.cc:65

◆ WriteAscii()

void dart::BaseSerializer::WriteAscii ( const String str)
inline

Definition at line 165 of file message_snapshot.cc.

165 {
166 intptr_t len = str.Length();
168 for (intptr_t i = 0; i < len; i++) {
169 int64_t c = str.CharAt(i);
170 ASSERT(c < 128);
171 Write<uint8_t>(c);
172 }
173 Write<uint8_t>(0);
174 }
void WriteUnsigned(intptr_t value)
#define ASSERT(E)

◆ WriteBytes()

void dart::BaseSerializer::WriteBytes ( const void *  addr,
intptr_t  len 
)
inline

Definition at line 162 of file message_snapshot.cc.

162 {
164 }
void WriteBytes(const void *addr, intptr_t len)
Definition: datastream.h:424

◆ WriteCluster()

void dart::BaseSerializer::WriteCluster ( MessageSerializationCluster cluster)

Definition at line 3133 of file message_snapshot.cc.

3133 {
3134 uint64_t cid_and_canonical = (static_cast<uint64_t>(cluster->cid()) << 1) |
3135 (cluster->is_canonical() ? 0x1 : 0x0);
3136 WriteUnsigned(cid_and_canonical);
3137}

◆ WriteUnsigned()

void dart::BaseSerializer::WriteUnsigned ( intptr_t  value)
inline

Definition at line 158 of file message_snapshot.cc.

void WriteUnsigned(T value)
Definition: datastream.h:400

◆ WriteWordWith32BitWrites()

void dart::BaseSerializer::WriteWordWith32BitWrites ( uword  value)
inline

Definition at line 159 of file message_snapshot.cc.

159 {
161 }
void WriteWordWith32BitWrites(uword value)
Definition: datastream.h:389

◆ zone()

Zone * dart::BaseSerializer::zone ( ) const
inline

Definition at line 190 of file message_snapshot.cc.

190{ return zone_; }

Member Data Documentation

◆ clusters_

GrowableArray<MessageSerializationCluster*> dart::BaseSerializer::clusters_
protected

Definition at line 198 of file message_snapshot.cc.

◆ finalizable_data_

MessageFinalizableData* dart::BaseSerializer::finalizable_data_
protected

Definition at line 197 of file message_snapshot.cc.

◆ next_ref_index_

intptr_t dart::BaseSerializer::next_ref_index_
protected

Definition at line 201 of file message_snapshot.cc.

◆ num_base_objects_

intptr_t dart::BaseSerializer::num_base_objects_
protected

Definition at line 199 of file message_snapshot.cc.

◆ num_written_objects_

intptr_t dart::BaseSerializer::num_written_objects_
protected

Definition at line 200 of file message_snapshot.cc.

◆ stream_

MallocWriteStream dart::BaseSerializer::stream_
protected

Definition at line 196 of file message_snapshot.cc.

◆ zone_

Zone* const dart::BaseSerializer::zone_
protected

Definition at line 195 of file message_snapshot.cc.


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