Commit 236b82b2 authored by michaelbai's avatar michaelbai Committed by Commit bot

Remove android_library_loader_hook from content API

As content_jni_onload.h was added, android_library_loader_hook is not needed be a content API, move it to content/app/android/

BUG=447393

Review URL: https://codereview.chromium.org/914083004

Cr-Commit-Position: refs/heads/master@{#316376}
parent 0a243a40
......@@ -14,6 +14,7 @@ content_app_sources = [
"android/content_main.cc",
"android/content_main.h",
"android/library_loader_hooks.cc",
"android/library_loader_hooks.h",
"content_main.cc",
"content_main_runner.cc",
"mojo/mojo_init.cc",
......
......@@ -16,7 +16,6 @@
#include "content/common/android/surface_texture_manager.h"
#include "content/common/android/surface_texture_peer.h"
#include "content/common/gpu/gpu_surface_lookup.h"
#include "content/public/app/android_library_loader_hooks.h"
#include "content/public/common/content_descriptors.h"
#include "ipc/ipc_descriptors.h"
#include "jni/ChildProcessService_jni.h"
......
......@@ -9,7 +9,7 @@
#include "base/android/base_jni_onload.h"
#include "base/android/jni_onload_delegate.h"
#include "base/android/library_loader/library_loader_hooks.h"
#include "content/public/app/android_library_loader_hooks.h"
#include "content/app/android/library_loader_hooks.h"
#include "content/public/app/content_main.h"
namespace content {
......@@ -25,9 +25,6 @@ class ContentJNIOnLoadDelegate
};
bool ContentJNIOnLoadDelegate::RegisterJNI(JNIEnv* env) {
// TODO(michaelbai): Remove the EnsureJniRegistered from
// content::LibraryLoaded and move android_library_loader_hooks.h to
// content/app/android/.
return content::EnsureJniRegistered(env);
}
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/public/app/android_library_loader_hooks.h"
#include "content/app/android/library_loader_hooks.h"
#include "base/android/base_jni_registrar.h"
#include "base/android/command_line_android.h"
......@@ -112,7 +112,7 @@ bool LibraryLoaded(JNIEnv* env, jclass clazz) {
VLOG(0) << "Chromium logging enabled: level = " << logging::GetMinLogLevel()
<< ", default verbosity = " << logging::GetVlogVerbosity();
return EnsureJniRegistered(env);
return true;
}
} // namespace content
......@@ -2,27 +2,25 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_APP_ANDROID_LIBRARY_LOADER_HOOKS_H_
#define CONTENT_PUBLIC_APP_ANDROID_LIBRARY_LOADER_HOOKS_H_
#ifndef CONTENT_APP_ANDROID_LIBRARY_LOADER_HOOKS_H_
#define CONTENT_APP_ANDROID_LIBRARY_LOADER_HOOKS_H_
#include <jni.h>
#include "base/basictypes.h"
#include "content/common/content_export.h"
namespace content {
// Register all content JNI functions now, rather than waiting for the process
// of fully loading the native library to complete.
CONTENT_EXPORT bool EnsureJniRegistered(JNIEnv* env);
bool EnsureJniRegistered(JNIEnv* env);
// Do the intialization of content needed immediately after the native library
// has loaded.
// This is designed to be used as a hook function to be passed to
// base::android::SetLibraryLoadedHook
CONTENT_EXPORT bool LibraryLoaded(JNIEnv* env,
jclass clazz);
bool LibraryLoaded(JNIEnv* env, jclass clazz);
} // namespace content
#endif // CONTENT_PUBLIC_APP_ANDROID_LIBRARY_LOADER_HOOKS_H_
#endif // CONTENT_APP_ANDROID_LIBRARY_LOADER_HOOKS_H_
......@@ -26,11 +26,11 @@
'app/android/content_main.cc',
'app/android/content_main.h',
'app/android/library_loader_hooks.cc',
'app/android/library_loader_hooks.h',
'app/content_main.cc',
'app/content_main_runner.cc',
'app/mojo/mojo_init.cc',
'app/mojo/mojo_init.h',
'public/app/android_library_loader_hooks.h',
'public/app/content_jni_onload.h',
'public/app/content_main.h',
'public/app/content_main_delegate.cc',
......
......@@ -21,7 +21,6 @@
# //content/public/app:both_sources (source set)
public_app_shared_sources = [
"android_library_loader_hooks.h",
"content_jni_onload.h",
"content_main.h",
"content_main_delegate.cc",
......
......@@ -3,38 +3,45 @@
// found in the LICENSE file.
#include "base/android/jni_android.h"
#include "base/android/jni_registrar.h"
#include "base/android/library_loader/library_loader_hooks.h"
#include "base/basictypes.h"
#include "base/debug/debugger.h"
#include "base/logging.h"
#include "content/public/app/android_library_loader_hooks.h"
#include "base/android/jni_onload_delegate.h"
#include "content/public/app/content_jni_onload.h"
#include "content/public/app/content_main.h"
#include "content/public/browser/android/compositor.h"
#include "content/shell/android/linker_test_apk/chromium_linker_test_linker_tests.h"
#include "content/shell/android/shell_jni_registrar.h"
#include "content/shell/app/shell_main_delegate.h"
// This is called by the VM when the shared library is first loaded.
JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
namespace {
base::android::SetLibraryLoadedHook(&content::LibraryLoaded);
class ChromiumLinkerTestJNIOnLoadDelegate :
public base::android::JNIOnLoadDelegate {
public:
bool RegisterJNI(JNIEnv* env) override {
// To be called only from the UI thread. If loading the library is done on
// a separate thread, this should be moved elsewhere.
if (!content::android::RegisterShellJni(env))
return false;
base::android::InitVM(vm);
JNIEnv* env = base::android::AttachCurrentThread();
if (!content::RegisterLinkerTestsJni(env))
return false;
if (!base::android::RegisterLibraryLoaderEntryHook(env))
return -1;
return true;
}
// To be called only from the UI thread. If loading the library is done on
// a separate thread, this should be moved elsewhere.
if (!content::android::RegisterShellJni(env))
return -1;
bool Init() override {
content::Compositor::Initialize();
content::SetContentMainDelegate(new content::ShellMainDelegate());
return true;
}
};
if (!content::RegisterLinkerTestsJni(env))
} // namespace
// This is called by the VM when the shared library is first loaded.
JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
ChromiumLinkerTestJNIOnLoadDelegate delegate;
if (!content::android::OnJNIOnLoad(vm, &delegate))
return -1;
content::Compositor::Initialize();
content::SetContentMainDelegate(new content::ShellMainDelegate());
return JNI_VERSION_1_4;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment