Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
SkAutoDescriptor Class Reference

#include <SkDescriptor.h>

Public Member Functions

 SkAutoDescriptor ()
 
 SkAutoDescriptor (size_t size)
 
 SkAutoDescriptor (const SkDescriptor &)
 
 SkAutoDescriptor (const SkAutoDescriptor &)
 
SkAutoDescriptoroperator= (const SkAutoDescriptor &)
 
 SkAutoDescriptor (SkAutoDescriptor &&)
 
SkAutoDescriptoroperator= (SkAutoDescriptor &&)
 
 ~SkAutoDescriptor ()
 
void reset (size_t size)
 
void reset (const SkDescriptor &desc)
 
SkDescriptorgetDesc () const
 

Static Public Member Functions

static std::optional< SkAutoDescriptorMakeFromBuffer (SkReadBuffer &buffer)
 

Detailed Description

Definition at line 87 of file SkDescriptor.h.

Constructor & Destructor Documentation

◆ SkAutoDescriptor() [1/5]

SkAutoDescriptor::SkAutoDescriptor ( )
default

◆ SkAutoDescriptor() [2/5]

SkAutoDescriptor::SkAutoDescriptor ( size_t  size)
explicit

Definition at line 145 of file SkDescriptor.cpp.

145{ this->reset(size); }
void reset(size_t size)
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

◆ SkAutoDescriptor() [3/5]

SkAutoDescriptor::SkAutoDescriptor ( const SkDescriptor desc)
explicit

Definition at line 146 of file SkDescriptor.cpp.

146{ this->reset(desc); }

◆ SkAutoDescriptor() [4/5]

SkAutoDescriptor::SkAutoDescriptor ( const SkAutoDescriptor that)

Definition at line 147 of file SkDescriptor.cpp.

147 {
148 this->reset(*that.getDesc());
149}
SkDescriptor * getDesc() const
Definition: SkDescriptor.h:103

◆ SkAutoDescriptor() [5/5]

SkAutoDescriptor::SkAutoDescriptor ( SkAutoDescriptor &&  that)

Definition at line 154 of file SkDescriptor.cpp.

154 {
155 if (that.fDesc == (SkDescriptor*)&that.fStorage) {
156 this->reset(*that.getDesc());
157 } else {
158 fDesc = that.fDesc;
159 that.fDesc = nullptr;
160 }
161}

◆ ~SkAutoDescriptor()

SkAutoDescriptor::~SkAutoDescriptor ( )

Definition at line 173 of file SkDescriptor.cpp.

173{ this->free(); }

Member Function Documentation

◆ getDesc()

SkDescriptor * SkAutoDescriptor::getDesc ( ) const
inline

Definition at line 103 of file SkDescriptor.h.

103{ SkASSERT(fDesc); return fDesc; }
#define SkASSERT(cond)
Definition: SkAssert.h:116

◆ MakeFromBuffer()

std::optional< SkAutoDescriptor > SkAutoDescriptor::MakeFromBuffer ( SkReadBuffer buffer)
static

Definition at line 175 of file SkDescriptor.cpp.

175 {
176 SkDescriptor descriptorHeader;
177 if (!buffer.readPad32(&descriptorHeader, sizeof(SkDescriptor))) { return {}; }
178
179 // Basic bounds check on header length to make sure that bodyLength calculation does not
180 // underflow.
181 if (descriptorHeader.getLength() < sizeof(SkDescriptor)) { return {}; }
182 uint32_t bodyLength = descriptorHeader.getLength() - sizeof(SkDescriptor);
183
184 // Make sure the fLength makes sense with respect to the incoming data.
185 if (bodyLength > buffer.available()) {
186 return {};
187 }
188
189 SkAutoDescriptor ad{descriptorHeader.getLength()};
190 memcpy(ad.fDesc, &descriptorHeader, sizeof(SkDescriptor));
191 if (!buffer.readPad32(SkTAddOffset<void>(ad.fDesc, sizeof(SkDescriptor)), bodyLength)) {
192 return {};
193 }
194
195// If the fuzzer produces data but the checksum does not match, let it continue. This will boost
196// fuzzing speed. We leave the actual checksum computation in for fuzzing builds to make sure
197// the ComputeChecksum function is covered.
198#if defined(SK_BUILD_FOR_FUZZER)
199 SkDescriptor::ComputeChecksum(ad.getDesc());
200#else
201 if (SkDescriptor::ComputeChecksum(ad.getDesc()) != ad.getDesc()->fChecksum) { return {}; }
202#endif
203 if (!ad.getDesc()->isValid()) { return {}; }
204
205 return {ad};
206}
uint32_t getLength() const
Definition: SkDescriptor.h:42
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
Definition: switches.h:126

◆ operator=() [1/2]

SkAutoDescriptor & SkAutoDescriptor::operator= ( const SkAutoDescriptor that)

Definition at line 150 of file SkDescriptor.cpp.

150 {
151 this->reset(*that.getDesc());
152 return *this;
153}

◆ operator=() [2/2]

SkAutoDescriptor & SkAutoDescriptor::operator= ( SkAutoDescriptor &&  that)

Definition at line 162 of file SkDescriptor.cpp.

162 {
163 if (that.fDesc == (SkDescriptor*)&that.fStorage) {
164 this->reset(*that.getDesc());
165 } else {
166 this->free();
167 fDesc = that.fDesc;
168 that.fDesc = nullptr;
169 }
170 return *this;
171}

◆ reset() [1/2]

void SkAutoDescriptor::reset ( const SkDescriptor desc)

Definition at line 217 of file SkDescriptor.cpp.

217 {
218 size_t size = desc.getLength();
219 this->reset(size);
220 memcpy(fDesc, &desc, size);
221}

◆ reset() [2/2]

void SkAutoDescriptor::reset ( size_t  size)

Definition at line 208 of file SkDescriptor.cpp.

208 {
209 this->free();
210 if (size <= sizeof(fStorage)) {
211 fDesc = new (&fStorage) SkDescriptor{};
212 } else {
213 fDesc = SkDescriptor::Alloc(size).release();
214 }
215}
static std::unique_ptr< SkDescriptor > Alloc(size_t length)

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