11#ifdef SK_ENABLE_ANDROID_UTILS
21 const void* expectations,
size_t bytesToRead) {
25 const size_t bytesRead = bufferedStream->
read(storage.get(), bytesToRead);
31 SkStream* bufferedStream,
bool shouldSucceed) {
32 const bool success = bufferedStream->
rewind();
42 const SkStream& streamBeingBuffered) {
53const char gAbcs[] =
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwx";
64 std::unique_ptr<SkStream>(memStream), bufferSize);
66 test_hasLength(
reporter, *bufferedStream, *memStream);
77 test_read(
reporter, bufferedStream.get(), gAbcs + bufferSize / 4, bufferSize / 2);
93 std::unique_ptr<SkStream>(memStream), bufferSize);
94 test_hasLength(
reporter, *bufferedStream, *memStream);
113 std::unique_ptr<SkStream>(memStream), bufferSize);
114 test_hasLength(
reporter, *bufferedStream, *memStream);
117 bufferedStream->
skip(bufferSize / 2);
124 bufferedStream->
skip(bufferSize / 2);
138 AndroidLikeMemoryStream(
void*
data,
size_t size,
bool ownMemory)
142 size_t read(
void*
dst,
size_t requested)
override {
144 if (bytesRead < requested) {
150 bool isAtEnd()
const override {
163 AndroidLikeMemoryStream* memStream =
164 new AndroidLikeMemoryStream((
void*)gAbcs, bufferSize,
false);
168 std::unique_ptr<SkStream>(memStream), bufferSize);
169 test_hasLength(
reporter, *bufferedStream, *memStream);
181class LengthOptionalStream :
public SkStream {
183 LengthOptionalStream(
bool hasLength,
bool hasPosition)
184 : fHasLength(hasLength)
185 , fHasPosition(hasPosition)
196 size_t read(
void*,
size_t)
override {
200 bool isAtEnd()
const override {
205 const bool fHasLength;
206 const bool fHasPosition;
211 for (
int hasLen = 0; hasLen <= 1; hasLen++) {
212 for (
int hasPos = 0; hasPos <= 1; hasPos++) {
213 LengthOptionalStream*
stream =
216 std::unique_ptr<SkStream>(
stream), bufferSize);
228 const size_t arbitraryOffset = 17;
229 memStream->
skip(arbitraryOffset);
231 std::unique_ptr<SkStream>(memStream), bufferSize);
236 const size_t amountToRead = 10;
237 const size_t bufferedLength = bufferedStream->
getLength();
238 size_t currentPosition = 0;
243 while (currentPosition < bufferedLength) {
245 test_read(
reporter, bufferedStream.get(), gAbcs + arbitraryOffset + currentPosition,
247 currentPosition =
std::min(currentPosition + amountToRead, bufferedLength);
255 test_incremental_buffering(
reporter, bufferSize);
256 test_perfectly_sized_buffer(
reporter, bufferSize);
257 test_skipping(
reporter, bufferSize);
258 test_read_beyond_buffer(
reporter, bufferSize);
259 test_length_combos(
reporter, bufferSize);
260 test_initial_offset(
reporter, bufferSize);
273class FailingStream :
public SkStream {
285 bool isAtEnd()
const override {
294 FailingStream* failingStream =
new FailingStream;
296 std::unique_ptr<SkStream>(failingStream), 64);
static void test_read(skiatest::Reporter *reporter)
#define INHERITED(method,...)
static constexpr bool SkToBool(const T &x)
#define DEF_TEST(name, reporter)
#define REPORTER_ASSERT(r, cond,...)
static void test_rewind(skiatest::Reporter *reporter)
static std::unique_ptr< SkCodec > MakeFromStream(std::unique_ptr< SkStream >, SkSpan< const SkCodecs::Decoder > decoders, Result *=nullptr, SkPngChunkReader *=nullptr, SelectionPolicy selectionPolicy=SelectionPolicy::kPreferStillImage)
bool isAtEnd() const override
size_t read(void *buffer, size_t size) override
static std::unique_ptr< SkMemoryStream > MakeDirect(const void *data, size_t length)
size_t getPosition() const override
virtual bool hasPosition() const
virtual bool isAtEnd() const =0
virtual size_t getLength() const
virtual bool hasLength() const
virtual size_t read(void *buffer, size_t size)=0
static std::unique_ptr< SkStreamRewindable > Make(std::unique_ptr< SkStream > stream, size_t minBufferSize)
static float min(float r, float g, float b)
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
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
std::shared_ptr< const fml::Mapping > data