Question

I'm trying to modify chromium on android for research purposes.

Chromium comes with a ContentViewCore.java class. This class calls a native function:

nativeEvaluateJavaScript(mNativeContentViewCore, script, null, true);

This method is defined in the same class as follows:

private native void nativeEvaluateJavaScript(long nativeContentViewCoreImpl,
        String script, JavaScriptCallback callback, boolean startRenderer);

The class has the following annotation:

@JNINamespace("content")

As I understand it, the JNI Generator links these methods to the correct native (c++) methods of the correct class.

My question: To which class is ContentViewCore.java linked? Where can I find the implementation of nativeEvaluateJavaScript? Where is it defined that a specific java class is linked to a specific c++ class?

The only thing I can find is content_view_core.h (src/content/public/browser/android), but that file doesn't get me any further. Googeling for 'nativeEvaluateJavaScript' revealed nothing. I've been searching for about 10 hours now and I'm not getting any closer.

Was it helpful?

Solution

The JNI generator will generate JNI binding file under "(SHARED_INTERMEDIATE_DIR)/<(jni_gen_package)/jni/" during the build time.

For example, the corresponding JNI binding file for ContentViewCore.java is "out/Debug/gen/content/jni/ContentViewCore_jni.h". And you can see the native method of 'nativeEvaluateJavaScript':

static void EvaluateJavaScript(JNIEnv* env, jobject jcaller,...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top