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

Unified Diff: content/shell/android/linker_test_apk/src/org/chromium/content_linker_test_apk/LinkerTests.java

Issue 23717023: Android: Add chrome-specific dynamic linker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update content_tests.gypi Created 7 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
« no previous file with comments | « content/shell/android/linker_test_apk/src/org/chromium/content_linker_test_apk/ContentLinkerTestApplication.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/android/linker_test_apk/src/org/chromium/content_linker_test_apk/LinkerTests.java
diff --git a/content/shell/android/linker_test_apk/src/org/chromium/content_linker_test_apk/LinkerTests.java b/content/shell/android/linker_test_apk/src/org/chromium/content_linker_test_apk/LinkerTests.java
new file mode 100644
index 0000000000000000000000000000000000000000..4247b903f5789de9854edf89db45d4d632c68c37
--- /dev/null
+++ b/content/shell/android/linker_test_apk/src/org/chromium/content_linker_test_apk/LinkerTests.java
@@ -0,0 +1,61 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.content_linker_test_apk;
+
+import android.util.Log;
+
+import org.chromium.base.JNINamespace;
+import org.chromium.content.app.Linker;
+
+// A class that is only used in linker test APK to perform runtime checks
+// in the current process.
+@JNINamespace("content")
+public class LinkerTests implements Linker.TestRunner {
+ private static final String TAG = "LinkerTests";
+
+ public LinkerTests() {}
+
+ public boolean runChecks(int memoryDeviceConfig,
+ boolean isBrowserProcess) {
+ boolean checkSharedRelro;
+ if (isBrowserProcess) {
+ switch (Linker.BROWSER_SHARED_RELRO_CONFIG) {
+ case Linker.BROWSER_SHARED_RELRO_CONFIG_NEVER:
+ checkSharedRelro = false;
+ break;
+ case Linker.BROWSER_SHARED_RELRO_CONFIG_LOW_RAM_ONLY:
+ // A shared RELRO should only be used on low-end devices.
+ checkSharedRelro =
+ (memoryDeviceConfig == Linker.MEMORY_DEVICE_CONFIG_LOW);
+ break;
+ case Linker.BROWSER_SHARED_RELRO_CONFIG_ALWAYS:
+ // Always check for a shared RELRO.
+ checkSharedRelro = true;
+ break;
+ default:
+ Log.e(TAG, "Invalid shared RELRO linker configuration: " +
+ Linker.BROWSER_SHARED_RELRO_CONFIG);
+ return false;
+ }
+ } else {
+ // Service processes should always use a shared RELRO section.
+ checkSharedRelro = true;
+ }
+
+ if (checkSharedRelro)
+ return nativeCheckForSharedRelros(isBrowserProcess);
+ else
+ return nativeCheckForNoSharedRelros(isBrowserProcess);
+ }
+
+ // Check that there are shared RELRO sections in the current process,
+ // and that they are properly mapped read-only. Returns true on success.
+ private static native boolean nativeCheckForSharedRelros(boolean isBrowserProcess);
+
+ // Check that there are no shared RELRO sections in the current process,
+ // return true on success.
+ private static native boolean nativeCheckForNoSharedRelros(boolean isBrowserProcess);
+
+}
« no previous file with comments | « content/shell/android/linker_test_apk/src/org/chromium/content_linker_test_apk/ContentLinkerTestApplication.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698