draw_gl_functor.cpp中定义了全局函数:
void SetChromiumAwDrawGLFunction() {
g_aw_drawgl_function = reinterpret_cast(draw_function);
}
设置给draw_gl_functor.cpp的全局变量g_aw_drawgl_function的是AwContents.java中
nativeGetAwDrawGLFunction()返回的函数标识。
我们看AwContents.java::nativeGetAwDrawGLFunction()得到的具体是那个函数。
aw_contents.cc
static jint GetAwDrawGLFunction(JNIEnv* env, jclass) {
return reinterpret_cast(&DrawGLFunction);
}
aw_contents.cc中定义了全局的函数指针变量DrawGLFunction:
extern "C" {
static AwDrawGLFunction DrawGLFunction;
static void DrawGLFunction(int view_context,
AwDrawGLInfo* draw_info,
void* spare) {
// |view_context| is the value that was returned from the java
// AwContents.onPrepareDrawGL; this cast must match the code there.
reinterpret_cast<:browserviewrenderer>(view_context)->DrawGL(
draw_info);
}
}
所以aw_contents.cc中GetAwDrawGLFunction()得到的是
android_webview::InProcessViewRenderer::DrawGL()的函数地址。
设置给draw_gl_functor.cpp的全局变量g_aw_drawgl_function的就是