Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
HaltingStream Class Reference

#include <FakeStreams.h>

Inheritance diagram for HaltingStream:
SkStream

Public Member Functions

 HaltingStream (sk_sp< SkData > data, size_t initialLimit)
 
void addNewData (size_t extra)
 
size_t read (void *buffer, size_t size) override
 
bool isAtEnd () const override
 
bool hasLength () const override
 
size_t getLength () const override
 
bool hasPosition () const override
 
size_t getPosition () const override
 
bool rewind () override
 
bool move (long offset) override
 
bool seek (size_t position) override
 
bool isAllDataReceived () const
 
- Public Member Functions inherited from SkStream
virtual ~SkStream ()
 
 SkStream ()
 
size_t skip (size_t size)
 
virtual size_t peek (void *, size_t) const
 
bool readS8 (int8_t *)
 
bool readS16 (int16_t *)
 
bool readS32 (int32_t *)
 
bool readU8 (uint8_t *i)
 
bool readU16 (uint16_t *i)
 
bool readU32 (uint32_t *i)
 
bool readBool (bool *b)
 
bool readScalar (SkScalar *)
 
bool readPackedUInt (size_t *)
 
std::unique_ptr< SkStreamduplicate () const
 
std::unique_ptr< SkStreamfork () const
 
virtual const void * getMemoryBase ()
 
virtual sk_sp< SkDatagetData () const
 

Additional Inherited Members

- Static Public Member Functions inherited from SkStream
static std::unique_ptr< SkStreamAssetMakeFromFile (const char path[])
 

Detailed Description

Definition at line 61 of file FakeStreams.h.

Constructor & Destructor Documentation

◆ HaltingStream()

HaltingStream::HaltingStream ( sk_sp< SkData data,
size_t  initialLimit 
)
inline

Definition at line 63 of file FakeStreams.h.

64 : fTotalSize(data->size())
65 , fLimit(initialLimit)
66 , fStream(std::move(data))
67 {}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41

Member Function Documentation

◆ addNewData()

void HaltingStream::addNewData ( size_t  extra)
inline

Definition at line 69 of file FakeStreams.h.

69 {
70 fLimit = std::min(fTotalSize, fLimit + extra);
71 }

◆ getLength()

size_t HaltingStream::getLength ( ) const
inlineoverridevirtual

Returns the total length of the stream. If this cannot be done, returns 0.

Reimplemented from SkStream.

Definition at line 86 of file FakeStreams.h.

86{ return fLimit; }

◆ getPosition()

size_t HaltingStream::getPosition ( ) const
inlineoverridevirtual

Returns the current position in the stream. If this cannot be done, returns 0.

Reimplemented from SkStream.

Definition at line 89 of file FakeStreams.h.

89{ return fStream.getPosition(); }
size_t getPosition() const override
Definition SkStream.cpp:374

◆ hasLength()

bool HaltingStream::hasLength ( ) const
inlineoverridevirtual

Returns true if this stream can report its total length.

Reimplemented from SkStream.

Definition at line 85 of file FakeStreams.h.

85{ return true; }

◆ hasPosition()

bool HaltingStream::hasPosition ( ) const
inlineoverridevirtual

Returns true if this stream can report its current position.

Reimplemented from SkStream.

Definition at line 88 of file FakeStreams.h.

88{ return true; }

◆ isAllDataReceived()

bool HaltingStream::isAllDataReceived ( ) const
inline

Definition at line 94 of file FakeStreams.h.

94{ return fLimit == fTotalSize; }

◆ isAtEnd()

bool HaltingStream::isAtEnd ( ) const
inlineoverridevirtual

Returns true when all the bytes in the stream have been read. As SkStream represents synchronous I/O, isAtEnd returns false when the final stream length isn't known yet, even when all the bytes available so far have been read. This may return true early (when there are no more bytes to be read) or late (after the first unsuccessful read).

Implements SkStream.

Definition at line 81 of file FakeStreams.h.

81 {
82 return fStream.isAtEnd();
83 }
bool isAtEnd() const override
Definition SkStream.cpp:361

◆ move()

bool HaltingStream::move ( long  )
inlineoverridevirtual

Seeks to an relative offset in the stream. If this cannot be done, returns false. If an attempt is made to move to a position outside the stream, the position will be set to the closest point within the stream (beginning or end).

Reimplemented from SkStream.

Definition at line 91 of file FakeStreams.h.

91{ return fStream.move(offset); }
bool move(long offset) override
Definition SkStream.cpp:385
Point offset

◆ read()

size_t HaltingStream::read ( void *  buffer,
size_t  size 
)
inlineoverridevirtual

Reads or skips size number of bytes. If buffer == NULL, skip size bytes, return how many were skipped. If buffer != NULL, copy size bytes into buffer, return how many were copied.

Parameters
bufferwhen NULL skip size bytes, otherwise copy size bytes into buffer
sizethe number of bytes to skip or copy
Returns
the number of bytes actually read.

Implements SkStream.

Definition at line 73 of file FakeStreams.h.

73 {
74 if (fStream.getPosition() + size > fLimit) {
75 size = fLimit - fStream.getPosition();
76 }
77
78 return fStream.read(buffer, size);
79 }
size_t read(void *buffer, size_t size) override
Definition SkStream.cpp:337
static const uint8_t buffer[]
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

◆ rewind()

bool HaltingStream::rewind ( )
inlineoverridevirtual

Rewinds to the beginning of the stream. Returns true if the stream is known to be at the beginning after this call returns.

Reimplemented from SkStream.

Definition at line 90 of file FakeStreams.h.

90{ return fStream.rewind(); }
bool rewind() override
Definition SkStream.cpp:365

◆ seek()

bool HaltingStream::seek ( size_t  )
inlineoverridevirtual

Seeks to an absolute position in the stream. If this cannot be done, returns false. If an attempt is made to seek past the end of the stream, the position will be set to the end of the stream.

Reimplemented from SkStream.

Definition at line 92 of file FakeStreams.h.

92{ return fStream.seek(position); }
bool seek(size_t position) override
Definition SkStream.cpp:378

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