You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/08/13 21:09:38 UTC

android commit: Use a higher threshold for slow exec() warnings when debugger is attached.

Updated Branches:
  refs/heads/master 4e1aa8aa5 -> fe45b29ef


Use a higher threshold for slow exec() warnings when debugger is attached.


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/fe45b29e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/fe45b29e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/fe45b29e

Branch: refs/heads/master
Commit: fe45b29ef646154654e4f68a2144df100a7c1b0d
Parents: 4e1aa8a
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Aug 13 15:08:54 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Aug 13 15:08:54 2013 -0400

----------------------------------------------------------------------
 framework/src/org/apache/cordova/PluginManager.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/fe45b29e/framework/src/org/apache/cordova/PluginManager.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/PluginManager.java b/framework/src/org/apache/cordova/PluginManager.java
index 277e7ac..33a6f22 100755
--- a/framework/src/org/apache/cordova/PluginManager.java
+++ b/framework/src/org/apache/cordova/PluginManager.java
@@ -38,6 +38,7 @@ import android.content.Intent;
 import android.content.res.XmlResourceParser;
 
 import android.net.Uri;
+import android.os.Debug;
 import android.util.Log;
 
 /**
@@ -48,6 +49,7 @@ import android.util.Log;
  */
 public class PluginManager {
     private static String TAG = "PluginManager";
+    private static final int SLOW_EXEC_WARNING_THRESHOLD = Debug.isDebuggerConnected() ? 60 : 16;
 
     // List of service entries
     private final HashMap<String, PluginEntry> entries = new HashMap<String, PluginEntry>();
@@ -228,7 +230,8 @@ public class PluginManager {
             long pluginStartTime = System.currentTimeMillis();
             boolean wasValidAction = plugin.execute(action, rawArgs, callbackContext);
             long duration = System.currentTimeMillis() - pluginStartTime;
-            if (duration > 16) {
+            
+            if (duration > SLOW_EXEC_WARNING_THRESHOLD) {
                 Log.w(TAG, "THREAD WARNING: exec() call to " + service + "." + action + " blocked the main thread for " + duration + "ms. Plugin should use CordovaInterface.getThreadPool().");
             }
             if (!wasValidAction) {