weex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From misa...@apache.org
Subject [2/7] incubator-weex git commit: * [android] when WxInstance report createInstance Exception after jsc thread crash, will try reload again
Date Wed, 06 Sep 2017 09:54:09 GMT
 * [android] when WxInstance report createInstance Exception after jsc thread crash, will try
reload again


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/6e09b827
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/6e09b827
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/6e09b827

Branch: refs/heads/apache-0.16-dev
Commit: 6e09b827f7c4ce47a69099cc4b65438a2bdcedf2
Parents: f9584d1
Author: yuhun-alibaba <tomcatswt@gmail.com>
Authored: Thu Aug 31 20:44:39 2017 +0800
Committer: misakuo <misakuo@apache.org>
Committed: Wed Sep 6 17:51:11 2017 +0800

----------------------------------------------------------------------
 .../src/main/java/com/taobao/weex/WXSDKInstance.java  |  8 ++++++++
 .../java/com/taobao/weex/bridge/WXBridgeManager.java  | 14 ++++++++++++++
 2 files changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6e09b827/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java b/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java
index 9e26736..7e0da86 100644
--- a/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java
+++ b/android/sdk/src/main/java/com/taobao/weex/WXSDKInstance.java
@@ -117,6 +117,7 @@ public class WXSDKInstance implements IWXActivityStateListener,DomContext,
View.
   private boolean trackComponent;
   private boolean enableLayerType = true;
   private boolean mNeedValidate = false;
+  private boolean mNeedReLoad = false;
   private static volatile int mViewPortWidth = 750;
   private int mInstanceViewPortWidth = 750;
 
@@ -203,6 +204,13 @@ public class WXSDKInstance implements IWXActivityStateListener,DomContext,
View.
     return mNeedValidate;
   }
 
+  public boolean isNeedReLoad() {
+    return mNeedReLoad;
+  }
+
+  public void setNeedLoad(boolean load) {
+    mNeedReLoad = load;
+  }
   /*
   *  Warning: use setInstanceViewPortWidth instead.
   *  store custom ViewPort Width

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6e09b827/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java b/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java
index f6c3144..89b2d3b 100644
--- a/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java
+++ b/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java
@@ -1804,6 +1804,20 @@ public class WXBridgeManager implements Callback,BactchExecutor {
     if (instanceId != null && (instance = WXSDKManager.getInstance().getSDKInstance(instanceId))
!= null) {
       instance.onJSException(WXErrorCode.WX_ERR_JS_EXECUTE.getErrorCode(), function, exception);
 
+      if (METHOD_CREATE_INSTANCE.equals(function)) {
+        try {
+          if (reInitCount > 1 && !instance.isNeedReLoad()) {
+            // JSONObject domObject = JSON.parseObject(tasks);
+            WXDomModule domModule = getDomModule(instanceId);
+            Action action = Actions.getReloadPage(instanceId);
+            domModule.postAction((DOMAction)action, true);
+            instance.setNeedLoad(true);
+            return;
+          }
+        } catch (Exception e) {
+          e.printStackTrace();
+        }
+      }
       String err = "function:" + function + "#exception:" + exception;
       commitJSBridgeAlarmMonitor(instanceId, WXErrorCode.WX_ERR_JS_EXECUTE, err);
 


Mime
View raw message