You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by to...@apache.org on 2018/03/29 07:28:33 UTC

[1/2] incubator-weex git commit: [WEEX-269] [android] add T3D api support can use callT3DLinkNative on js runtime

Repository: incubator-weex
Updated Branches:
  refs/heads/master 1ab83cdcf -> 0bc243d95


 [WEEX-269] [android] add T3D api support
 can use callT3DLinkNative on js runtime


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

Branch: refs/heads/master
Commit: 0bc243d95812d2e1d19922ec8480278cad6ca11e
Parents: e69a0d2
Author: yuhun-alibaba <to...@gmail.com>
Authored: Thu Mar 29 14:57:35 2018 +0800
Committer: wentao.swt <we...@alibaba-inc.com>
Committed: Thu Mar 29 15:24:34 2018 +0800

----------------------------------------------------------------------
 android/playground/app/build.gradle             |   2 +-
 android/sdk/libs/armeabi/libweexjsc.so          | Bin 276000 -> 276000 bytes
 android/sdk/libs/armeabi/libweexjss.so          | Bin 2965560 -> 2965608 bytes
 .../com/taobao/weex/bridge/WXBridgeManager.java |  13 +++++++++++--
 4 files changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0bc243d9/android/playground/app/build.gradle
----------------------------------------------------------------------
diff --git a/android/playground/app/build.gradle b/android/playground/app/build.gradle
index ede9c84..bae43ca 100755
--- a/android/playground/app/build.gradle
+++ b/android/playground/app/build.gradle
@@ -104,5 +104,5 @@ dependencies {
     compile 'com.jakewharton.scalpel:scalpel:1.1.2'
     compile 'com.taobao.android.weex_inspection:urlconnection_interceptor:1.0.0'
     compile 'com.android.support.test.espresso:espresso-idling-resource:2.2.2'
-    compile 'com.taobao.android:weex_inspector:0.13.4'
+    compile 'com.taobao.android:weex_inspector:0.13.5-multicontext'
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0bc243d9/android/sdk/libs/armeabi/libweexjsc.so
----------------------------------------------------------------------
diff --git a/android/sdk/libs/armeabi/libweexjsc.so b/android/sdk/libs/armeabi/libweexjsc.so
index f45aee4..96fe1c2 100755
Binary files a/android/sdk/libs/armeabi/libweexjsc.so and b/android/sdk/libs/armeabi/libweexjsc.so differ

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/0bc243d9/android/sdk/libs/armeabi/libweexjss.so
----------------------------------------------------------------------
diff --git a/android/sdk/libs/armeabi/libweexjss.so b/android/sdk/libs/armeabi/libweexjss.so
index 94d4478..f91f45a 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/0bc243d9/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 aed1c53..ffede54 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
@@ -117,6 +117,7 @@ import static com.taobao.weex.bridge.WXModuleManager.createDomModule;
 public class WXBridgeManager implements Callback, BactchExecutor {
 
   public static final String METHOD_CREATE_INSTANCE = "createInstance";
+  public static final String METHOD_CREATE_INSTANCE_CONTEXT = "createInstanceContext";
   public static final String METHOD_DESTROY_INSTANCE = "destroyInstance";
   public static final String METHOD_CALL_JS = "callJS";
   public static final String METHOD_SET_TIMEOUT = "setTimeoutCallback";
@@ -1175,6 +1176,14 @@ public class WXBridgeManager implements Callback, BactchExecutor {
 
 
   public String syncExecJsOnInstanceWithResult(final String instanceId, final String js, final int type) {
+    try {
+      if (isJSThread()) {
+        return invokeExecJSOnInstance(instanceId, js, type);
+      }
+    } catch (Throwable e) {
+      WXLogUtils.e("[WXBridgeManager] syncExecJsOnInstanceWithResult on jsThread Exception");
+      return "";
+    }
     final CountDownLatch waitLatch = new CountDownLatch(1);
     EventResult callback = new EventResult(){
       @Override
@@ -1746,7 +1755,7 @@ public class WXBridgeManager implements Callback, BactchExecutor {
           return;
         }
         if (type == BundType.Vue || type == BundType.Rax) {
-          invokeCreateInstanceContext(instance.getInstanceId(), null, METHOD_CREATE_INSTANCE, args, false);
+          invokeCreateInstanceContext(instance.getInstanceId(), null, METHOD_CREATE_INSTANCE_CONTEXT, args, false);
           return;
         } else {
           invokeExecJS(instance.getInstanceId(), null, METHOD_CREATE_INSTANCE, args, false);
@@ -2420,7 +2429,7 @@ public void invokeDestoryInstance(String instanceId, String namespace, String fu
     WXSDKInstance instance = null;
     if (instanceId != null && (instance = WXSDKManager.getInstance().getSDKInstance(instanceId)) != null) {
 	  exception +=   "\n getTemplateInfo==" +instance.getTemplateInfo();//add network header info
-      if (METHOD_CREATE_INSTANCE.equals(function) || !instance.isContentMd5Match()) {
+      if (METHOD_CREATE_INSTANCE_CONTEXT.equals(function) || METHOD_CREATE_INSTANCE.equals(function) || !instance.isContentMd5Match()) {
         try {
           if (isJSFrameworkInit() && reInitCount > 1 && !instance.isNeedReLoad()) {
             // JSONObject domObject = JSON.parseObject(tasks);


[2/2] incubator-weex git commit: * [Android] rm useless code

Posted by to...@apache.org.
* [Android] rm useless code


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

Branch: refs/heads/master
Commit: e69a0d2ad69f59b88fc00c99f01eb4b229abd035
Parents: 1ab83cd
Author: zhongcang <qh...@gmail.com>
Authored: Thu Mar 29 14:27:05 2018 +0800
Committer: wentao.swt <we...@alibaba-inc.com>
Committed: Thu Mar 29 15:24:34 2018 +0800

----------------------------------------------------------------------
 .../main/java/com/taobao/weex/WXSDKEngine.java  |   1 -
 .../com/taobao/weex/common/WXPerformance.java   |  72 +-----------
 .../taobao/weex/performance/FpsCollector.java   | 113 -------------------
 .../com/taobao/weex/performance/MemUtils.java   |  80 -------------
 4 files changed, 2 insertions(+), 264 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e69a0d2a/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java b/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
index cbcac83..ef87679 100644
--- a/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
+++ b/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
@@ -59,7 +59,6 @@ import com.taobao.weex.dom.WXScrollerDomObject;
 import com.taobao.weex.dom.WXSwitchDomObject;
 import com.taobao.weex.dom.WXTextDomObject;
 import com.taobao.weex.http.WXStreamModule;
-import com.taobao.weex.performance.FpsCollector;
 import com.taobao.weex.ui.ExternalLoaderComponentHolder;
 import com.taobao.weex.ui.IExternalComponentGetter;
 import com.taobao.weex.ui.IExternalModuleGetter;

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e69a0d2a/android/sdk/src/main/java/com/taobao/weex/common/WXPerformance.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/common/WXPerformance.java b/android/sdk/src/main/java/com/taobao/weex/common/WXPerformance.java
index 8af7d85..77e43e9 100644
--- a/android/sdk/src/main/java/com/taobao/weex/common/WXPerformance.java
+++ b/android/sdk/src/main/java/com/taobao/weex/common/WXPerformance.java
@@ -18,14 +18,10 @@
  */
 package com.taobao.weex.common;
 
-import android.os.Debug;
 import android.support.annotation.RestrictTo;
 import android.support.annotation.RestrictTo.Scope;
-import android.text.TextUtils;
 
 import com.taobao.weex.WXEnvironment;
-import com.taobao.weex.performance.FpsCollector;
-import com.taobao.weex.performance.MemUtils;
 import com.taobao.weex.utils.WXViewUtils;
 
 import java.util.HashMap;
@@ -63,8 +59,8 @@ public class WXPerformance {
      */
     JSLibSize(0D, Double.MAX_VALUE),
     //normal 300ms.. first install apk 30s ?
-    JSLibInitTime(0D, 50000D),
-    SDKInitTime(0D, 5000D),
+    JSLibInitTime(0D, 80000D),
+    SDKInitTime(0D, 120000D),
     SDKInitInvokeTime(0D, 5000D),
     SDKInitExecuteTime(0D, 5000D),
     JSTemplateSize(0D, 5000D),
@@ -186,19 +182,10 @@ public class WXPerformance {
   public int fsCallEventTotalNum;
 
   public long avgFPS;
-  public long frameSum;
-  public long frameStartTime;
-  public long frameEndTime;
   public double fluency = 100D;
 
-  public long maxImproveMemory;
-
   public long backImproveMemory;
 
-  public long pushImproveMemory;
-
-  public long memTotalBeforeRender;
-
 
   /**
    * Time spent for reading, time unit is ms.
@@ -369,9 +356,6 @@ public class WXPerformance {
   }
 
   public static void init() {
-    if (WXPerformance.TRACE_DATA) {
-      FpsCollector.getInstance().init();
-    }
   }
 
   public Map<String, Double> getMeasureMap() {
@@ -533,63 +517,11 @@ public class WXPerformance {
   }
 
 
-  private FpsRecorder mFpsRecorder = new FpsRecorder();
-
   public void beforeInstanceRender(String instanceId) {
     renderTimeOrigin = System.currentTimeMillis();
-    if (WXPerformance.TRACE_DATA) {
-      if (TextUtils.isEmpty(instanceId)) {
-        return;
-      }
-      Debug.MemoryInfo mem = MemUtils.getMemoryInfo(WXEnvironment.getApplication());
-      if (null != mem) {
-        memTotalBeforeRender = mem.getTotalPss();
-      }
-      FpsCollector.getInstance().registerListener(instanceId, mFpsRecorder);
-    }
   }
 
-  //  public void onInstanceEndRender(String instanceId,boolean isFirstScreen){
-  //
-  //  }
-
-
   public void afterInstanceDestroy(String instanceId) {
-    if (WXPerformance.TRACE_DATA) {
-      if (TextUtils.isEmpty(instanceId)) {
-        return;
-      }
-      FpsCollector.getInstance().unRegister(instanceId);
-      Debug.MemoryInfo mem = MemUtils.getMemoryInfo(WXEnvironment.getApplication());
-      if (null != mem) {
-        backImproveMemory = mem.getTotalPss() - memTotalBeforeRender;
-      }
-      if (mFpsRecorder.totalFpsCount > 0) {
-        avgFPS = mFpsRecorder.totalFpsCount / mFpsRecorder.totalFpsCount;
-        fluency = (double) mFpsRecorder.fluncyFpsPointCount / (double) mFpsRecorder.totalFpsCount;
-      }
-    }
   }
 
-  private class FpsRecorder implements FpsCollector.IFPSCallBack {
-
-    private final long FLUENCY_FPS_LIMIT = 35;
-
-    private long totalFpsFrame;
-    private long totalFpsCount;
-    private long fluncyFpsPointCount;
-    private final long LIMIT_LONG = Long.MAX_VALUE - 1000;
-
-    @Override
-    public void fps(int fps) {
-      if (totalFpsFrame >= LIMIT_LONG || totalFpsCount >= Long.MAX_VALUE) {
-        return;
-      }
-      totalFpsFrame += fps;
-      totalFpsCount++;
-      if (fps >= FLUENCY_FPS_LIMIT) {
-        fluncyFpsPointCount++;
-      }
-    }
-  }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e69a0d2a/android/sdk/src/main/java/com/taobao/weex/performance/FpsCollector.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/performance/FpsCollector.java b/android/sdk/src/main/java/com/taobao/weex/performance/FpsCollector.java
deleted file mode 100644
index 5819bd2..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/performance/FpsCollector.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.taobao.weex.performance;
-
-
-import android.os.Build;
-import android.os.Handler;
-import android.support.annotation.RequiresApi;
-import android.view.Choreographer;
-
-import com.taobao.weex.WXEnvironment;
-import com.taobao.weex.WXSDKManager;
-import com.taobao.weex.common.WXPerformance;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * @author chenpeihan
- * @date 2017/12/12
- */
-
-public class FpsCollector {
-
-  private Map<String, IFPSCallBack> mListenerMap = new ConcurrentHashMap<>();
-  private AtomicBoolean mHasInit = new AtomicBoolean(false);
-
-
-  private static class SingleTonHolder {
-
-    private static FpsCollector INSTANCE = new FpsCollector();
-  }
-
-  public static FpsCollector getInstance() {
-    return SingleTonHolder.INSTANCE;
-  }
-
-  public void init() {
-    if (!WXEnvironment.isApkDebugable()) {
-      return;
-    }
-    if (mHasInit.compareAndSet(false, true)) {
-      WXSDKManager.getInstance().postOnUiThread(new Runnable() {
-        @Override
-        public void run() {
-          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && WXPerformance.TRACE_DATA) {
-            Choreographer.getInstance().postFrameCallback(new OnFrameListener());
-          }
-        }
-      }, 0);
-
-    }
-  }
-
-
-  @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
-  private class OnFrameListener implements Choreographer.FrameCallback {
-
-    private int mFrameCount = 0;
-    private long mTimeBegin = 0;
-
-    @Override
-    public void doFrame(long frameTimeNanos) {
-      Choreographer.getInstance().postFrameCallback(this);
-      if (mTimeBegin == 0) {
-        mTimeBegin = System.currentTimeMillis();
-        mFrameCount++;
-        return;
-      }
-      long timeDiff = System.currentTimeMillis() - mTimeBegin;
-      if (timeDiff < 1000) {
-        mFrameCount++;
-        return;
-      }
-      for (Map.Entry<String, IFPSCallBack> entry : mListenerMap.entrySet()) {
-        entry.getValue().fps(mFrameCount);
-      }
-      WXAnalyzerDataTransfer.transferFps(mFrameCount);
-
-      mTimeBegin = 0;
-      mFrameCount = 0;
-    }
-  }
-
-  public interface IFPSCallBack {
-
-    void fps(int fps);
-  }
-
-
-  public void registerListener(String key, IFPSCallBack listener) {
-    mListenerMap.put(key, listener);
-  }
-
-  public void unRegister(String key) {
-    mListenerMap.remove(key);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/e69a0d2a/android/sdk/src/main/java/com/taobao/weex/performance/MemUtils.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/performance/MemUtils.java b/android/sdk/src/main/java/com/taobao/weex/performance/MemUtils.java
deleted file mode 100644
index 9933988..0000000
--- a/android/sdk/src/main/java/com/taobao/weex/performance/MemUtils.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.taobao.weex.performance;
-
-import android.app.ActivityManager;
-import android.content.Context;
-import android.os.Build;
-import android.os.Debug;
-import android.util.Log;
-
-import com.taobao.weex.WXEnvironment;
-
-/**
- * @author chenpeihan
- * @date 2017/12/12
- */
-
-public class MemUtils {
-
-    /**
-     * bad performance ,40ms-60ms
-     */
-    public static Debug.MemoryInfo getMemoryInfo(Context context) {
-        long start = System.currentTimeMillis();
-        if (null == context){
-            return null;
-        }
-        Debug.MemoryInfo meminfo = null;
-        ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
-        if (activityManager != null) {
-            if (Build.VERSION.SDK_INT >= 23) {
-                int[] pids = {android.os.Process.myPid()};
-                Debug.MemoryInfo[] meminfos = activityManager.getProcessMemoryInfo(pids);
-                if (meminfos != null && meminfos.length > 0) {
-                    meminfo = meminfos[0];
-                }
-            } else {
-                meminfo = new Debug.MemoryInfo();
-                Debug.getMemoryInfo(meminfo);
-                int privateDirty = meminfo.getTotalPrivateDirty();
-                if (privateDirty == 0) {
-                    Debug.getMemoryInfo(meminfo);
-                }
-            }
-        }
-        if (WXEnvironment.isApkDebugable()){
-            Log.d("MemUtils", "getMemoryInfo , time :"+(System.currentTimeMillis() -start));
-        }
-
-        return meminfo;
-    }
-
-    public static long getTotalPss(Context context) {
-
-        long totalPss = 0L;
-
-        Debug.MemoryInfo meminfo = getMemoryInfo(context);
-        if (meminfo != null) {
-            totalPss = meminfo.getTotalPss();
-        }
-        return totalPss;
-    }
-
-}