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

Unified Diff: content/app/android/library_loader_hooks.cc

Issue 141223002: Move the android library loader from content to base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix final nits Created 6 years, 10 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: content/app/android/library_loader_hooks.cc
diff --git a/content/app/android/library_loader_hooks.cc b/content/app/android/library_loader_hooks.cc
index 275a5d785c7ef87f83190e6ba1584c5484e0284e..868017cf28ae1e8acc3070bfdccbf7d681dc22f5 100644
--- a/content/app/android/library_loader_hooks.cc
+++ b/content/app/android/library_loader_hooks.cc
@@ -9,13 +9,11 @@
#include "base/android/jni_android.h"
#include "base/android/jni_registrar.h"
#include "base/android/jni_string.h"
-#include "base/at_exit.h"
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/debug/trace_event.h"
#include "base/files/file_path.h"
#include "base/logging.h"
-#include "base/metrics/histogram.h"
#include "base/strings/string_util.h"
#include "base/tracked_objects.h"
#include "content/app/android/app_jni_registrar.h"
@@ -25,7 +23,6 @@
#include "content/common/content_constants_internal.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/result_codes.h"
-#include "jni/LibraryLoader_jni.h"
#include "media/base/android/media_jni_registrar.h"
#include "net/android/net_jni_registrar.h"
#include "ui/base/android/ui_base_jni_registrar.h"
@@ -35,11 +32,6 @@
namespace content {
-namespace {
-base::AtExitManager* g_at_exit_manager = NULL;
-const char* g_library_version_number = "";
-}
-
bool EnsureJniRegistered(JNIEnv* env) {
static bool g_jni_init_done = false;
@@ -83,7 +75,7 @@ bool EnsureJniRegistered(JNIEnv* env) {
return true;
}
-static jint LibraryLoaded(JNIEnv* env, jclass clazz,
+bool LibraryLoaded(JNIEnv* env, jclass clazz,
jobjectArray init_command_line) {
base::android::InitNativeCommandLineFromJavaArray(env, init_command_line);
@@ -125,43 +117,7 @@ static jint LibraryLoaded(JNIEnv* env, jclass clazz,
VLOG(0) << "Chromium logging enabled: level = " << logging::GetMinLogLevel()
<< ", default verbosity = " << logging::GetVlogVerbosity();
- if (!EnsureJniRegistered(env))
- return RESULT_CODE_FAILED_TO_REGISTER_JNI;
-
- return 0;
-}
-
-static void RecordContentAndroidLinkerHistogram(
- JNIEnv* env,
- jclass clazz,
- jboolean loaded_at_fixed_address_failed,
- jboolean is_low_memory_device) {
- UMA_HISTOGRAM_BOOLEAN("ContentAndroidLinker.LoadedAtFixedAddressFailed",
- loaded_at_fixed_address_failed);
- UMA_HISTOGRAM_BOOLEAN("ContentAndroidLinker.IsLowMemoryDevice",
- is_low_memory_device);
-}
-
-void LibraryLoaderExitHook() {
- if (g_at_exit_manager) {
- delete g_at_exit_manager;
- g_at_exit_manager = NULL;
- }
-}
-
-bool RegisterLibraryLoaderEntryHook(JNIEnv* env) {
- // We need the AtExitManager to be created at the very beginning.
- g_at_exit_manager = new base::AtExitManager();
-
- return RegisterNativesImpl(env);
-}
-
-void SetVersionNumber(const char* version_number) {
- g_library_version_number = strdup(version_number);
-}
-
-jstring GetVersionNumber(JNIEnv* env, jclass clazz) {
- return env->NewStringUTF(g_library_version_number);
+ return EnsureJniRegistered(env);
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698