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

Unified Diff: base/android/library_loader/library_loader_hooks.h

Issue 141223002: Move the android library loader from content to base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 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: base/android/library_loader/library_loader_hooks.h
diff --git a/base/android/library_loader/library_loader_hooks.h b/base/android/library_loader/library_loader_hooks.h
new file mode 100644
index 0000000000000000000000000000000000000000..35da41d4cc37e762e7f1969812822916e99a7f13
--- /dev/null
+++ b/base/android/library_loader/library_loader_hooks.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2012 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.
+
+#ifndef BASE_ANDROID_LIBRARY_LOADER_HOOKS_H_
+#define BASE_ANDROID_LIBRARY_LOADER_HOOKS_H_
+
+#include <jni.h>
+
+namespace base {
+namespace android {
+
+// Registers the callbacks that allows the entry point of the library to be
+// exposed to the calling java code. This handles only registering the content
+// specific callbacks. Any application specific JNI bindings should happen
+// once the native library has fully loaded.
+bool RegisterLibraryLoaderEntryHook(JNIEnv* env);
+
+// Typedef for hook function to be called (indirectly from Java) once the
+// libraries are loaded. The hook function should register the JNI bindings
+// required to start the application. It should return true for success and
+// false for failure.
+// Note: this can't use base::Callback because there is no way of initializing
+// the default callback without using static objects, which we forbid.
+typedef bool LibraryLoaderHook(JNIEnv* env,
+ jclass clazz, jobjectArray init_command_line);
+
+// Set the hook function to be called (from Java) once the libraries are loaded.
+// SetLibraryLoadedHook may only be called from JNI_OnLoad. The hook function
+// should register the JNI bindings required to start the application.
+
+void SetLibraryLoadedHook(LibraryLoaderHook* func);
+
+// Pass the version name to Content. This used to check that the library version
+// matches the version expected by Java before completing JNI registration.
+// Note: argument must remain valid at least until library loading is complete.
+void SetVersionNumber(const char* version_number);
+
+// Call on exit to delete the AtExitManager which OnLibraryLoadedOnUIThread
+// created.
+void LibraryLoaderExitHook();
+
+} // namespace android
+} // namespace base
+
+#endif // BASE_ANDROID_LIBRARY_LOADER_HOOKS_H_

Powered by Google App Engine
This is Rietveld 408576698