Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
dart::StreamingWriteStream Class Reference

#include <datastream.h>

Inheritance diagram for dart::StreamingWriteStream:
dart::BaseWriteStream dart::ValueObject

Public Member Functions

 StreamingWriteStream (intptr_t initial_capacity, Dart_StreamingWriteCallback callback, void *callback_data)
 
 ~StreamingWriteStream ()
 
- Public Member Functions inherited from dart::BaseWriteStream
 BaseWriteStream (intptr_t initial_size)
 
virtual ~BaseWriteStream ()
 
DART_FORCE_INLINE intptr_t bytes_written () const
 
intptr_t Align (intptr_t alignment, intptr_t offset=0)
 
void WriteWordWith32BitWrites (uword value)
 
template<typename T >
void WriteUnsigned (T value)
 
void WriteRefId (intptr_t value)
 
void WriteBytes (const void *addr, intptr_t len)
 
void WriteWord (uword value)
 
void WriteTargetWord (word value)
 
void Printf (const char *format,...) PRINTF_ATTRIBUTE(2
 
void va_start (args, format)
 
 VPrintf (format, args)
 
 va_end (args)
 
void VPrintf (const char *format, va_list args)
 
template<typename T >
void Write (T value)
 
template<typename T >
void WriteFixed (T value)
 
DART_FORCE_INLINE void WriteByte (uint8_t value)
 
void WriteString (const char *cstr)
 
template<typename T >
C::only_if_unsigned< T, void > WriteLEB128 (T value)
 
template<typename T >
C::only_if_signed< T, void > WriteLEB128 (T value)
 
template<typename T >
C::only_if_signed< T, void > WriteSLEB128 (T value)
 
template<typename T >
C::only_if_unsigned< T, void > WriteSLEB128 (T value)
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Private Member Functions

virtual void Flush ()
 
virtual void Realloc (intptr_t new_size)
 
virtual intptr_t Position () const
 
virtual void SetPosition (intptr_t value)
 

Additional Inherited Members

- Protected Member Functions inherited from dart::BaseWriteStream
void EnsureSpace (intptr_t size_needed)
 
DART_FORCE_INLINE intptr_t Remaining () const
 
 DISALLOW_COPY_AND_ASSIGN (BaseWriteStream)
 
- Protected Attributes inherited from dart::BaseWriteStream
const intptr_t initial_size_
 
uint8_t * buffer_ = nullptr
 
uint8_t * current_ = nullptr
 
intptr_t capacity_ = 0
 

Detailed Description

Definition at line 669 of file datastream.h.

Constructor & Destructor Documentation

◆ StreamingWriteStream()

dart::StreamingWriteStream::StreamingWriteStream ( intptr_t  initial_capacity,
Dart_StreamingWriteCallback  callback,
void *  callback_data 
)
inlineexplicit

Definition at line 671 of file datastream.h.

674 : BaseWriteStream(initial_capacity),
675 callback_(callback),
676 callback_data_(callback_data) {}
BaseWriteStream(intptr_t initial_size)
Definition datastream.h:334
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback

◆ ~StreamingWriteStream()

dart::StreamingWriteStream::~StreamingWriteStream ( )

Definition at line 35 of file datastream.cc.

35 {
36 Flush();
37 free(buffer_);
38}

Member Function Documentation

◆ Flush()

void dart::StreamingWriteStream::Flush ( )
privatevirtual

Definition at line 52 of file datastream.cc.

52 {
53 intptr_t size = current_ - buffer_;
54 callback_(callback_data_, buffer_, size);
55 flushed_size_ += size;
57}
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

◆ Position()

virtual intptr_t dart::StreamingWriteStream::Position ( ) const
inlineprivatevirtual

Reimplemented from dart::BaseWriteStream.

Definition at line 686 of file datastream.h.

686 {
687 return flushed_size_ + BaseWriteStream::Position();
688 }
virtual intptr_t Position() const
Definition datastream.h:339

◆ Realloc()

void dart::StreamingWriteStream::Realloc ( intptr_t  new_size)
privatevirtual

Implements dart::BaseWriteStream.

Definition at line 40 of file datastream.cc.

40 {
41 Flush();
42 // Check whether resetting the internal buffer by flushing gave enough space.
43 if (new_size <= capacity_) {
44 return;
45 }
46 const intptr_t new_capacity = Utils::RoundUp(new_size, 64 * KB);
47 buffer_ = reinterpret_cast<uint8_t*>(realloc(buffer_, new_capacity));
48 capacity_ = buffer_ != nullptr ? new_capacity : 0;
49 current_ = buffer_; // Flushing reset the internal buffer offset to 0.
50}
static constexpr T RoundUp(T x, uintptr_t alignment, uintptr_t offset=0)
Definition utils.h:105
constexpr intptr_t KB
Definition globals.h:528
void * realloc(void *ptr, size_t size)
Definition allocation.cc:27

◆ SetPosition()

virtual void dart::StreamingWriteStream::SetPosition ( intptr_t  value)
inlineprivatevirtual

Reimplemented from dart::BaseWriteStream.

Definition at line 690 of file datastream.h.

690 {
691 // Make sure we're not trying to set the position to already-flushed data.
692 ASSERT(value >= flushed_size_);
693 BaseWriteStream::SetPosition(value - flushed_size_);
694 }
virtual void SetPosition(intptr_t value)
Definition datastream.h:579
#define ASSERT(E)

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