10#include <android/asset_manager.h>
11#include <android/asset_manager_jni.h>
38 int ret = AAsset_read(asset,
data->writable_data(),
size);
40 SK_ABORT(
"ERROR: AAsset_read != AAsset_getLength (%s)\n",
path);
55 std::vector<std::string>
iterateDir(
const char* directory,
const char* extension)
override {
56 std::vector<std::string> paths;
57 AAssetDir* assetDir = AAssetManager_openDir(
sAAssetManager, directory);
59 while (
const char* filename = AAssetDir_getNextFileName(assetDir)) {
60 const char*
ext = strrchr(filename,
'.');
64 if (0 != strcasecmp(extension,
ext)) {
68 paths.push_back(
path.c_str());
71 AAssetDir_close(assetDir);
83#define jassert(env, cond, ret) do { if (!(cond)) { \
84 (env)->ThrowNew((env)->FindClass("java/lang/Exception"), \
85 __FILE__ ": assert(" #cond ") failed."); \
86 return ret; } } while (0)
91 jclass stringClass =
env->FindClass(
"java/lang/String");
93 jobjectArray jarray =
env->NewObjectArray(arraySize, stringClass,
nullptr);
99 jstring jstr =
env->NewStringUTF(
s);
101 env->SetObjectArrayElement(
a, (jsize)
i, jstr);
102 env->DeleteLocalRef(jstr);
105template <
typename T,
typename F>
107 const std::vector<T>& array,
110 for (
size_t i = 0;
i < array.size(); ++
i) {
117 const char* utf8String =
env->GetStringUTFChars(jString,
nullptr);
118 jassert(
env, utf8String && utf8String[0],
"");
119 std::string sString(utf8String);
120 env->ReleaseStringUTFChars(jString, utf8String);
125 return t.
name.c_str();
134 jclass SkQP_class =
env->GetObjectClass(
object);
146 std::lock_guard<std::mutex> lock(
gMutex);
152 constexpr char kStringArrayType[] =
"[Ljava/lang/String;";
153 env->SetObjectField(
object,
154 env->GetFieldID(SkQP_class,
"mUnitTests", kStringArrayType),
156 env->SetObjectField(
object,
157 env->GetFieldID(SkQP_class,
"mSkSLErrorTestName", kStringArrayType),
159 env->SetObjectField(
object,
160 env->GetFieldID(SkQP_class,
"mSkSLErrorTestShader", kStringArrayType),
167 std::vector<std::string>
errors;
169 std::lock_guard<std::mutex> lock(
gMutex);
177 for (
size_t i = 0;
i <
errors.size(); ++
i) {
180 return (jobjectArray)
env->NewGlobalRef(array);
184 std::lock_guard<std::mutex> lock(
gMutex);
sk_sp< SkData >(* gResourceFactory)(const char *)
#define SK_ABORT(message,...)
constexpr size_t SkToSizeT(S x)
constexpr int SkToInt(S x)
static sk_sp< SkData > MakeUninitialized(size_t length)
static SkString Join(const char *rootPath, const char *relativePath)
virtual sk_sp< SkData > open(const char *path)=0
virtual std::vector< std::string > iterateDir(const char *directory, const char *extension)=0
const std::vector< UnitTest > & getUnitTests() const
const std::vector< SkSLErrorTest > & getSkSLErrorTests() const
std::vector< std::string > executeTest(UnitTest)
void init(SkQPAssetManager *assetManager, const char *reportDirectory)
static const char * GetUnitTestName(UnitTest)
static AndroidAssetManager gAndroidAssetManager
static jobjectArray make_java_string_array(JNIEnv *env, jint arraySize)
static std::string to_string(JNIEnv *env, jstring jString)
JNIEXPORT jobjectArray JNICALL Java_org_skia_skqp_SkQP_nExecuteUnitTest(JNIEnv *, jobject, jint)
#define jassert(env, cond, ret)
JNIEXPORT void JNICALL Java_org_skia_skqp_SkQP_nMakeReport(JNIEnv *, jobject)
static sk_sp< SkData > open_asset_data(const char *path)
static void set_string_array_element(JNIEnv *env, jobjectArray a, const char *s, unsigned i)
JNIEXPORT void JNICALL Java_org_skia_skqp_SkQP_nInit(JNIEnv *, jobject, jobject, jstring)
static const char * get_sksl_error_shader_text(const SkQP::SkSLErrorTest &t)
static const char * get_sksl_error_name(const SkQP::SkSLErrorTest &t)
static AAssetManager * sAAssetManager
static jobjectArray to_java_string_array(JNIEnv *env, const std::vector< T > &array, F stringizeFn)
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
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