You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ky...@apache.org on 2018/05/16 08:42:44 UTC
[1/2] incubator-weex git commit: [WEEX-368][Android] Turn single
process switch on
Repository: incubator-weex
Updated Branches:
refs/heads/master 947767b4c -> aef41c82f
[WEEX-368][Android] Turn single process switch on
Turn single process switch on for jsengine.
Make it can run on single process
Bug: WEEX-368
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/8e3b224e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/8e3b224e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/8e3b224e
Branch: refs/heads/master
Commit: 8e3b224ee16637efab58ec43d85f4ab54f897bd1
Parents: 947767b
Author: 东煜 <ya...@alibaba-inc.com>
Authored: Tue May 15 20:42:53 2018 +0800
Committer: 东煜 <ya...@alibaba-inc.com>
Committed: Wed May 16 15:53:32 2018 +0800
----------------------------------------------------------------------
android/sdk/libs/armeabi-v7a/libweexjss.so | Bin 6801432 -> 3758900 bytes
android/sdk/libs/armeabi/libweexjss.so | Bin 3758900 -> 3758900 bytes
.../android/jsengine/multiprocess/WeexProxy.cpp | 90 +++++++++++--------
.../android/jsengine/multiprocess/WeexProxy.h | 5 +-
4 files changed, 57 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8e3b224e/android/sdk/libs/armeabi-v7a/libweexjss.so
----------------------------------------------------------------------
diff --git a/android/sdk/libs/armeabi-v7a/libweexjss.so b/android/sdk/libs/armeabi-v7a/libweexjss.so
index dcd78cc..933bc35 100755
Binary files a/android/sdk/libs/armeabi-v7a/libweexjss.so and b/android/sdk/libs/armeabi-v7a/libweexjss.so differ
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8e3b224e/android/sdk/libs/armeabi/libweexjss.so
----------------------------------------------------------------------
diff --git a/android/sdk/libs/armeabi/libweexjss.so b/android/sdk/libs/armeabi/libweexjss.so
index 042e336..933bc35 100755
Binary files a/android/sdk/libs/armeabi/libweexjss.so and b/android/sdk/libs/armeabi/libweexjss.so differ
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8e3b224e/weex_core/Source/android/jsengine/multiprocess/WeexProxy.cpp
----------------------------------------------------------------------
diff --git a/weex_core/Source/android/jsengine/multiprocess/WeexProxy.cpp b/weex_core/Source/android/jsengine/multiprocess/WeexProxy.cpp
index da2f03f..e8f41ba 100644
--- a/weex_core/Source/android/jsengine/multiprocess/WeexProxy.cpp
+++ b/weex_core/Source/android/jsengine/multiprocess/WeexProxy.cpp
@@ -34,7 +34,7 @@ static IPCSender *sSender;
static std::unique_ptr<IPCHandler> sHandler;
static std::unique_ptr<WeexJSConnection> sConnection;
static WEEX_CORE_JS_SERVER_API_FUNCTIONS *js_server_api_functions = nullptr;
-bool g_use_single_process = true;
+bool g_use_single_process = false;
namespace WeexCore {
void WeexProxy::reset() {
@@ -122,7 +122,11 @@ namespace WeexCore {
}
jint
- WeexProxy::initFrameworkInMultiProcess(JNIEnv *env, jstring script, jobject params) {
+ WeexProxy::initFrameworkInMultiProcess(JNIEnv *env, jstring script, jobject params,
+ IPCSerializer *serializer) {
+
+ IPCSerializer *realSerializer = nullptr;
+ std::unique_ptr<IPCSerializer> serializerTemp(createIPCSerializer());
bool reinit = false;
startInitFrameWork:
try {
@@ -138,6 +142,15 @@ namespace WeexCore {
return false;
}
} else {
+ if (reinit) {
+ initFromParam(env, script,
+ params,
+ serializerTemp.get());
+ realSerializer = serializerTemp.get();
+ } else {
+ realSerializer = serializer;
+ }
+
// initHandler(sHandler.get());
ExtendJSApi *pExtensionJSApi = new ExtendJSApi();
@@ -146,11 +159,8 @@ namespace WeexCore {
// using base::debug::TraceEvent;
// TraceEvent::StartATrace(env);
- std::unique_ptr<IPCSerializer> serializer(createIPCSerializer());
- initFromParam(env, script, params, serializer.get());
- serializer->setMsg(static_cast<uint32_t>(IPCJSMsg::INITFRAMEWORK));
-
- std::unique_ptr<IPCBuffer> buffer = serializer->finish();
+ realSerializer->setMsg(static_cast<uint32_t>(IPCJSMsg::INITFRAMEWORK));
+ std::unique_ptr<IPCBuffer> buffer = realSerializer->finish();
std::unique_ptr<IPCResult> result = sSender->send(buffer.get());
if (result->getType() != IPCType::INT32) {
LOGE("initFramework Unexpected result type");
@@ -179,27 +189,32 @@ namespace WeexCore {
jobject params) {
Bridge_Impl_Android::getInstance()->setGlobalRef(jThis);
+ std::unique_ptr<IPCSerializer> serializer(createIPCSerializer());
+ const std::vector<INIT_FRAMEWORK_PARAMS *> &initFrameworkParams = initFromParam(env,
+ script,
+ params,
+ serializer.get());
+ LOGE("Single process ? %s", g_use_single_process ? "true" : "false");
+ if (g_use_single_process) {
+ if (initFrameworkInSingleProcess(env, script, initFrameworkParams)) {
+ //reportNativeInitStatus("-1011", "init Single Process Success");
+ return true;
+ }
- LOGE("doInitFramework is running");
-// if (g_use_single_process) {
-// if (initFrameworkInSingleProcess(env, script, nullptr)) {
-// //reportNativeInitStatus("-1011", "init Single Process Success");
-// return true;
-// }
-//
-// if (initFrameworkInMultiProcess(env, script, params)) {
-// return true;
-// }
-// } else {
- if (initFrameworkInMultiProcess(env, script, params)) {
- return true;
+ if (initFrameworkInMultiProcess(env, script, params, serializer.get())) {
+ return true;
+ }
+ } else {
+ if (initFrameworkInMultiProcess(env, script, params, serializer.get())) {
+ return true;
+ }
+
+ if (initFrameworkInSingleProcess(env, script, initFrameworkParams)) {
+ reportNativeInitStatus("-1011", "init Single Process Success");
+ return true;
+ }
}
-// if (initFrameworkInSingleProcess(env, script, nullptr)) {
-// reportNativeInitStatus("-1011", "init Single Process Success");
-// return true;
-// }
-// }
reportNativeInitStatus("-1010", "init Failed");
return false;
@@ -445,7 +460,8 @@ namespace WeexCore {
callDIspatchMessage
};
- auto *functions = (WEEX_CORE_JS_API_FUNCTIONS *) malloc(sizeof(WEEX_CORE_JS_API_FUNCTIONS));
+ auto *functions = (WEEX_CORE_JS_API_FUNCTIONS *) malloc(
+ sizeof(WEEX_CORE_JS_API_FUNCTIONS));
if (!functions) {
return nullptr;
@@ -461,11 +477,8 @@ namespace WeexCore {
WEEX_CORE_JS_API_FUNCTIONS *functions);
jint
- WeexProxy::initFrameworkInSingleProcess(JNIEnv *env, jstring script, jobject params) {
- std::unique_ptr<IPCSerializer> serializer(createIPCSerializer());
- const std::vector<INIT_FRAMEWORK_PARAMS *> &initFrameworkParams = initFromParam(env, script,
- params,
- serializer.get());
+ WeexProxy::initFrameworkInSingleProcess(JNIEnv *env, jstring script,
+ const std::vector<INIT_FRAMEWORK_PARAMS *> initFrameworkParams) {
std::string soPath = "";
// -----------------------------------------------
@@ -918,7 +931,8 @@ namespace WeexCore {
if (jTypeInt == 1) {
if (jDoubleValueMethodId == NULL) {
jclass jDoubleClazz = env->FindClass("java/lang/Double");
- jDoubleValueMethodId = env->GetMethodID(jDoubleClazz, "doubleValue", "()D");
+ jDoubleValueMethodId = env->GetMethodID(jDoubleClazz, "doubleValue",
+ "()D");
env->DeleteLocalRef(jDoubleClazz);
}
jdouble jDoubleObj = env->CallDoubleMethod(jDataObj, jDoubleValueMethodId);
@@ -1164,7 +1178,8 @@ namespace WeexCore {
}
jstring
- WeexProxy::execJSOnInstance(JNIEnv *env, jobject jcaller, jstring instanceId, jstring script,
+ WeexProxy::execJSOnInstance(JNIEnv *env, jobject jcaller, jstring instanceId,
+ jstring script,
jint type) {
if (instanceId == NULL || script == NULL) {
return env->NewStringUTF("");
@@ -1250,7 +1265,8 @@ namespace WeexCore {
if (jTypeInt == 1) {
if (jDoubleValueMethodId == NULL) {
jclass jDoubleClazz = env->FindClass("java/lang/Double");
- jDoubleValueMethodId = env->GetMethodID(jDoubleClazz, "doubleValue", "()D");
+ jDoubleValueMethodId = env->GetMethodID(jDoubleClazz, "doubleValue",
+ "()D");
env->DeleteLocalRef(jDoubleClazz);
}
jdouble jDoubleObj = env->CallDoubleMethod(jDataObj, jDoubleValueMethodId);
@@ -1481,7 +1497,8 @@ namespace WeexCore {
if (jTypeInt == 1) {
if (jDoubleValueMethodId == NULL) {
jclass jDoubleClazz = env->FindClass("java/lang/Double");
- jDoubleValueMethodId = env->GetMethodID(jDoubleClazz, "doubleValue", "()D");
+ jDoubleValueMethodId = env->GetMethodID(jDoubleClazz, "doubleValue",
+ "()D");
env->DeleteLocalRef(jDoubleClazz);
}
jdouble jDoubleObj = env->CallDoubleMethod(jDataObj, jDoubleValueMethodId);
@@ -1532,7 +1549,8 @@ namespace WeexCore {
ScopedJStringUTF8 instanceId(env, jinstanceid);
ScopedJStringUTF8 funcChar(env, jfunction);
return js_server_api_functions->funcCallJSOnAppContext(instanceId.getChars(),
- funcChar.getChars(), params);
+ funcChar.getChars(),
+ params);
} else {
std::unique_ptr<IPCBuffer> buffer = serializer->finish();
std::unique_ptr<IPCResult> result = sSender->send(buffer.get());
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8e3b224e/weex_core/Source/android/jsengine/multiprocess/WeexProxy.h
----------------------------------------------------------------------
diff --git a/weex_core/Source/android/jsengine/multiprocess/WeexProxy.h b/weex_core/Source/android/jsengine/multiprocess/WeexProxy.h
index 965ae48..0699d60 100644
--- a/weex_core/Source/android/jsengine/multiprocess/WeexProxy.h
+++ b/weex_core/Source/android/jsengine/multiprocess/WeexProxy.h
@@ -53,8 +53,9 @@ public:
initFromParam(JNIEnv *env, jstring script, jobject params, IPCSerializer *serializer);
static jint
- initFrameworkInSingleProcess(JNIEnv *env, jstring script, jobject params);
- static jint initFrameworkInMultiProcess(JNIEnv *env, jstring script, jobject params);
+ initFrameworkInSingleProcess(JNIEnv *env, jstring script,
+ const std::vector<INIT_FRAMEWORK_PARAMS *> initFrameworkParams);
+ static jint initFrameworkInMultiProcess(JNIEnv *env, jstring script, jobject params, IPCSerializer *serializer);
static const char *getCacheDir(JNIEnv *env);
[2/2] incubator-weex git commit: [WEEX-368][Android] Turn single
process switch on
Posted by ky...@apache.org.
[WEEX-368][Android] Turn single process switch on
Turn single process switch on for jsengine.
Make it can run on single process
Bug: WEEX-368
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/aef41c82
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/aef41c82
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/aef41c82
Branch: refs/heads/master
Commit: aef41c82fb619da094d28055622bde8712bc267c
Parents: 8e3b224
Author: 东煜 <ya...@alibaba-inc.com>
Authored: Wed May 16 16:01:19 2018 +0800
Committer: 东煜 <ya...@alibaba-inc.com>
Committed: Wed May 16 16:01:19 2018 +0800
----------------------------------------------------------------------
android/sdk/libs/armeabi/libweexjsc.so | Bin 972852 -> 948168 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/aef41c82/android/sdk/libs/armeabi/libweexjsc.so
----------------------------------------------------------------------
diff --git a/android/sdk/libs/armeabi/libweexjsc.so b/android/sdk/libs/armeabi/libweexjsc.so
index bec8e6d..bb45615 100644
Binary files a/android/sdk/libs/armeabi/libweexjsc.so and b/android/sdk/libs/armeabi/libweexjsc.so differ