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

Public Member Functions

 OneByteStringMessageSerializationCluster (Zone *zone, bool is_canonical)
 
 ~OneByteStringMessageSerializationCluster ()
 
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 2461 of file message_snapshot.cc.

Constructor & Destructor Documentation

◆ OneByteStringMessageSerializationCluster()

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

Definition at line 2464 of file message_snapshot.cc.

2466 : MessageSerializationCluster("OneByteString",
2468 kOneByteStringCid,
2469 is_canonical),
2470 objects_(zone, 0) {}
MessageSerializationCluster(const char *name, MessagePhase phase, intptr_t cid, bool is_canonical=false)

◆ ~OneByteStringMessageSerializationCluster()

dart::OneByteStringMessageSerializationCluster::~OneByteStringMessageSerializationCluster ( )
inline

Definition at line 2471 of file message_snapshot.cc.

2471{}

Member Function Documentation

◆ Trace()

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

Implements dart::MessageSerializationCluster.

Definition at line 2473 of file message_snapshot.cc.

2473 {
2474 String* str = static_cast<String*>(object);
2475 objects_.Add(str);
2476 }

◆ TraceApi()

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

Reimplemented from dart::MessageSerializationCluster.

Definition at line 2491 of file message_snapshot.cc.

2491 {
2492 objects_.Add(reinterpret_cast<String*>(object));
2493 }

◆ WriteNodes()

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

Implements dart::MessageSerializationCluster.

Definition at line 2478 of file message_snapshot.cc.

2478 {
2479 const intptr_t count = objects_.length();
2480 s->WriteUnsigned(count);
2481 for (intptr_t i = 0; i < count; i++) {
2482 String* str = objects_[i];
2483 s->AssignRef(str);
2484 intptr_t length = str->Length();
2485 s->WriteUnsigned(length);
2486 NoSafepointScope no_safepoint;
2487 s->WriteBytes(OneByteString::DataStart(*str), length * sizeof(uint8_t));
2488 }
2489 }
int count
Definition: FontMgrTest.cpp:50
struct MyStruct s
size_t length

◆ WriteNodesApi()

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

Reimplemented from dart::MessageSerializationCluster.

Definition at line 2495 of file message_snapshot.cc.

2495 {
2496 intptr_t count = objects_.length();
2497 s->WriteUnsigned(count);
2498 for (intptr_t i = 0; i < count; i++) {
2499 Dart_CObject* str = reinterpret_cast<Dart_CObject*>(objects_[i]);
2500 s->AssignRef(str);
2501
2502 const uint8_t* utf8_str =
2503 reinterpret_cast<const uint8_t*>(str->value.as_string);
2504 intptr_t utf8_len = strlen(str->value.as_string);
2506 intptr_t latin1_len = Utf8::CodeUnitCount(utf8_str, utf8_len, &type);
2507
2508 uint8_t* latin1_str = reinterpret_cast<uint8_t*>(
2509 dart::malloc(latin1_len * sizeof(uint8_t)));
2510 bool success =
2511 Utf8::DecodeToLatin1(utf8_str, utf8_len, latin1_str, latin1_len);
2512 ASSERT(success);
2513 s->WriteUnsigned(latin1_len);
2514 s->WriteBytes(latin1_str, latin1_len);
2515 ::free(latin1_str);
2516 }
2517 }
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 DecodeToLatin1(const uint8_t *utf8_array, intptr_t array_len, uint8_t *dst, intptr_t len)
Definition: unicode.cc:194
#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: