mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-31 17:32:51 +08:00
Use a higher threshold for slow exec() warnings when debugger is attached.
This commit is contained in:
parent
4e1aa8aa59
commit
fe45b29ef6
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user