This source file includes following definitions.
- EnsureJniRegistered
- LibraryLoaded
#include "content/public/app/android_library_loader_hooks.h"
#include "base/android/base_jni_registrar.h"
#include "base/android/command_line_android.h"
#include "base/android/jni_android.h"
#include "base/android/jni_registrar.h"
#include "base/android/jni_string.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/strings/string_util.h"
#include "base/tracked_objects.h"
#include "content/app/android/app_jni_registrar.h"
#include "content/browser/android/browser_jni_registrar.h"
#include "content/common/android/common_jni_registrar.h"
#include "content/common/content_constants_internal.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/result_codes.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"
#include "ui/gfx/android/gfx_jni_registrar.h"
#include "ui/gl/android/gl_jni_registrar.h"
#include "ui/shell_dialogs/android/shell_dialogs_jni_registrar.h"
namespace content {
bool EnsureJniRegistered(JNIEnv* env) {
static bool g_jni_init_done = false;
if (!g_jni_init_done) {
if (!base::android::RegisterJni(env))
return false;
if (!gfx::android::RegisterJni(env))
return false;
if (!net::android::RegisterJni(env))
return false;
if (!ui::android::RegisterJni(env))
return false;
if (!ui::gl::android::RegisterJni(env))
return false;
if (!ui::shell_dialogs::RegisterJni(env))
return false;
if (!content::android::RegisterCommonJni(env))
return false;
if (!content::android::RegisterBrowserJni(env))
return false;
if (!content::android::RegisterAppJni(env))
return false;
if (!media::RegisterJni(env))
return false;
g_jni_init_done = true;
}
return true;
}
bool LibraryLoaded(JNIEnv* env, jclass clazz,
jobjectArray init_command_line) {
base::android::InitNativeCommandLineFromJavaArray(env, init_command_line);
CommandLine* command_line = CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kTraceStartup)) {
base::debug::CategoryFilter category_filter(
command_line->GetSwitchValueASCII(switches::kTraceStartup));
base::debug::TraceLog::GetInstance()->SetEnabled(category_filter,
base::debug::TraceLog::RECORDING_MODE,
base::debug::TraceLog::RECORD_UNTIL_FULL);
}
TRACE_EVENT_BEGIN_ETW("BrowserMain", 0, "");
base::debug::TraceLog::GetInstance()->SetProcessName("Browser");
base::debug::TraceLog::GetInstance()->SetProcessSortIndex(
kTraceEventBrowserProcessSortIndex);
TRACE_EVENT0("jni", "JNI_OnLoad continuation");
logging::LoggingSettings settings;
settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
logging::InitLogging(settings);
logging::SetLogItems(false,
false,
false,
false);
VLOG(0) << "Chromium logging enabled: level = " << logging::GetMinLogLevel()
<< ", default verbosity = " << logging::GetVlogVerbosity();
return EnsureJniRegistered(env);
}
}