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

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

Issue 693943003: Update from https://crrev.com/302630 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « base/android/javatests/src/org/chromium/base/LibraryLoaderHelperTest.java ('k') | base/bind_unittest.nc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/linker/linker_jni.cc
diff --git a/base/android/linker/linker_jni.cc b/base/android/linker/linker_jni.cc
index 30aced19769acc594e2953c6933be08f2d0d7877..2b5a07dd203947dd52c33e9aff82ccf20053c2c2 100644
--- a/base/android/linker/linker_jni.cc
+++ b/base/android/linker/linker_jni.cc
@@ -576,6 +576,28 @@ jlong GetRandomBaseLoadAddress(JNIEnv* env, jclass clazz, jlong bytes) {
return static_cast<jlong>(reinterpret_cast<uintptr_t>(address));
}
+// Get the full path of a library in the zip file
+// (lib/<abi>/crazy.<lib_name>).
+//
+// |env| is the current JNI environment handle.
+// |clazz| is the static class handle which is not used here.
+// |lib_name| is the library base name.
+// Returns the full path (or empty string on failure).
+jstring GetLibraryFilePathInZipFile(JNIEnv* env,
+ jclass clazz,
+ jstring lib_name) {
+ String lib_name_str(env, lib_name);
+ const char* lib_name_c_str = lib_name_str.c_str();
+ char buffer[kMaxFilePathLengthInZip + 1];
+ if (crazy_library_file_path_in_zip_file(
+ lib_name_c_str, buffer, sizeof(buffer)) == CRAZY_STATUS_FAILURE) {
+ LOG_ERROR("%s: Failed to get full filename for library '%s'",
+ __FUNCTION__, lib_name_c_str);
+ buffer[0] = '\0';
+ }
+ return env->NewStringUTF(buffer);
+}
+
// Check whether the device supports loading a library directly from the APK
// file.
//
@@ -686,19 +708,25 @@ const JNINativeMethod kNativeMethods[] = {
")"
"J",
reinterpret_cast<void*>(&GetRandomBaseLoadAddress)},
- {"nativeCheckLibraryLoadFromApkSupport",
- "("
- "Ljava/lang/String;"
- ")"
- "Z",
- reinterpret_cast<void*>(&CheckLibraryLoadFromApkSupport)},
- {"nativeCheckLibraryAlignedInApk",
- "("
- "Ljava/lang/String;"
- "Ljava/lang/String;"
- ")"
- "Z",
- reinterpret_cast<void*>(&CheckLibraryAlignedInApk)}, };
+ {"nativeGetLibraryFilePathInZipFile",
+ "("
+ "Ljava/lang/String;"
+ ")"
+ "Ljava/lang/String;",
+ reinterpret_cast<void*>(&GetLibraryFilePathInZipFile)},
+ {"nativeCheckLibraryLoadFromApkSupport",
+ "("
+ "Ljava/lang/String;"
+ ")"
+ "Z",
+ reinterpret_cast<void*>(&CheckLibraryLoadFromApkSupport)},
+ {"nativeCheckLibraryAlignedInApk",
+ "("
+ "Ljava/lang/String;"
+ "Ljava/lang/String;"
+ ")"
+ "Z",
+ reinterpret_cast<void*>(&CheckLibraryAlignedInApk)}, };
} // namespace
« no previous file with comments | « base/android/javatests/src/org/chromium/base/LibraryLoaderHelperTest.java ('k') | base/bind_unittest.nc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698