From fe45b29ef646154654e4f68a2144df100a7c1b0d Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Tue, 13 Aug 2013 15:08:54 -0400 Subject: [PATCH] Use a higher threshold for slow exec() warnings when debugger is attached. --- framework/src/org/apache/cordova/PluginManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/framework/src/org/apache/cordova/PluginManager.java b/framework/src/org/apache/cordova/PluginManager.java index 277e7ac4..33a6f22f 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 entries = new HashMap(); @@ -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) {