Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::MessageFinalizableData Class Reference

#include <finalizable_data.h>

Public Member Functions

 MessageFinalizableData ()
 
 ~MessageFinalizableData ()
 
void Put (intptr_t external_size, void *data, void *peer, Dart_HandleFinalizer callback, Dart_HandleFinalizer successful_write_callback=nullptr)
 
FinalizableData Get ()
 
FinalizableData Take ()
 
void SerializationSucceeded ()
 
void DropFinalizers ()
 
intptr_t external_size () const
 

Detailed Description

Definition at line 21 of file finalizable_data.h.

Constructor & Destructor Documentation

◆ MessageFinalizableData()

dart::MessageFinalizableData::MessageFinalizableData ( )
inline

Definition at line 23 of file finalizable_data.h.

24 : records_(0), get_position_(0), take_position_(0), external_size_(0) {}

◆ ~MessageFinalizableData()

dart::MessageFinalizableData::~MessageFinalizableData ( )
inline

Definition at line 26 of file finalizable_data.h.

26 {
27 for (intptr_t i = take_position_; i < records_.length(); i++) {
28 records_[i].callback(nullptr, records_[i].peer);
29 }
30 }

Member Function Documentation

◆ DropFinalizers()

void dart::MessageFinalizableData::DropFinalizers ( )
inline

Definition at line 71 of file finalizable_data.h.

71 {
72 records_.Clear();
73 get_position_ = 0;
74 take_position_ = 0;
75 external_size_ = 0;
76 }

◆ external_size()

intptr_t dart::MessageFinalizableData::external_size ( ) const
inline

Definition at line 78 of file finalizable_data.h.

78{ return external_size_; }

◆ Get()

FinalizableData dart::MessageFinalizableData::Get ( )
inline

Definition at line 51 of file finalizable_data.h.

51 {
52 ASSERT(get_position_ < records_.length());
53 return records_[get_position_++];
54 }
#define ASSERT(E)

◆ Put()

void dart::MessageFinalizableData::Put ( intptr_t  external_size,
void *  data,
void *  peer,
Dart_HandleFinalizer  callback,
Dart_HandleFinalizer  successful_write_callback = nullptr 
)
inline

If [successful_write_callback] is provided, it's invoked when message was serialized successfully. [callback] is invoked when serialization failed.

Definition at line 35 of file finalizable_data.h.

39 {
40 FinalizableData finalizable_data;
41 finalizable_data.data = data;
42 finalizable_data.peer = peer;
43 finalizable_data.callback = callback;
44 finalizable_data.successful_write_callback = successful_write_callback;
45 records_.Add(finalizable_data);
46 external_size_ += external_size;
47 }
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
static int8_t data[kExtLength]

◆ SerializationSucceeded()

void dart::MessageFinalizableData::SerializationSucceeded ( )
inline

Definition at line 63 of file finalizable_data.h.

63 {
64 for (intptr_t i = 0; i < records_.length(); i++) {
65 if (records_[i].successful_write_callback != nullptr) {
66 records_[i].successful_write_callback(nullptr, records_[i].peer);
67 }
68 }
69 }

◆ Take()

FinalizableData dart::MessageFinalizableData::Take ( )
inline

Definition at line 58 of file finalizable_data.h.

58 {
59 ASSERT(take_position_ < records_.length());
60 return records_[take_position_++];
61 }

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