#include <SkStream.h>
Definition at line 455 of file SkStream.h.
◆ SkDynamicMemoryWStream() [1/2]
SkDynamicMemoryWStream::SkDynamicMemoryWStream |
( |
| ) |
|
|
default |
◆ SkDynamicMemoryWStream() [2/2]
Definition at line 493 of file SkStream.cpp.
494 : fHead(other.fHead)
495 , fTail(other.fTail)
496 , fBytesWrittenBeforeTail(other.fBytesWrittenBeforeTail)
497{
498 other.fHead = nullptr;
499 other.fTail = nullptr;
500 other.fBytesWrittenBeforeTail = 0;
501}
◆ ~SkDynamicMemoryWStream()
SkDynamicMemoryWStream::~SkDynamicMemoryWStream |
( |
| ) |
|
|
override |
◆ bytesWritten()
size_t SkDynamicMemoryWStream::bytesWritten |
( |
| ) |
const |
|
overridevirtual |
Implements SkWStream.
Definition at line 526 of file SkStream.cpp.
526 {
527 this->validate();
528
529 if (fTail) {
530 return fBytesWrittenBeforeTail + fTail->
written();
531 }
532 return 0;
533}
◆ copyTo()
void SkDynamicMemoryWStream::copyTo |
( |
void * |
dst | ) |
const |
More efficient version of read(dst, 0, bytesWritten()).
Definition at line 631 of file SkStream.cpp.
631 {
633 Block* block = fHead;
634 while (block != nullptr) {
635 size_t size = block->written();
636 memcpy(
dst, block->start(),
size);
638 block = block->fNext;
639 }
640}
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
◆ copyToAndReset()
void SkDynamicMemoryWStream::copyToAndReset |
( |
void * |
dst | ) |
|
Equivalent to copyTo() followed by reset(), but may save memory use.
Definition at line 668 of file SkStream.cpp.
668 {
669 if (!ptr) {
671 return;
672 }
673
674
675 char*
dst =
reinterpret_cast<char*
>(ptr);
676 Block* block = fHead;
677 while (block != nullptr) {
678 size_t len = block->written();
679 memcpy(
dst, block->start(),
len);
684 }
685 fHead = fTail = nullptr;
686 fBytesWrittenBeforeTail = 0;
687}
static float next(float f)
SK_API void sk_free(void *)
◆ detachAsData()
sk_sp< SkData > SkDynamicMemoryWStream::detachAsData |
( |
| ) |
|
Return the contents as SkData, and then reset the stream.
Definition at line 707 of file SkStream.cpp.
707 {
709 if (0 == size) {
711 }
715}
static sk_sp< SkData > MakeUninitialized(size_t length)
static sk_sp< SkData > MakeEmpty()
size_t bytesWritten() const override
void copyToAndReset(void *dst)
std::shared_ptr< const fml::Mapping > data
◆ detachAsStream()
std::unique_ptr< SkStreamAsset > SkDynamicMemoryWStream::detachAsStream |
( |
| ) |
|
Reset, returning a reader stream with the current content.
Definition at line 876 of file SkStream.cpp.
876 {
877 if (nullptr == fHead) {
878
880 }
881 if (fHead == fTail) {
882 ptrdiff_t used = fTail->
fCurr - (
char*)fTail;
884 fTail->
fStop = fTail->
fCurr = (
char*)fTail + used;
886 SkASSERT(0 == fBytesWrittenBeforeTail);
887 }
888 std::unique_ptr<SkStreamAsset>
stream
889 = std::make_unique<SkBlockMemoryStream>(sk_make_sp<SkBlockMemoryRefCnt>(fHead),
891 fHead = nullptr;
894}
SK_API void * sk_realloc_throw(void *buffer, size_t size)
constexpr size_t SkToSizeT(S x)
static std::unique_ptr< SkMemoryStream > Make(sk_sp< SkData > data)
◆ operator=()
Definition at line 503 of file SkStream.cpp.
503 {
504 if (this != &other) {
507 }
508 return *this;
509}
~SkDynamicMemoryWStream() override
SkDynamicMemoryWStream()=default
◆ padToAlign4()
void SkDynamicMemoryWStream::padToAlign4 |
( |
| ) |
|
Definition at line 652 of file SkStream.cpp.
652 {
653
654
655
656
657 if (fTail) {
658
660 if (padBytes) {
661 int zero = 0;
662 fTail->
append(&zero, padBytes);
663 }
664 }
665}
const void * append(const void *data, size_t size)
◆ prependToAndReset()
Prepend this stream to dst, resetting this.
Definition at line 591 of file SkStream.cpp.
591 {
595 return;
596 }
598 *
dst = std::move(*
this);
599 return;
600 }
603 dst->fBytesWrittenBeforeTail += fBytesWrittenBeforeTail + fTail->
written();
604 fHead = fTail = nullptr;
605 fBytesWrittenBeforeTail = 0;
606}
◆ read()
bool SkDynamicMemoryWStream::read |
( |
void * |
buffer, |
|
|
size_t |
offset, |
|
|
size_t |
size |
|
) |
| |
Definition at line 609 of file SkStream.cpp.
609 {
611 return false;
612 }
613 Block* block = fHead;
614 while (block != nullptr) {
615 size_t size = block->written();
620 return true;
621 }
624 }
626 block = block->fNext;
627 }
628 return false;
629}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
◆ reset()
void SkDynamicMemoryWStream::reset |
( |
| ) |
|
Reset the stream to its original, empty, state.
Definition at line 515 of file SkStream.cpp.
515 {
516 Block* block = fHead;
517 while (block != nullptr) {
521 }
522 fHead = fTail = nullptr;
523 fBytesWrittenBeforeTail = 0;
524}
◆ write()
bool SkDynamicMemoryWStream::write |
( |
const void * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
overridevirtual |
Called to write bytes to a SkWStream. Returns true on success
- Parameters
-
buffer | the address of at least size bytes to be written to the stream |
size | The number of bytes in buffer to write to the stream |
- Returns
- true on success
Implements SkWStream.
Reimplemented in SkRawLimitedDynamicMemoryWStream.
Definition at line 535 of file SkStream.cpp.
535 {
539
540 if (fTail && fTail->
avail() > 0) {
546 return true;
547 }
548 }
549
552
554 if (!block) {
555 this->validate();
556 return false;
557 }
560
561 if (fTail) {
562 fBytesWrittenBeforeTail += fTail->
written();
563 fTail->
fNext = block;
564 } else {
565 fHead = fTail = block;
566 }
567 fTail = block;
568 this->validate();
569 }
570 return true;
571}
static constexpr T SkAlign4(T x)
static void * sk_malloc_canfail(size_t size)
#define SkDynamicMemoryWStream_MinBlockSize
static float min(float r, float g, float b)
◆ writeToAndReset() [1/2]
Equivalent to writeToStream() followed by reset(), but may save memory use. When the dst is also a SkDynamicMemoryWStream, the implementation is constant time.
Definition at line 573 of file SkStream.cpp.
573 {
577 return true;
578 }
580 *
dst = std::move(*
this);
581 return true;
582 }
583 dst->fTail->fNext = fHead;
584 dst->fBytesWrittenBeforeTail += fBytesWrittenBeforeTail +
dst->fTail->written();
586 fHead = fTail = nullptr;
587 fBytesWrittenBeforeTail = 0;
588 return true;
589}
◆ writeToAndReset() [2/2]
bool SkDynamicMemoryWStream::writeToAndReset |
( |
SkWStream * |
dst | ) |
|
Equivalent to writeToStream() followed by reset(), but may save memory use.
Definition at line 689 of file SkStream.cpp.
689 {
691
692
693 bool dstStreamGood = true;
694 for (
Block* block = fHead; block !=
nullptr; ) {
695 if (dstStreamGood && !
dst->write(block->start(), block->written())) {
696 dstStreamGood = false;
697 }
701 }
702 fHead = fTail = nullptr;
703 fBytesWrittenBeforeTail = 0;
704 return dstStreamGood;
705}
◆ writeToStream()
bool SkDynamicMemoryWStream::writeToStream |
( |
SkWStream * |
dst | ) |
const |
Definition at line 642 of file SkStream.cpp.
642 {
644 for (
Block* block = fHead; block !=
nullptr; block = block->fNext) {
645 if (!
dst->write(block->start(), block->written())) {
646 return false;
647 }
648 }
649 return true;
650}
◆ SkBlockMemoryRefCnt
◆ SkBlockMemoryStream
The documentation for this class was generated from the following files: