android_library_loader_hooks.h revision a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7
15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CONTENT_PUBLIC_APP_ANDROID_LIBRARY_LOADER_HOOKS_H_ 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CONTENT_PUBLIC_APP_ANDROID_LIBRARY_LOADER_HOOKS_H_ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <jni.h> 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/basictypes.h" 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/common/content_export.h" 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace content { 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Registers the callbacks that allows the entry point of the library to be 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// exposed to the calling java code. This handles only registering the content 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// specific callbacks. Any application specific JNI bindings should happen 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// once the native library has fully loaded. 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)CONTENT_EXPORT bool RegisterLibraryLoaderEntryHook(JNIEnv* env); 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Register all content JNI functions now, rather than waiting for the process 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// of fully loading the native library to complete. This must only be called 235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// during JNI_OnLoad. 245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)CONTENT_EXPORT bool EnsureJniRegistered(JNIEnv* env); 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Pass the version name to Content. This used to check that the library version 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// matches the version expected by Java before completing JNI registration. 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Note: argument must remain valid at least until library loading is complete. 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)CONTENT_EXPORT void SetVersionNumber(const char* version_number); 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Call on exit to delete the AtExitManager which OnLibraryLoadedOnUIThread 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// created. 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)CONTENT_EXPORT void LibraryLoaderExitHook(); 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace content 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // CONTENT_PUBLIC_APP_ANDROID_LIBRARY_LOADER_HOOKS_H_ 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)