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

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

Issue 1180693002: Update from https://crrev.com/333737 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 years, 6 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
« no previous file with comments | « base/android/library_loader/library_load_from_apk_status_codes.h ('k') | base/android/scoped_java_ref.h » ('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 b79eaf43bc156dd16efc2b3c21f752e6be097796..2bc480cf776dd6af931cd9885c1f6c2287adc2fd 100644
--- a/base/android/linker/linker_jni.cc
+++ b/base/android/linker/linker_jni.cc
@@ -447,17 +447,6 @@ jboolean LoadLibraryInZipFile(JNIEnv* env,
static_cast<size_t>(load_address), lib_info_obj, opener);
}
-// Enable the fallback due to lack of support for mapping the APK file with
-// executable permission in the crazy linker.
-//
-// |env| is the current JNI environment handle and is ignored here.
-// |clazz| is the static class handle for org.chromium.base.Linker,
-// and is ignored here.
-void EnableNoMapExecSupportFallback(JNIEnv* env, jclass clazz) {
- crazy_context_t* context = GetCrazyContext();
- crazy_context_set_no_map_exec_support_fallback_enabled(context, true);
-}
-
// Class holding the Java class and method ID for the Java side Linker
// postCallbackOnMainThread method.
struct JavaCallbackBindings_class {
@@ -670,42 +659,6 @@ jstring GetLibraryFilePathInZipFile(JNIEnv* env,
return env->NewStringUTF(buffer);
}
-// Check whether the device supports mapping the APK file with executable
-// permission.
-//
-// |env| is the current JNI environment handle.
-// |clazz| is the static class handle which is not used here.
-// |apkfile_name| is the filename of the APK.
-// Returns true if supported.
-jboolean CheckMapExecSupport(JNIEnv* env, jclass clazz, jstring apkfile_name) {
- String apkfile_name_str(env, apkfile_name);
- const char* apkfile_name_c_str = apkfile_name_str.c_str();
-
- int fd = open(apkfile_name_c_str, O_RDONLY);
- if (fd == -1) {
- LOG_ERROR("%s: Failed to open %s\n", __FUNCTION__, apkfile_name_c_str);
- return false;
- }
-
- LOG_INFO(
- "%s: Memory mapping the first page of %s with executable permissions\n",
- __FUNCTION__, apkfile_name_c_str);
- void* address = mmap(NULL, PAGE_SIZE, PROT_EXEC, MAP_PRIVATE, fd, 0);
-
- jboolean status;
- if (address == MAP_FAILED) {
- status = false;
- } else {
- status = true;
- munmap(address, PAGE_SIZE);
- }
-
- close(fd);
-
- LOG_INFO("%s: %s\n", __FUNCTION__, status ? "Supported" : "NOT supported");
- return status;
-}
-
// Check whether a library is page aligned and uncompressed in the APK file.
//
// |env| is the current JNI environment handle.
@@ -748,11 +701,6 @@ const JNINativeMethod kNativeMethods[] = {
")"
"Z",
reinterpret_cast<void*>(&LoadLibraryInZipFile)},
- {"nativeEnableNoMapExecSupportFallback",
- "("
- ")"
- "V",
- reinterpret_cast<void*>(&EnableNoMapExecSupportFallback)},
{"nativeRunCallbackOnUiThread",
"("
"J"
@@ -791,12 +739,6 @@ const JNINativeMethod kNativeMethods[] = {
")"
"Ljava/lang/String;",
reinterpret_cast<void*>(&GetLibraryFilePathInZipFile)},
- {"nativeCheckMapExecSupport",
- "("
- "Ljava/lang/String;"
- ")"
- "Z",
- reinterpret_cast<void*>(&CheckMapExecSupport)},
{"nativeCheckLibraryIsMappableInApk",
"("
"Ljava/lang/String;"
« no previous file with comments | « base/android/library_loader/library_load_from_apk_status_codes.h ('k') | base/android/scoped_java_ref.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698