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

Public Member Functions

 TwoByteStringMessageSerializationCluster (Zone *zone, bool is_canonical)
 
 ~TwoByteStringMessageSerializationCluster ()
 
void Trace (MessageSerializer *s, Object *object)
 
void WriteNodes (MessageSerializer *s)
 
void TraceApi (ApiMessageSerializer *s, Dart_CObject *object)
 
void WriteNodesApi (ApiMessageSerializer *s)
 
- Public Member Functions inherited from dart::MessageSerializationCluster
 MessageSerializationCluster (const char *name, MessagePhase phase, intptr_t cid, bool is_canonical=false)
 
virtual ~MessageSerializationCluster ()
 
virtual void Trace (MessageSerializer *s, Object *object)=0
 
virtual void WriteNodes (MessageSerializer *s)=0
 
virtual void WriteEdges (MessageSerializer *s)
 
virtual void TraceApi (ApiMessageSerializer *s, Dart_CObject *object)
 
virtual void WriteNodesApi (ApiMessageSerializer *s)
 
virtual void WriteEdgesApi (ApiMessageSerializer *s)
 
const char * name () const
 
MessagePhase phase () const
 
intptr_t cid () const
 
bool is_canonical () 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

- Protected Member Functions inherited from dart::MessageSerializationCluster
 DISALLOW_COPY_AND_ASSIGN (MessageSerializationCluster)
 
- Protected Attributes inherited from dart::MessageSerializationCluster
const char *const name_
 
const MessagePhase phase_
 
const intptr_t cid_
 
const bool is_canonical_
 

Detailed Description

Definition at line 2567 of file message_snapshot.cc.

Constructor & Destructor Documentation

◆ TwoByteStringMessageSerializationCluster()

dart::TwoByteStringMessageSerializationCluster::TwoByteStringMessageSerializationCluster ( Zone zone,
bool  is_canonical 
)
inlineexplicit

Definition at line 2570 of file message_snapshot.cc.

2572 : MessageSerializationCluster("TwoByteString",
2574 kTwoByteStringCid,
2575 is_canonical),
2576 objects_(zone, 0) {}
MessageSerializationCluster(const char *name, MessagePhase phase, intptr_t cid, bool is_canonical=false)

◆ ~TwoByteStringMessageSerializationCluster()

dart::TwoByteStringMessageSerializationCluster::~TwoByteStringMessageSerializationCluster ( )
inline

Definition at line 2577 of file message_snapshot.cc.

2577{}

Member Function Documentation

◆ Trace()

void dart::TwoByteStringMessageSerializationCluster::Trace ( MessageSerializer s,
Object object 
)
inlinevirtual

Implements dart::MessageSerializationCluster.

Definition at line 2579 of file message_snapshot.cc.

2579 {
2580 String* str = static_cast<String*>(object);
2581 objects_.Add(str);
2582 }

◆ TraceApi()

void dart::TwoByteStringMessageSerializationCluster::TraceApi ( ApiMessageSerializer s,
Dart_CObject object 
)
inlinevirtual

Reimplemented from dart::MessageSerializationCluster.

Definition at line 2599 of file message_snapshot.cc.

2599 {
2600 objects_.Add(reinterpret_cast<String*>(object));
2601 }

◆ WriteNodes()

void dart::TwoByteStringMessageSerializationCluster::WriteNodes ( MessageSerializer s)
inlinevirtual

Implements dart::MessageSerializationCluster.

Definition at line 2584 of file message_snapshot.cc.

2584 {
2585 const intptr_t count = objects_.length();
2586 s->WriteUnsigned(count);
2587 for (intptr_t i = 0; i < count; i++) {
2588 String* str = objects_[i];
2589 s->AssignRef(str);
2590 intptr_t length = str->Length();
2591 s->WriteUnsigned(length);
2592 NoSafepointScope no_safepoint;
2593 uint16_t* utf16 = TwoByteString::DataStart(*str);
2594 s->WriteBytes(reinterpret_cast<const uint8_t*>(utf16),
2595 length * sizeof(uint16_t));
2596 }
2597 }
int count
Definition: FontMgrTest.cpp:50
struct MyStruct s
size_t length

◆ WriteNodesApi()

void dart::TwoByteStringMessageSerializationCluster::WriteNodesApi ( ApiMessageSerializer s)
inlinevirtual

Reimplemented from dart::MessageSerializationCluster.

Definition at line 2603 of file message_snapshot.cc.

2603 {
2604 intptr_t count = objects_.length();
2605 s->WriteUnsigned(count);
2606 for (intptr_t i = 0; i < count; i++) {
2607 Dart_CObject* str = reinterpret_cast<Dart_CObject*>(objects_[i]);
2608 s->AssignRef(str);
2609
2610 const uint8_t* utf8_str =
2611 reinterpret_cast<const uint8_t*>(str->value.as_string);
2612 intptr_t utf8_len = strlen(str->value.as_string);
2614 intptr_t utf16_len = Utf8::CodeUnitCount(utf8_str, utf8_len, &type);
2615
2616 uint16_t* utf16_str = reinterpret_cast<uint16_t*>(
2617 dart::malloc(utf16_len * sizeof(uint16_t)));
2618 bool success =
2619 Utf8::DecodeToUTF16(utf8_str, utf8_len, utf16_str, utf16_len);
2620 ASSERT(success);
2621 s->WriteUnsigned(utf16_len);
2622 s->WriteBytes(reinterpret_cast<const uint8_t*>(utf16_str),
2623 utf16_len * sizeof(uint16_t));
2624 ::free(utf16_str);
2625 }
2626 }
GLenum type
@ kLatin1
Definition: unicode.h:44
static intptr_t CodeUnitCount(const uint8_t *utf8_array, intptr_t array_len, Type *type)
Definition: unicode.cc:46
static bool DecodeToUTF16(const uint8_t *utf8_array, intptr_t array_len, uint16_t *dst, intptr_t len)
Definition: unicode.cc:217
#define ASSERT(E)
void * malloc(size_t size)
Definition: allocation.cc:19
union _Dart_CObject::@86 value
const char * as_string

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