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

#include <secure_socket_utils.h>

Public Member Functions

 ScopedMemBIO (Dart_Handle object)
 
 ~ScopedMemBIO ()
 
BIO * bio ()
 
uint8_t * data ()
 
intptr_t length ()
 

Detailed Description

Definition at line 60 of file secure_socket_utils.h.

Constructor & Destructor Documentation

◆ ScopedMemBIO()

dart::bin::ScopedMemBIO::ScopedMemBIO ( Dart_Handle  object)
inlineexplicit

Definition at line 62 of file secure_socket_utils.h.

62 {
63 if (!Dart_IsTypedData(object) && !Dart_IsList(object)) {
65 DartUtils::NewDartArgumentError("Argument is not a List<int>"));
66 }
67
68 uint8_t* bytes = nullptr;
69 intptr_t bytes_len = 0;
70 bool is_typed_data = false;
71 if (Dart_IsTypedData(object)) {
72 is_typed_data = true;
75 object, &typ, reinterpret_cast<void**>(&bytes), &bytes_len));
76 } else {
77 ASSERT(Dart_IsList(object));
78 ThrowIfError(Dart_ListLength(object, &bytes_len));
79 bytes = Dart_ScopeAllocate(bytes_len);
80 ASSERT(bytes != nullptr);
81 ThrowIfError(Dart_ListGetAsBytes(object, 0, bytes, bytes_len));
82 }
83
84 object_ = object;
85 bytes_ = bytes;
86 bytes_len_ = bytes_len;
87 bio_ = BIO_new_mem_buf(bytes, bytes_len);
88 ASSERT(bio_ != nullptr);
89 is_typed_data_ = is_typed_data;
90 }
static Dart_Handle NewDartArgumentError(const char *message)
Definition: dartutils.cc:746
Dart_TypedData_Type
Definition: dart_api.h:2612
#define ASSERT(E)
static Dart_Handle ThrowIfError(Dart_Handle handle)
Definition: dartutils.h:31
DART_EXPORT uint8_t * Dart_ScopeAllocate(intptr_t size)
DART_EXPORT Dart_Handle Dart_TypedDataAcquireData(Dart_Handle object, Dart_TypedData_Type *type, void **data, intptr_t *len)
DART_EXPORT Dart_Handle Dart_ListGetAsBytes(Dart_Handle list, intptr_t offset, uint8_t *native_array, intptr_t length)
DART_EXPORT Dart_Handle Dart_ListLength(Dart_Handle list, intptr_t *len)
DART_EXPORT bool Dart_IsList(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_ThrowException(Dart_Handle exception)
DART_EXPORT bool Dart_IsTypedData(Dart_Handle handle)

◆ ~ScopedMemBIO()

dart::bin::ScopedMemBIO::~ScopedMemBIO ( )
inline

Definition at line 92 of file secure_socket_utils.h.

92 {
93 ASSERT(bio_ != nullptr);
94 if (is_typed_data_) {
95 BIO_free(bio_);
97 } else {
98 BIO_free(bio_);
99 }
100 }
DART_EXPORT Dart_Handle Dart_TypedDataReleaseData(Dart_Handle object)

Member Function Documentation

◆ bio()

BIO * dart::bin::ScopedMemBIO::bio ( )
inline

Definition at line 102 of file secure_socket_utils.h.

102 {
103 ASSERT(bio_ != nullptr);
104 return bio_;
105 }

◆ data()

uint8_t * dart::bin::ScopedMemBIO::data ( )
inline

Definition at line 107 of file secure_socket_utils.h.

107{ return bytes_; }

◆ length()

intptr_t dart::bin::ScopedMemBIO::length ( )
inline

Definition at line 108 of file secure_socket_utils.h.

108{ return bytes_len_; }

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