Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2787)

Unified Diff: base/android/linker/linker_jni.cc

Issue 673093005: Fallback for loading library from a zipfile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/android/linker/linker_jni.cc
diff --git a/base/android/linker/linker_jni.cc b/base/android/linker/linker_jni.cc
index a545c528ed336e44953138c9a51f8ad5647a1bf4..a42010100eda699d660ef58f31cea602b9a52a9c 100644
--- a/base/android/linker/linker_jni.cc
+++ b/base/android/linker/linker_jni.cc
@@ -350,6 +350,18 @@ jboolean LoadLibrary(JNIEnv* env,
static_cast<size_t>(load_address), lib_info_obj, opener);
}
+const size_t kMaxFilenameInZip = 256;
+jstring LibraryFilenameInZipFile(JNIEnv* env, jclass clazz, jstring lib_name) {
+ String lib_name_str(env, lib_name);
+ char buffer[kMaxFilenameInZip + 1];
+ if (CRAZY_STATUS_SUCCESS != crazy_library_filename_in_zip_file(
+ lib_name_str.c_str(), buffer, sizeof(buffer))) {
+ LOG_ERROR("Failure to get library filename from zipfile");
+ buffer[0] = '\0';
+ }
+ return env->NewStringUTF(buffer);
+}
+
// Load a library from a zipfile with the chromium linker. The
// library in the zipfile must be uncompressed and page aligned.
// The basename of the library is given. The library is expected
@@ -622,6 +634,12 @@ const JNINativeMethod kNativeMethods[] = {
")"
"Z",
reinterpret_cast<void*>(&LoadLibrary)},
+ {"nativeLibraryFilenameInZipFile",
+ "("
+ "Ljava/lang/String;"
+ ")"
+ "Ljava/lang/String;",
+ reinterpret_cast<void*>(&LibraryFilenameInZipFile)},
{"nativeLoadLibraryInZipFile",
"("
"Ljava/lang/String;"

Powered by Google App Engine
This is Rietveld 408576698