summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2023-09-21 20:22:21 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2023-09-27 19:44:58 +0200
commit39294317e0d804bbfa95ba8e5ff5955238140879 (patch)
tree5654a52f380c644c4e90ef48c7068c1856a7a439 /src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
parent064b46779cb96225614ef3b5b1fa511b6acc3c9d (diff)
JNI: merge class loading implementations
QtAndroidPrivate::findClass first tried the cache, then JNIEnv::FindClass. Failing that, it tried QJniObject::loadClass which also checked the cache before falling back to the ClassLoader. Merge the implementations into QtAndroidPrivate::findClass. Loading a class now always first tries the cache, then FindClass, then the ClassLoader. Reduce the overhead from temporary QJniObject creations by explicitly creating the class string, and avoid printing the exception in case of failure twice by clearing the exception explicitly after the first try. Assert that the function receives a JNIEnv pointer, as any call without is a programming error (and all call-sites in Qt pass in a valid pointer anyway, so no need to test otherwise). With both implementations merged we can centralize the binary encoding of the class name strings to the single place where it's needed, which is when calling the ClassLoader::loadClass method. FindClass takes a fully qualified, slash-separated class name string, so in most cases we never have to pay any overhead for re-encoding the class name string. Change-Id: I5a3648763052cebdec69d7d77c503aebdebf5bee Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Diffstat (limited to 'src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp')
0 files changed, 0 insertions, 0 deletions