From 98f0da87fbd3ecabe89d5e8aba6f628d5a8e09ce Mon Sep 17 00:00:00 2001 From: zhuzhe Date: Tue, 8 May 2018 18:50:45 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9lynx->Core=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E6=9C=AA=E4=BF=AE=E6=94=B9README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 ++-- README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 37e5256f..0b77d813 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ .DS_Store .vscode/ -lynx/gen/ -lynx/gen/* +Core/gen/ +Core/gen/* node_modules/ layout_test/build/ lepus/build/ diff --git a/README.md b/README.md index a538a326..a62fb9d4 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Lynx选择了Vue.js作为开发框架,当然的利于Lynx的API设计,使用 ```shell $ cd lynx-native - $ ./lynx/build/prebuild.sh + $ ./Core/build/prebuild.sh ``` * 使用Android Studio打开`./Android`文件夹 From ff1bf4a2d66efc0bc2a3e16572c9afcf5a12e18f Mon Sep 17 00:00:00 2001 From: zhuzhe Date: Tue, 8 May 2018 18:51:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9lynx->Core=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E6=9C=AA=E4=BF=AE=E6=94=B9README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core/gen/CrdCommandExecutor_jni.h | 98 ------ Core/gen/DebugHostImpl_jni.h | 78 ----- Core/gen/GTestDriver_jni.h | 57 ---- Core/gen/LabelMeasurer_jni.h | 95 ------ Core/gen/LynxFunctionObject_jni.h | 109 ------- Core/gen/LynxRenderTreeHostImpl_jni.h | 146 --------- Core/gen/LynxRuntime_jni.h | 193 ------------ Core/gen/MethodRegisterUtil_jni.h | 64 ---- Core/gen/ParamsTransform_jni.h | 85 ----- Core/gen/RegisterUtil_jni.h | 71 ----- Core/gen/RenderObjectImpl_jni.h | 433 -------------------------- Core/gen/ResultCallback_jni.h | 59 ---- Core/gen/SystemMessageHandler_jni.h | 128 -------- Core/gen/URLRequest_jni.h | 144 --------- 14 files changed, 1760 deletions(-) delete mode 100644 Core/gen/CrdCommandExecutor_jni.h delete mode 100644 Core/gen/DebugHostImpl_jni.h delete mode 100644 Core/gen/GTestDriver_jni.h delete mode 100644 Core/gen/LabelMeasurer_jni.h delete mode 100644 Core/gen/LynxFunctionObject_jni.h delete mode 100644 Core/gen/LynxRenderTreeHostImpl_jni.h delete mode 100644 Core/gen/LynxRuntime_jni.h delete mode 100644 Core/gen/MethodRegisterUtil_jni.h delete mode 100644 Core/gen/ParamsTransform_jni.h delete mode 100644 Core/gen/RegisterUtil_jni.h delete mode 100644 Core/gen/RenderObjectImpl_jni.h delete mode 100644 Core/gen/ResultCallback_jni.h delete mode 100644 Core/gen/SystemMessageHandler_jni.h delete mode 100644 Core/gen/URLRequest_jni.h diff --git a/Core/gen/CrdCommandExecutor_jni.h b/Core/gen/CrdCommandExecutor_jni.h deleted file mode 100644 index 8359a4b4..00000000 --- a/Core/gen/CrdCommandExecutor_jni.h +++ /dev/null @@ -1,98 +0,0 @@ - -// This file is autogenerated by -// /Users/dli/Documents/lynx/lynx-native/lynx/build/jni_generator.py -// For -// com/lynx/ui/coordinator/CrdCommandExecutor - -#ifndef com_lynx_ui_coordinator_CrdCommandExecutor_JNI -#define com_lynx_ui_coordinator_CrdCommandExecutor_JNI - -#include - -#include "base/android/android_jni.h" - -// Step 1: forward declarations. -namespace { -const char kCrdCommandExecutorClassPath[] = - "com/lynx/ui/coordinator/CrdCommandExecutor"; -// Leaking this jclass as we cannot use LazyInstance from some threads. -jclass g_CrdCommandExecutor_clazz = NULL; -#define CrdCommandExecutor_clazz(env) g_CrdCommandExecutor_clazz - -} // namespace - -static jlong Prepare(JNIEnv* env, jclass jcaller, - jstring executable); - -static void Destroy(JNIEnv* env, jclass jcaller, - jlong ptr); - -static jobjectArray Execute(JNIEnv* env, jclass jcaller, - jlong ptr, - jstring method, - jstring tag, - jdoubleArray args); - -static jboolean UpdateProperty(JNIEnv* env, jclass jcaller, - jlong ptr, - jstring property, - jint type, - jstring value1, - jdouble value2, - jboolean value3); - -// Step 2: method stubs. - -// Step 3: RegisterNatives. - -static const JNINativeMethod kMethodsCrdCommandExecutor[] = { - { "nativePrepare", -"(" -"Ljava/lang/String;" -")" -"J", reinterpret_cast(Prepare) }, - { "nativeDestroy", -"(" -"J" -")" -"V", reinterpret_cast(Destroy) }, - { "nativeExecute", -"(" -"J" -"Ljava/lang/String;" -"Ljava/lang/String;" -"[D" -")" -"[Ljava/lang/Object;", reinterpret_cast(Execute) }, - { "nativeUpdateProperty", -"(" -"J" -"Ljava/lang/String;" -"I" -"Ljava/lang/String;" -"D" -"Z" -")" -"Z", reinterpret_cast(UpdateProperty) }, -}; - -static bool RegisterNativesImpl(JNIEnv* env) { - - g_CrdCommandExecutor_clazz = reinterpret_cast(env->NewGlobalRef( - base::android::GetClass(env, kCrdCommandExecutorClassPath).Get())); - - const int kMethodsCrdCommandExecutorSize = - sizeof(kMethodsCrdCommandExecutor)/sizeof(kMethodsCrdCommandExecutor[0]); - - if (env->RegisterNatives(CrdCommandExecutor_clazz(env), - kMethodsCrdCommandExecutor, - kMethodsCrdCommandExecutorSize) < 0) { - //jni_generator::HandleRegistrationError( - // env, CrdCommandExecutor_clazz(env), __FILE__); - return false; - } - - return true; -} - -#endif // com_lynx_ui_coordinator_CrdCommandExecutor_JNI diff --git a/Core/gen/DebugHostImpl_jni.h b/Core/gen/DebugHostImpl_jni.h deleted file mode 100644 index 804c1389..00000000 --- a/Core/gen/DebugHostImpl_jni.h +++ /dev/null @@ -1,78 +0,0 @@ - -// This file is autogenerated by -// /Users/dli/Documents/lynx/lynx-native/lynx/build/jni_generator.py -// For -// com/lynx/dev/DebugHostImpl - -#ifndef com_lynx_dev_DebugHostImpl_JNI -#define com_lynx_dev_DebugHostImpl_JNI - -#include - -#include "base/android/android_jni.h" - -// Step 1: forward declarations. -namespace { -const char kDebugHostImplClassPath[] = "com/lynx/dev/DebugHostImpl"; -// Leaking this jclass as we cannot use LazyInstance from some threads. -jclass g_DebugHostImpl_clazz = NULL; -#define DebugHostImpl_clazz(env) g_DebugHostImpl_clazz - -} // namespace - -static void Attach(JNIEnv* env, jobject jcaller); - -// Step 2: method stubs. - -static intptr_t g_DebugHostImpl_runDebug = 0; -static void Java_DebugHostImpl_runDebug(JNIEnv* env, jobject obj, int type) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // DebugHostImpl_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, DebugHostImpl_clazz(env), - base::android::INSTANCE_METHOD, - "runDebug", - -"(" -"I" -")" -"V", - &g_DebugHostImpl_runDebug); - - env->CallVoidMethod(obj, - method_id, int(type)); - base::android::CheckException(env); - -} - -// Step 3: RegisterNatives. - -static const JNINativeMethod kMethodsDebugHostImpl[] = { - { "nativeAttach", -"(" -")" -"V", reinterpret_cast(Attach) }, -}; - -static bool RegisterNativesImpl(JNIEnv* env) { - - g_DebugHostImpl_clazz = reinterpret_cast(env->NewGlobalRef( - base::android::GetClass(env, kDebugHostImplClassPath).Get())); - - const int kMethodsDebugHostImplSize = - sizeof(kMethodsDebugHostImpl)/sizeof(kMethodsDebugHostImpl[0]); - - if (env->RegisterNatives(DebugHostImpl_clazz(env), - kMethodsDebugHostImpl, - kMethodsDebugHostImplSize) < 0) { - //jni_generator::HandleRegistrationError( - // env, DebugHostImpl_clazz(env), __FILE__); - return false; - } - - return true; -} - -#endif // com_lynx_dev_DebugHostImpl_JNI diff --git a/Core/gen/GTestDriver_jni.h b/Core/gen/GTestDriver_jni.h deleted file mode 100644 index 9473253e..00000000 --- a/Core/gen/GTestDriver_jni.h +++ /dev/null @@ -1,57 +0,0 @@ - -// This file is autogenerated by -// /Users/dli/Documents/lynx/lynx-native/lynx/build/jni_generator.py -// For -// com/lynx/gtest/GTestDriver - -#ifndef com_lynx_gtest_GTestDriver_JNI -#define com_lynx_gtest_GTestDriver_JNI - -#include - -#include "base/android/android_jni.h" - -// Step 1: forward declarations. -namespace { -const char kGTestDriverClassPath[] = "com/lynx/gtest/GTestDriver"; -// Leaking this jclass as we cannot use LazyInstance from some threads. -jclass g_GTestDriver_clazz = NULL; -#define GTestDriver_clazz(env) g_GTestDriver_clazz - -} // namespace - -static jint RunGTestsNative(JNIEnv* env, jclass jcaller, - jobjectArray gtestCmdLineArgs); - -// Step 2: method stubs. - -// Step 3: RegisterNatives. - -static const JNINativeMethod kMethodsGTestDriver[] = { - { "nativeRunGTestsNative", -"(" -"[Ljava/lang/String;" -")" -"I", reinterpret_cast(RunGTestsNative) }, -}; - -static bool RegisterNativesImpl(JNIEnv* env) { - - g_GTestDriver_clazz = reinterpret_cast(env->NewGlobalRef( - base::android::GetClass(env, kGTestDriverClassPath).Get())); - - const int kMethodsGTestDriverSize = - sizeof(kMethodsGTestDriver)/sizeof(kMethodsGTestDriver[0]); - - if (env->RegisterNatives(GTestDriver_clazz(env), - kMethodsGTestDriver, - kMethodsGTestDriverSize) < 0) { - //jni_generator::HandleRegistrationError( - // env, GTestDriver_clazz(env), __FILE__); - return false; - } - - return true; -} - -#endif // com_lynx_gtest_GTestDriver_JNI diff --git a/Core/gen/LabelMeasurer_jni.h b/Core/gen/LabelMeasurer_jni.h deleted file mode 100644 index 8395a59a..00000000 --- a/Core/gen/LabelMeasurer_jni.h +++ /dev/null @@ -1,95 +0,0 @@ - -// This file is autogenerated by -// /Users/dli/Documents/lynx/lynx-native/lynx/build/jni_generator.py -// For -// com/lynx/core/LabelMeasurer - -#ifndef com_lynx_core_LabelMeasurer_JNI -#define com_lynx_core_LabelMeasurer_JNI - -#include - -#include "base/android/android_jni.h" - -// Step 1: forward declarations. -namespace { -const char kLabelMeasurerClassPath[] = "com/lynx/core/LabelMeasurer"; -// Leaking this jclass as we cannot use LazyInstance from some threads. -jclass g_LabelMeasurer_clazz = NULL; -#define LabelMeasurer_clazz(env) g_LabelMeasurer_clazz - -} // namespace - -// Step 2: method stubs. - -static intptr_t g_LabelMeasurer_getTextLayout = 0; -static base::android::ScopedLocalJavaRef - Java_LabelMeasurer_getTextLayout(JNIEnv* env) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, LabelMeasurer_clazz(env), - // LabelMeasurer_clazz(env), NULL); - jmethodID method_id = - base::android::GetMethod( - env, LabelMeasurer_clazz(env), - base::android::STATIC_METHOD, - "getTextLayout", - -"(" -")" -"Landroid/text/StaticLayout;", - &g_LabelMeasurer_getTextLayout); - - jobject ret = - env->CallStaticObjectMethod(LabelMeasurer_clazz(env), - method_id); - base::android::CheckException(env); - return base::android::ScopedLocalJavaRef(env, ret); -} - -static intptr_t g_LabelMeasurer_measureLabelSize = 0; -static base::android::ScopedLocalJavaRef - Java_LabelMeasurer_measureLabelSize(JNIEnv* env, jstring text, - jobject style, - int width, - int widthMode, - int height, - int heightMode) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, LabelMeasurer_clazz(env), - // LabelMeasurer_clazz(env), NULL); - jmethodID method_id = - base::android::GetMethod( - env, LabelMeasurer_clazz(env), - base::android::STATIC_METHOD, - "measureLabelSize", - -"(" -"Ljava/lang/String;" -"Lcom/lynx/base/Style;" -"I" -"I" -"I" -"I" -")" -"Lcom/lynx/base/Size;", - &g_LabelMeasurer_measureLabelSize); - - jobject ret = - env->CallStaticObjectMethod(LabelMeasurer_clazz(env), - method_id, text, style, int(width), int(widthMode), int(height), - int(heightMode)); - base::android::CheckException(env); - return base::android::ScopedLocalJavaRef(env, ret); -} - -// Step 3: RegisterNatives. - -static bool RegisterNativesImpl(JNIEnv* env) { - - g_LabelMeasurer_clazz = reinterpret_cast(env->NewGlobalRef( - base::android::GetClass(env, kLabelMeasurerClassPath).Get())); - - return true; -} - -#endif // com_lynx_core_LabelMeasurer_JNI diff --git a/Core/gen/LynxFunctionObject_jni.h b/Core/gen/LynxFunctionObject_jni.h deleted file mode 100644 index 8260e8af..00000000 --- a/Core/gen/LynxFunctionObject_jni.h +++ /dev/null @@ -1,109 +0,0 @@ - -// This file is autogenerated by -// /Users/dli/Documents/lynx/lynx-native/lynx/build/jni_generator.py -// For -// com/lynx/core/base/LynxFunctionObject - -#ifndef com_lynx_core_base_LynxFunctionObject_JNI -#define com_lynx_core_base_LynxFunctionObject_JNI - -#include - -#include "base/android/android_jni.h" - -// Step 1: forward declarations. -namespace { -const char kLynxFunctionObjectClassPath[] = - "com/lynx/core/base/LynxFunctionObject"; -// Leaking this jclass as we cannot use LazyInstance from some threads. -jclass g_LynxFunctionObject_clazz = NULL; -#define LynxFunctionObject_clazz(env) g_LynxFunctionObject_clazz - -} // namespace - -// Step 2: method stubs. - -static intptr_t g_LynxFunctionObject_getMethodNameArray = 0; -static base::android::ScopedLocalJavaRef - Java_LynxFunctionObject_getMethodNameArray(JNIEnv* env, jobject obj) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // LynxFunctionObject_clazz(env), NULL); - jmethodID method_id = - base::android::GetMethod( - env, LynxFunctionObject_clazz(env), - base::android::INSTANCE_METHOD, - "getMethodNameArray", - -"(" -")" -"Ljava/lang/Object;", - &g_LynxFunctionObject_getMethodNameArray); - - jobject ret = - env->CallObjectMethod(obj, - method_id); - base::android::CheckException(env); - return base::android::ScopedLocalJavaRef(env, ret); -} - -static intptr_t g_LynxFunctionObject_exec = 0; -static base::android::ScopedLocalJavaRef - Java_LynxFunctionObject_exec(JNIEnv* env, jobject obj, jstring methodName, - jobjectArray args) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // LynxFunctionObject_clazz(env), NULL); - jmethodID method_id = - base::android::GetMethod( - env, LynxFunctionObject_clazz(env), - base::android::INSTANCE_METHOD, - "exec", - -"(" -"Ljava/lang/String;" -"[Ljava/lang/Object;" -")" -"Ljava/lang/Object;", - &g_LynxFunctionObject_exec); - - jobject ret = - env->CallObjectMethod(obj, - method_id, methodName, args); - base::android::CheckException(env); - return base::android::ScopedLocalJavaRef(env, ret); -} - -static intptr_t g_LynxFunctionObject_destroy = 0; -static void Java_LynxFunctionObject_destroy(JNIEnv* env, jobject obj) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // LynxFunctionObject_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, LynxFunctionObject_clazz(env), - base::android::INSTANCE_METHOD, - "destroy", - -"(" -")" -"V", - &g_LynxFunctionObject_destroy); - - env->CallVoidMethod(obj, - method_id); - base::android::CheckException(env); - -} - -// Step 3: RegisterNatives. - -static bool RegisterNativesImpl(JNIEnv* env) { - - g_LynxFunctionObject_clazz = reinterpret_cast(env->NewGlobalRef( - base::android::GetClass(env, kLynxFunctionObjectClassPath).Get())); - - return true; -} - -#endif // com_lynx_core_base_LynxFunctionObject_JNI diff --git a/Core/gen/LynxRenderTreeHostImpl_jni.h b/Core/gen/LynxRenderTreeHostImpl_jni.h deleted file mode 100644 index 2310a331..00000000 --- a/Core/gen/LynxRenderTreeHostImpl_jni.h +++ /dev/null @@ -1,146 +0,0 @@ - -// This file is autogenerated by -// /Users/dli/Documents/lynx/lynx-native/lynx/build/jni_generator.py -// For -// com/lynx/core/tree/LynxRenderTreeHostImpl - -#ifndef com_lynx_core_tree_LynxRenderTreeHostImpl_JNI -#define com_lynx_core_tree_LynxRenderTreeHostImpl_JNI - -#include - -#include "base/android/android_jni.h" - -// Step 1: forward declarations. -namespace { -const char kLynxRenderTreeHostImplClassPath[] = - "com/lynx/core/tree/LynxRenderTreeHostImpl"; -// Leaking this jclass as we cannot use LazyInstance from some threads. -jclass g_LynxRenderTreeHostImpl_clazz = NULL; -#define LynxRenderTreeHostImpl_clazz(env) g_LynxRenderTreeHostImpl_clazz - -} // namespace - -static void UpdateViewport(JNIEnv* env, jobject jcaller, - jlong hostImpl, - jint left, - jint top, - jint right, - jint bottom); - -static void OnVSync(JNIEnv* env, jobject jcaller, - jlong hostImpl); - -// Step 2: method stubs. - -static intptr_t g_LynxRenderTreeHostImpl_beignFrame = 0; -static void Java_LynxRenderTreeHostImpl_beignFrame(JNIEnv* env, jobject obj) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // LynxRenderTreeHostImpl_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, LynxRenderTreeHostImpl_clazz(env), - base::android::INSTANCE_METHOD, - "beignFrame", - -"(" -")" -"V", - &g_LynxRenderTreeHostImpl_beignFrame); - - env->CallVoidMethod(obj, - method_id); - base::android::CheckException(env); - -} - -static intptr_t g_LynxRenderTreeHostImpl_prepareCommit = 0; -static void Java_LynxRenderTreeHostImpl_prepareCommit(JNIEnv* env, jobject obj) - { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // LynxRenderTreeHostImpl_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, LynxRenderTreeHostImpl_clazz(env), - base::android::INSTANCE_METHOD, - "prepareCommit", - -"(" -")" -"V", - &g_LynxRenderTreeHostImpl_prepareCommit); - - env->CallVoidMethod(obj, - method_id); - base::android::CheckException(env); - -} - -static intptr_t g_LynxRenderTreeHostImpl_create = 0; -static base::android::ScopedLocalJavaRef - Java_LynxRenderTreeHostImpl_create(JNIEnv* env, jlong hostImpl, - jobject root) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, LynxRenderTreeHostImpl_clazz(env), - // LynxRenderTreeHostImpl_clazz(env), NULL); - jmethodID method_id = - base::android::GetMethod( - env, LynxRenderTreeHostImpl_clazz(env), - base::android::STATIC_METHOD, - "create", - -"(" -"J" -"Ljava/lang/Object;" -")" -"Lcom/lynx/core/tree/LynxRenderTreeHostImpl;", - &g_LynxRenderTreeHostImpl_create); - - jobject ret = - env->CallStaticObjectMethod(LynxRenderTreeHostImpl_clazz(env), - method_id, hostImpl, root); - base::android::CheckException(env); - return base::android::ScopedLocalJavaRef(env, ret); -} - -// Step 3: RegisterNatives. - -static const JNINativeMethod kMethodsLynxRenderTreeHostImpl[] = { - { "nativeUpdateViewport", -"(" -"J" -"I" -"I" -"I" -"I" -")" -"V", reinterpret_cast(UpdateViewport) }, - { "nativeOnVSync", -"(" -"J" -")" -"V", reinterpret_cast(OnVSync) }, -}; - -static bool RegisterNativesImpl(JNIEnv* env) { - - g_LynxRenderTreeHostImpl_clazz = reinterpret_cast(env->NewGlobalRef( - base::android::GetClass(env, kLynxRenderTreeHostImplClassPath).Get())); - - const int kMethodsLynxRenderTreeHostImplSize = - sizeof(kMethodsLynxRenderTreeHostImpl)/sizeof(kMethodsLynxRenderTreeHostImpl[0]); - - if (env->RegisterNatives(LynxRenderTreeHostImpl_clazz(env), - kMethodsLynxRenderTreeHostImpl, - kMethodsLynxRenderTreeHostImplSize) < 0) { - //jni_generator::HandleRegistrationError( - // env, LynxRenderTreeHostImpl_clazz(env), __FILE__); - return false; - } - - return true; -} - -#endif // com_lynx_core_tree_LynxRenderTreeHostImpl_JNI diff --git a/Core/gen/LynxRuntime_jni.h b/Core/gen/LynxRuntime_jni.h deleted file mode 100644 index 6b38d6b7..00000000 --- a/Core/gen/LynxRuntime_jni.h +++ /dev/null @@ -1,193 +0,0 @@ - -// This file is autogenerated by -// /Users/dli/Documents/lynx/lynx-native/lynx/build/jni_generator.py -// For -// com/lynx/core/LynxRuntime - -#ifndef com_lynx_core_LynxRuntime_JNI -#define com_lynx_core_LynxRuntime_JNI - -#include - -#include "base/android/android_jni.h" - -// Step 1: forward declarations. -namespace { -const char kLynxRuntimeClassPath[] = "com/lynx/core/LynxRuntime"; -// Leaking this jclass as we cannot use LazyInstance from some threads. -jclass g_LynxRuntime_clazz = NULL; -#define LynxRuntime_clazz(env) g_LynxRuntime_clazz - -} // namespace - -static jboolean CheckMemoryEnabled(JNIEnv* env, jclass jcaller); - -static void CheckMemoryLeak(JNIEnv* env, jclass jcaller); - -static void InitGlobalConfig(JNIEnv* env, jclass jcaller, - jint screenWidthPx, - jint screenHeightPx, - jdouble density, - jint zoomRatioPx, - jstring deviceInfo); - -static jint CreateNativeJSRuntime(JNIEnv* env, jobject jcaller); - -static void DestroyNativeJSRuntime(JNIEnv* env, jobject jcaller, - jlong runtime); - -static void RunScript(JNIEnv* env, jobject jcaller, - jlong runtime, - jstring source, - jobject callback); - -static void LoadHTML(JNIEnv* env, jobject jcaller, - jlong runtime, - jstring url, - jstring source); - -static void LoadScriptDataWithBaseUrl(JNIEnv* env, jobject jcaller, - jlong runtime, - jstring source, - jstring url); - -static void LoadUrl(JNIEnv* env, jobject jcaller, - jlong runtime, - jstring url); - -static jobject InitRuntime(JNIEnv* env, jobject jcaller, - jlong runtime); - -static jstring GetPageURL(JNIEnv* env, jobject jcaller, - jlong runtime); - -static jstring GetUserAgent(JNIEnv* env, jobject jcaller, - jlong runtime); - -static void SetUserAgent(JNIEnv* env, jobject jcaller, - jlong runtime, - jstring ua); - -static void AddJavascriptInterface(JNIEnv* env, jobject jcaller, - jlong runtime, - jobject object, - jstring name); - -static void SetExceptionListner(JNIEnv* env, jobject jcaller, - jlong runtime, - jobject listener); - -// Step 2: method stubs. - -// Step 3: RegisterNatives. - -static const JNINativeMethod kMethodsLynxRuntime[] = { - { "nativeCheckMemoryEnabled", -"(" -")" -"Z", reinterpret_cast(CheckMemoryEnabled) }, - { "nativeCheckMemoryLeak", -"(" -")" -"V", reinterpret_cast(CheckMemoryLeak) }, - { "nativeInitGlobalConfig", -"(" -"I" -"I" -"D" -"I" -"Ljava/lang/String;" -")" -"V", reinterpret_cast(InitGlobalConfig) }, - { "nativeCreateNativeJSRuntime", -"(" -")" -"I", reinterpret_cast(CreateNativeJSRuntime) }, - { "nativeDestroyNativeJSRuntime", -"(" -"J" -")" -"V", reinterpret_cast(DestroyNativeJSRuntime) }, - { "nativeRunScript", -"(" -"J" -"Ljava/lang/String;" -"Ljava/lang/Object;" -")" -"V", reinterpret_cast(RunScript) }, - { "nativeLoadHTML", -"(" -"J" -"Ljava/lang/String;" -"Ljava/lang/String;" -")" -"V", reinterpret_cast(LoadHTML) }, - { "nativeLoadScriptDataWithBaseUrl", -"(" -"J" -"Ljava/lang/String;" -"Ljava/lang/String;" -")" -"V", reinterpret_cast(LoadScriptDataWithBaseUrl) }, - { "nativeLoadUrl", -"(" -"J" -"Ljava/lang/String;" -")" -"V", reinterpret_cast(LoadUrl) }, - { "nativeInitRuntime", -"(" -"J" -")" -"Ljava/lang/Object;", reinterpret_cast(InitRuntime) }, - { "nativeGetPageURL", -"(" -"J" -")" -"Ljava/lang/String;", reinterpret_cast(GetPageURL) }, - { "nativeGetUserAgent", -"(" -"J" -")" -"Ljava/lang/String;", reinterpret_cast(GetUserAgent) }, - { "nativeSetUserAgent", -"(" -"J" -"Ljava/lang/String;" -")" -"V", reinterpret_cast(SetUserAgent) }, - { "nativeAddJavascriptInterface", -"(" -"J" -"Lcom/lynx/core/base/LynxFunctionObject;" -"Ljava/lang/String;" -")" -"V", reinterpret_cast(AddJavascriptInterface) }, - { "nativeSetExceptionListner", -"(" -"J" -"Ljava/lang/Object;" -")" -"V", reinterpret_cast(SetExceptionListner) }, -}; - -static bool RegisterNativesImpl(JNIEnv* env) { - - g_LynxRuntime_clazz = reinterpret_cast(env->NewGlobalRef( - base::android::GetClass(env, kLynxRuntimeClassPath).Get())); - - const int kMethodsLynxRuntimeSize = - sizeof(kMethodsLynxRuntime)/sizeof(kMethodsLynxRuntime[0]); - - if (env->RegisterNatives(LynxRuntime_clazz(env), - kMethodsLynxRuntime, - kMethodsLynxRuntimeSize) < 0) { - //jni_generator::HandleRegistrationError( - // env, LynxRuntime_clazz(env), __FILE__); - return false; - } - - return true; -} - -#endif // com_lynx_core_LynxRuntime_JNI diff --git a/Core/gen/MethodRegisterUtil_jni.h b/Core/gen/MethodRegisterUtil_jni.h deleted file mode 100644 index 00b9e9ae..00000000 --- a/Core/gen/MethodRegisterUtil_jni.h +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2014 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. - -// This file is autogenerated by -// /Users/dli/Documents/lynx/lynx-native/lynx/build/jni_generator.py -// For -// com/lynx/utils/MethodRegisterUtil - -#ifndef com_lynx_utils_MethodRegisterUtil_JNI -#define com_lynx_utils_MethodRegisterUtil_JNI - -#include - -//#include "base/android/jni_int_wrapper.h" - -// Step 1: forward declarations. -namespace { -const char kMethodRegisterUtilClassPath[] = "com/lynx/utils/MethodRegisterUtil"; -// Leaking this jclass as we cannot use LazyInstance from some threads. -jclass g_MethodRegisterUtil_clazz = NULL; -#define MethodRegisterUtil_clazz(env) g_MethodRegisterUtil_clazz - -} // namespace - -static void RegisterJSMethod(JNIEnv* env, jclass jcaller, - jint type, - jstring methodName, - jint methodId); - -// Step 2: method stubs. - -// Step 3: RegisterNatives. - -static const JNINativeMethod kMethodsMethodRegisterUtil[] = { - { "nativeRegisterJSMethod", -"(" -"I" -"Ljava/lang/String;" -"I" -")" -"V", reinterpret_cast(RegisterJSMethod) }, -}; - -static bool RegisterNativesImpl(JNIEnv* env) { - - g_MethodRegisterUtil_clazz = reinterpret_cast(env->NewGlobalRef( - base::android::GetClass(env, kMethodRegisterUtilClassPath).Get())); - - const int kMethodsMethodRegisterUtilSize = - sizeof(kMethodsMethodRegisterUtil)/sizeof(kMethodsMethodRegisterUtil[0]); - - if (env->RegisterNatives(MethodRegisterUtil_clazz(env), - kMethodsMethodRegisterUtil, - kMethodsMethodRegisterUtilSize) < 0) { - //jni_generator::HandleRegistrationError( - // env, MethodRegisterUtil_clazz(env), __FILE__); - return false; - } - - return true; -} - -#endif // com_lynx_utils_MethodRegisterUtil_JNI diff --git a/Core/gen/ParamsTransform_jni.h b/Core/gen/ParamsTransform_jni.h deleted file mode 100644 index da462eb6..00000000 --- a/Core/gen/ParamsTransform_jni.h +++ /dev/null @@ -1,85 +0,0 @@ - -// This file is autogenerated by -// /Users/dli/Documents/lynx/lynx-native/lynx/build/jni_generator.py -// For -// com/lynx/core/base/ParamsTransform - -#ifndef com_lynx_core_base_ParamsTransform_JNI -#define com_lynx_core_base_ParamsTransform_JNI - -#include - -#include "base/android/android_jni.h" - -// Step 1: forward declarations. -namespace { -const char kParamsTransformClassPath[] = "com/lynx/core/base/ParamsTransform"; -// Leaking this jclass as we cannot use LazyInstance from some threads. -jclass g_ParamsTransform_clazz = NULL; -#define ParamsTransform_clazz(env) g_ParamsTransform_clazz - -} // namespace - -// Step 2: method stubs. - -static intptr_t g_ParamsTransform_transformJLS_LJLO = 0; -static base::android::ScopedLocalJavaRef - Java_ParamsTransform_transformJLS_LJLO(JNIEnv* env, jobjectArray params) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, ParamsTransform_clazz(env), - // ParamsTransform_clazz(env), NULL); - jmethodID method_id = - base::android::GetMethod( - env, ParamsTransform_clazz(env), - base::android::STATIC_METHOD, - "transform", - -"(" -"[Ljava/lang/Object;" -")" -"Ljava/lang/String;", - &g_ParamsTransform_transformJLS_LJLO); - - jstring ret = -static_cast(env->CallStaticObjectMethod(ParamsTransform_clazz(env), - method_id, params)); - base::android::CheckException(env); - return base::android::ScopedLocalJavaRef(env, ret); -} - -static intptr_t g_ParamsTransform_transformJLS_JLO = 0; -static base::android::ScopedLocalJavaRef - Java_ParamsTransform_transformJLS_JLO(JNIEnv* env, jobject param) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, ParamsTransform_clazz(env), - // ParamsTransform_clazz(env), NULL); - jmethodID method_id = - base::android::GetMethod( - env, ParamsTransform_clazz(env), - base::android::STATIC_METHOD, - "transform", - -"(" -"Ljava/lang/Object;" -")" -"Ljava/lang/String;", - &g_ParamsTransform_transformJLS_JLO); - - jstring ret = -static_cast(env->CallStaticObjectMethod(ParamsTransform_clazz(env), - method_id, param)); - base::android::CheckException(env); - return base::android::ScopedLocalJavaRef(env, ret); -} - -// Step 3: RegisterNatives. - -static bool RegisterNativesImpl(JNIEnv* env) { - - g_ParamsTransform_clazz = reinterpret_cast(env->NewGlobalRef( - base::android::GetClass(env, kParamsTransformClassPath).Get())); - - return true; -} - -#endif // com_lynx_core_base_ParamsTransform_JNI diff --git a/Core/gen/RegisterUtil_jni.h b/Core/gen/RegisterUtil_jni.h deleted file mode 100644 index 2b799cde..00000000 --- a/Core/gen/RegisterUtil_jni.h +++ /dev/null @@ -1,71 +0,0 @@ - -// This file is autogenerated by -// /Users/dli/Documents/lynx/lynx-native/lynx/build/jni_generator.py -// For -// com/lynx/utils/RegisterUtil - -#ifndef com_lynx_utils_RegisterUtil_JNI -#define com_lynx_utils_RegisterUtil_JNI - -#include - -#include "base/android/android_jni.h" - -// Step 1: forward declarations. -namespace { -const char kRegisterUtilClassPath[] = "com/lynx/utils/RegisterUtil"; -// Leaking this jclass as we cannot use LazyInstance from some threads. -jclass g_RegisterUtil_clazz = NULL; -#define RegisterUtil_clazz(env) g_RegisterUtil_clazz - -} // namespace - -static void RegisterTag(JNIEnv* env, jclass jcaller, - jint type, - jstring tagName); - -static void RegisterJSMethod(JNIEnv* env, jclass jcaller, - jint type, - jstring methodName, - jint methodId); - -// Step 2: method stubs. - -// Step 3: RegisterNatives. - -static const JNINativeMethod kMethodsRegisterUtil[] = { - { "nativeRegisterTag", -"(" -"I" -"Ljava/lang/String;" -")" -"V", reinterpret_cast(RegisterTag) }, - { "nativeRegisterJSMethod", -"(" -"I" -"Ljava/lang/String;" -"I" -")" -"V", reinterpret_cast(RegisterJSMethod) }, -}; - -static bool RegisterNativesImpl(JNIEnv* env) { - - g_RegisterUtil_clazz = reinterpret_cast(env->NewGlobalRef( - base::android::GetClass(env, kRegisterUtilClassPath).Get())); - - const int kMethodsRegisterUtilSize = - sizeof(kMethodsRegisterUtil)/sizeof(kMethodsRegisterUtil[0]); - - if (env->RegisterNatives(RegisterUtil_clazz(env), - kMethodsRegisterUtil, - kMethodsRegisterUtilSize) < 0) { - //jni_generator::HandleRegistrationError( - // env, RegisterUtil_clazz(env), __FILE__); - return false; - } - - return true; -} - -#endif // com_lynx_utils_RegisterUtil_JNI diff --git a/Core/gen/RenderObjectImpl_jni.h b/Core/gen/RenderObjectImpl_jni.h deleted file mode 100644 index 1f3ad9e1..00000000 --- a/Core/gen/RenderObjectImpl_jni.h +++ /dev/null @@ -1,433 +0,0 @@ - -// This file is autogenerated by -// /Users/dli/Documents/lynx/lynx-native/lynx/build/jni_generator.py -// For -// com/lynx/core/impl/RenderObjectImpl - -#ifndef com_lynx_core_impl_RenderObjectImpl_JNI -#define com_lynx_core_impl_RenderObjectImpl_JNI - -#include - -#include "base/android/android_jni.h" - -// Step 1: forward declarations. -namespace { -const char kRenderObjectImplClassPath[] = "com/lynx/core/impl/RenderObjectImpl"; -// Leaking this jclass as we cannot use LazyInstance from some threads. -jclass g_RenderObjectImpl_clazz = NULL; -#define RenderObjectImpl_clazz(env) g_RenderObjectImpl_clazz - -} // namespace - -static void DispatchEvent(JNIEnv* env, jobject jcaller, - jlong nativePtr, - jstring event, - jobjectArray params); - -static void UpdateData(JNIEnv* env, jobject jcaller, - jlong nativePtr, - jint attr, - jobject param); - -static void FreeJavaRef(JNIEnv* env, jobject jcaller, - jlong nativePtr); - -static void ConstructJavaRef(JNIEnv* env, jobject jcaller, - jlong mNativePtr, - jobject object); - -// Step 2: method stubs. - -static intptr_t g_RenderObjectImpl_insertChild = 0; -static void Java_RenderObjectImpl_insertChild(JNIEnv* env, jobject obj, jobject - child, - int index) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // RenderObjectImpl_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, RenderObjectImpl_clazz(env), - base::android::INSTANCE_METHOD, - "insertChild", - -"(" -"Lcom/lynx/core/impl/RenderObjectImpl;" -"I" -")" -"V", - &g_RenderObjectImpl_insertChild); - - env->CallVoidMethod(obj, - method_id, child, int(index)); - base::android::CheckException(env); - -} - -static intptr_t g_RenderObjectImpl_removeChild = 0; -static void Java_RenderObjectImpl_removeChild(JNIEnv* env, jobject obj, jobject - child) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // RenderObjectImpl_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, RenderObjectImpl_clazz(env), - base::android::INSTANCE_METHOD, - "removeChild", - -"(" -"Lcom/lynx/core/impl/RenderObjectImpl;" -")" -"V", - &g_RenderObjectImpl_removeChild); - - env->CallVoidMethod(obj, - method_id, child); - base::android::CheckException(env); - -} - -static intptr_t g_RenderObjectImpl_requestLayout = 0; -static void Java_RenderObjectImpl_requestLayout(JNIEnv* env, jobject obj) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // RenderObjectImpl_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, RenderObjectImpl_clazz(env), - base::android::INSTANCE_METHOD, - "requestLayout", - -"(" -")" -"V", - &g_RenderObjectImpl_requestLayout); - - env->CallVoidMethod(obj, - method_id); - base::android::CheckException(env); - -} - -static intptr_t g_RenderObjectImpl_setText = 0; -static void Java_RenderObjectImpl_setText(JNIEnv* env, jobject obj, jstring - text) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // RenderObjectImpl_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, RenderObjectImpl_clazz(env), - base::android::INSTANCE_METHOD, - "setText", - -"(" -"Ljava/lang/String;" -")" -"V", - &g_RenderObjectImpl_setText); - - env->CallVoidMethod(obj, - method_id, text); - base::android::CheckException(env); - -} - -static intptr_t g_RenderObjectImpl_setPosition = 0; -static void Java_RenderObjectImpl_setPosition(JNIEnv* env, jobject obj, jobject - position) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // RenderObjectImpl_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, RenderObjectImpl_clazz(env), - base::android::INSTANCE_METHOD, - "setPosition", - -"(" -"Lcom/lynx/base/Position;" -")" -"V", - &g_RenderObjectImpl_setPosition); - - env->CallVoidMethod(obj, - method_id, position); - base::android::CheckException(env); - -} - -static intptr_t g_RenderObjectImpl_setSize = 0; -static void Java_RenderObjectImpl_setSize(JNIEnv* env, jobject obj, jobject - size) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // RenderObjectImpl_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, RenderObjectImpl_clazz(env), - base::android::INSTANCE_METHOD, - "setSize", - -"(" -"Lcom/lynx/base/Size;" -")" -"V", - &g_RenderObjectImpl_setSize); - - env->CallVoidMethod(obj, - method_id, size); - base::android::CheckException(env); - -} - -static intptr_t g_RenderObjectImpl_updateStyle = 0; -static void Java_RenderObjectImpl_updateStyle(JNIEnv* env, jobject obj, jobject - style) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // RenderObjectImpl_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, RenderObjectImpl_clazz(env), - base::android::INSTANCE_METHOD, - "updateStyle", - -"(" -"Lcom/lynx/base/Style;" -")" -"V", - &g_RenderObjectImpl_updateStyle); - - env->CallVoidMethod(obj, - method_id, style); - base::android::CheckException(env); - -} - -static intptr_t g_RenderObjectImpl_setAttribute = 0; -static void Java_RenderObjectImpl_setAttribute(JNIEnv* env, jobject obj, jstring - key, - jstring value) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // RenderObjectImpl_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, RenderObjectImpl_clazz(env), - base::android::INSTANCE_METHOD, - "setAttribute", - -"(" -"Ljava/lang/String;" -"Ljava/lang/String;" -")" -"V", - &g_RenderObjectImpl_setAttribute); - - env->CallVoidMethod(obj, - method_id, key, value); - base::android::CheckException(env); - -} - -static intptr_t g_RenderObjectImpl_addEventListener = 0; -static void Java_RenderObjectImpl_addEventListener(JNIEnv* env, jobject obj, - jstring event) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // RenderObjectImpl_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, RenderObjectImpl_clazz(env), - base::android::INSTANCE_METHOD, - "addEventListener", - -"(" -"Ljava/lang/String;" -")" -"V", - &g_RenderObjectImpl_addEventListener); - - env->CallVoidMethod(obj, - method_id, event); - base::android::CheckException(env); - -} - -static intptr_t g_RenderObjectImpl_removeEventListener = 0; -static void Java_RenderObjectImpl_removeEventListener(JNIEnv* env, jobject obj, - jstring event) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // RenderObjectImpl_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, RenderObjectImpl_clazz(env), - base::android::INSTANCE_METHOD, - "removeEventListener", - -"(" -"Ljava/lang/String;" -")" -"V", - &g_RenderObjectImpl_removeEventListener); - - env->CallVoidMethod(obj, - method_id, event); - base::android::CheckException(env); - -} - -static intptr_t g_RenderObjectImpl_setData = 0; -static void Java_RenderObjectImpl_setData(JNIEnv* env, jobject obj, int key, - jobject data) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // RenderObjectImpl_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, RenderObjectImpl_clazz(env), - base::android::INSTANCE_METHOD, - "setData", - -"(" -"I" -"Ljava/lang/Object;" -")" -"V", - &g_RenderObjectImpl_setData); - - env->CallVoidMethod(obj, - method_id, int(key), data); - base::android::CheckException(env); - -} - -static intptr_t g_RenderObjectImpl_animate = 0; -static void Java_RenderObjectImpl_animate(JNIEnv* env, jobject obj, jobject - keyframes, - jobject options) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // RenderObjectImpl_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, RenderObjectImpl_clazz(env), - base::android::INSTANCE_METHOD, - "animate", - -"(" -"Lcom/lynx/core/base/LynxArray;" -"Lcom/lynx/core/base/LynxObject;" -")" -"V", - &g_RenderObjectImpl_animate); - - env->CallVoidMethod(obj, - method_id, keyframes, options); - base::android::CheckException(env); - -} - -static intptr_t g_RenderObjectImpl_cancelAnimation = 0; -static void Java_RenderObjectImpl_cancelAnimation(JNIEnv* env, jobject obj) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // RenderObjectImpl_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, RenderObjectImpl_clazz(env), - base::android::INSTANCE_METHOD, - "cancelAnimation", - -"(" -")" -"V", - &g_RenderObjectImpl_cancelAnimation); - - env->CallVoidMethod(obj, - method_id); - base::android::CheckException(env); - -} - -static intptr_t g_RenderObjectImpl_create = 0; -static base::android::ScopedLocalJavaRef - Java_RenderObjectImpl_create(JNIEnv* env, int type, - jlong ptr) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, RenderObjectImpl_clazz(env), - // RenderObjectImpl_clazz(env), NULL); - jmethodID method_id = - base::android::GetMethod( - env, RenderObjectImpl_clazz(env), - base::android::STATIC_METHOD, - "create", - -"(" -"I" -"J" -")" -"Lcom/lynx/core/impl/RenderObjectImpl;", - &g_RenderObjectImpl_create); - - jobject ret = - env->CallStaticObjectMethod(RenderObjectImpl_clazz(env), - method_id, int(type), ptr); - base::android::CheckException(env); - return base::android::ScopedLocalJavaRef(env, ret); -} - -// Step 3: RegisterNatives. - -static const JNINativeMethod kMethodsRenderObjectImpl[] = { - { "nativeDispatchEvent", -"(" -"J" -"Ljava/lang/String;" -"[Ljava/lang/Object;" -")" -"V", reinterpret_cast(DispatchEvent) }, - { "nativeUpdateData", -"(" -"J" -"I" -"Ljava/lang/Object;" -")" -"V", reinterpret_cast(UpdateData) }, - { "nativeFreeJavaRef", -"(" -"J" -")" -"V", reinterpret_cast(FreeJavaRef) }, - { "nativeConstructJavaRef", -"(" -"J" -"Ljava/lang/Object;" -")" -"V", reinterpret_cast(ConstructJavaRef) }, -}; - -static bool RegisterNativesImpl(JNIEnv* env) { - - g_RenderObjectImpl_clazz = reinterpret_cast(env->NewGlobalRef( - base::android::GetClass(env, kRenderObjectImplClassPath).Get())); - - const int kMethodsRenderObjectImplSize = - sizeof(kMethodsRenderObjectImpl)/sizeof(kMethodsRenderObjectImpl[0]); - - if (env->RegisterNatives(RenderObjectImpl_clazz(env), - kMethodsRenderObjectImpl, - kMethodsRenderObjectImplSize) < 0) { - //jni_generator::HandleRegistrationError( - // env, RenderObjectImpl_clazz(env), __FILE__); - return false; - } - - return true; -} - -#endif // com_lynx_core_impl_RenderObjectImpl_JNI diff --git a/Core/gen/ResultCallback_jni.h b/Core/gen/ResultCallback_jni.h deleted file mode 100644 index 8f76ac35..00000000 --- a/Core/gen/ResultCallback_jni.h +++ /dev/null @@ -1,59 +0,0 @@ - -// This file is autogenerated by -// /Users/dli/Documents/lynx/lynx-native/lynx/build/jni_generator.py -// For -// com/lynx/core/ResultCallback - -#ifndef com_lynx_core_ResultCallback_JNI -#define com_lynx_core_ResultCallback_JNI - -#include - -#include "base/android/android_jni.h" - -// Step 1: forward declarations. -namespace { -const char kResultCallbackClassPath[] = "com/lynx/core/ResultCallback"; -// Leaking this jclass as we cannot use LazyInstance from some threads. -jclass g_ResultCallback_clazz = NULL; -#define ResultCallback_clazz(env) g_ResultCallback_clazz - -} // namespace - -// Step 2: method stubs. - -static intptr_t g_ResultCallback_onReceiveResult = 0; -static void Java_ResultCallback_onReceiveResult(JNIEnv* env, jobject obj, - jobject result) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // ResultCallback_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, ResultCallback_clazz(env), - base::android::INSTANCE_METHOD, - "onReceiveResult", - -"(" -"Ljava/lang/Object;" -")" -"V", - &g_ResultCallback_onReceiveResult); - - env->CallVoidMethod(obj, - method_id, result); - base::android::CheckException(env); - -} - -// Step 3: RegisterNatives. - -static bool RegisterNativesImpl(JNIEnv* env) { - - g_ResultCallback_clazz = reinterpret_cast(env->NewGlobalRef( - base::android::GetClass(env, kResultCallbackClassPath).Get())); - - return true; -} - -#endif // com_lynx_core_ResultCallback_JNI diff --git a/Core/gen/SystemMessageHandler_jni.h b/Core/gen/SystemMessageHandler_jni.h deleted file mode 100644 index 0ae3e539..00000000 --- a/Core/gen/SystemMessageHandler_jni.h +++ /dev/null @@ -1,128 +0,0 @@ - -// This file is autogenerated by -// /Users/dli/Documents/lynx/lynx-native/lynx/build/jni_generator.py -// For -// com/lynx/base/SystemMessageHandler - -#ifndef com_lynx_base_SystemMessageHandler_JNI -#define com_lynx_base_SystemMessageHandler_JNI - -#include - -#include "base/android/android_jni.h" - -// Step 1: forward declarations. -namespace { -const char kSystemMessageHandlerClassPath[] = - "com/lynx/base/SystemMessageHandler"; -// Leaking this jclass as we cannot use LazyInstance from some threads. -jclass g_SystemMessageHandler_clazz = NULL; -#define SystemMessageHandler_clazz(env) g_SystemMessageHandler_clazz - -} // namespace - -static void RunWork(JNIEnv* env, jobject jcaller, - jlong delegateNative); - -// Step 2: method stubs. - -static intptr_t g_SystemMessageHandler_create = 0; -static base::android::ScopedLocalJavaRef - Java_SystemMessageHandler_create(JNIEnv* env, jlong - messagePumpDelegateNative) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, SystemMessageHandler_clazz(env), - // SystemMessageHandler_clazz(env), NULL); - jmethodID method_id = - base::android::GetMethod( - env, SystemMessageHandler_clazz(env), - base::android::STATIC_METHOD, - "create", - -"(" -"J" -")" -"Lcom/lynx/base/SystemMessageHandler;", - &g_SystemMessageHandler_create); - - jobject ret = - env->CallStaticObjectMethod(SystemMessageHandler_clazz(env), - method_id, messagePumpDelegateNative); - base::android::CheckException(env); - return base::android::ScopedLocalJavaRef(env, ret); -} - -static intptr_t g_SystemMessageHandler_scheduleWork = 0; -static void Java_SystemMessageHandler_scheduleWork(JNIEnv* env, jobject obj) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // SystemMessageHandler_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, SystemMessageHandler_clazz(env), - base::android::INSTANCE_METHOD, - "scheduleWork", - -"(" -")" -"V", - &g_SystemMessageHandler_scheduleWork); - - env->CallVoidMethod(obj, - method_id); - base::android::CheckException(env); - -} - -static intptr_t g_SystemMessageHandler_stop = 0; -static void Java_SystemMessageHandler_stop(JNIEnv* env, jobject obj) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // SystemMessageHandler_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, SystemMessageHandler_clazz(env), - base::android::INSTANCE_METHOD, - "stop", - -"(" -")" -"V", - &g_SystemMessageHandler_stop); - - env->CallVoidMethod(obj, - method_id); - base::android::CheckException(env); - -} - -// Step 3: RegisterNatives. - -static const JNINativeMethod kMethodsSystemMessageHandler[] = { - { "nativeRunWork", -"(" -"J" -")" -"V", reinterpret_cast(RunWork) }, -}; - -static bool RegisterNativesImpl(JNIEnv* env) { - - g_SystemMessageHandler_clazz = reinterpret_cast(env->NewGlobalRef( - base::android::GetClass(env, kSystemMessageHandlerClassPath).Get())); - - const int kMethodsSystemMessageHandlerSize = - sizeof(kMethodsSystemMessageHandler)/sizeof(kMethodsSystemMessageHandler[0]); - - if (env->RegisterNatives(SystemMessageHandler_clazz(env), - kMethodsSystemMessageHandler, - kMethodsSystemMessageHandlerSize) < 0) { - //jni_generator::HandleRegistrationError( - // env, SystemMessageHandler_clazz(env), __FILE__); - return false; - } - - return true; -} - -#endif // com_lynx_base_SystemMessageHandler_JNI diff --git a/Core/gen/URLRequest_jni.h b/Core/gen/URLRequest_jni.h deleted file mode 100644 index bd117628..00000000 --- a/Core/gen/URLRequest_jni.h +++ /dev/null @@ -1,144 +0,0 @@ - -// This file is autogenerated by -// /Users/dli/Documents/lynx/lynx-native/lynx/build/jni_generator.py -// For -// com/lynx/base/URLRequest - -#ifndef com_lynx_base_URLRequest_JNI -#define com_lynx_base_URLRequest_JNI - -#include - -#include "base/android/android_jni.h" - -// Step 1: forward declarations. -namespace { -const char kURLRequestClassPath[] = "com/lynx/base/URLRequest"; -// Leaking this jclass as we cannot use LazyInstance from some threads. -jclass g_URLRequest_clazz = NULL; -#define URLRequest_clazz(env) g_URLRequest_clazz - -} // namespace - -static void OnSuccess(JNIEnv* env, jobject jcaller, - jlong ptr, - jstring url, - jstring response); - -static void OnFailed(JNIEnv* env, jobject jcaller, - jlong ptr, - jstring url, - jstring error); - -// Step 2: method stubs. - -static intptr_t g_URLRequest_create = 0; -static base::android::ScopedLocalJavaRef Java_URLRequest_create(JNIEnv* - env, jstring url, - jlong delegate) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, URLRequest_clazz(env), - // URLRequest_clazz(env), NULL); - jmethodID method_id = - base::android::GetMethod( - env, URLRequest_clazz(env), - base::android::STATIC_METHOD, - "create", - -"(" -"Ljava/lang/String;" -"J" -")" -"Lcom/lynx/base/URLRequest;", - &g_URLRequest_create); - - jobject ret = - env->CallStaticObjectMethod(URLRequest_clazz(env), - method_id, url, delegate); - base::android::CheckException(env); - return base::android::ScopedLocalJavaRef(env, ret); -} - -static intptr_t g_URLRequest_fetch = 0; -static void Java_URLRequest_fetch(JNIEnv* env, jobject obj) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // URLRequest_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, URLRequest_clazz(env), - base::android::INSTANCE_METHOD, - "fetch", - -"(" -")" -"V", - &g_URLRequest_fetch); - - env->CallVoidMethod(obj, - method_id); - base::android::CheckException(env); - -} - -static intptr_t g_URLRequest_cancel = 0; -static void Java_URLRequest_cancel(JNIEnv* env, jobject obj) { - /* Must call RegisterNativesImpl() */ - //CHECK_CLAZZ(env, obj, - // URLRequest_clazz(env)); - jmethodID method_id = - base::android::GetMethod( - env, URLRequest_clazz(env), - base::android::INSTANCE_METHOD, - "cancel", - -"(" -")" -"V", - &g_URLRequest_cancel); - - env->CallVoidMethod(obj, - method_id); - base::android::CheckException(env); - -} - -// Step 3: RegisterNatives. - -static const JNINativeMethod kMethodsURLRequest[] = { - { "nativeOnSuccess", -"(" -"J" -"Ljava/lang/String;" -"Ljava/lang/String;" -")" -"V", reinterpret_cast(OnSuccess) }, - { "nativeOnFailed", -"(" -"J" -"Ljava/lang/String;" -"Ljava/lang/String;" -")" -"V", reinterpret_cast(OnFailed) }, -}; - -static bool RegisterNativesImpl(JNIEnv* env) { - - g_URLRequest_clazz = reinterpret_cast(env->NewGlobalRef( - base::android::GetClass(env, kURLRequestClassPath).Get())); - - const int kMethodsURLRequestSize = - sizeof(kMethodsURLRequest)/sizeof(kMethodsURLRequest[0]); - - if (env->RegisterNatives(URLRequest_clazz(env), - kMethodsURLRequest, - kMethodsURLRequestSize) < 0) { - //jni_generator::HandleRegistrationError( - // env, URLRequest_clazz(env), __FILE__); - return false; - } - - return true; -} - -#endif // com_lynx_base_URLRequest_JNI