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 2012/09/28 20:12:17 UTC

[1/2] android commit: Remove unused async arg from PluginManager.exec().

Updated Branches:
  refs/heads/master 1bf12842c -> c7ce9598a


Remove unused async arg from PluginManager.exec().


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

Branch: refs/heads/master
Commit: c7ce9598a8fbd9d617822edec5fb73bf1c535f76
Parents: afcdccf
Author: Andrew Grieve <ag...@chromium.org>
Authored: Mon Sep 24 23:32:31 2012 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Sep 28 14:10:19 2012 -0400

----------------------------------------------------------------------
 .../org/apache/cordova/CordovaWebViewClient.java   |    2 +-
 framework/src/org/apache/cordova/ExposedJsApi.java |    2 +-
 .../src/org/apache/cordova/api/PluginManager.java  |   15 ++++++++-------
 3 files changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/c7ce9598/framework/src/org/apache/cordova/CordovaWebViewClient.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaWebViewClient.java b/framework/src/org/apache/cordova/CordovaWebViewClient.java
index 5f90763..55e0d90 100755
--- a/framework/src/org/apache/cordova/CordovaWebViewClient.java
+++ b/framework/src/org/apache/cordova/CordovaWebViewClient.java
@@ -101,7 +101,7 @@ public class CordovaWebViewClient extends WebViewClient {
 		String action     = url.substring(idx2 + 1, idx3);
 		String callbackId = url.substring(idx3 + 1, idx4);
 		String jsonArgs   = url.substring(idx4 + 1);
-        appView.pluginManager.exec(service, action, callbackId, jsonArgs, true /* async */);
+        appView.pluginManager.exec(service, action, callbackId, jsonArgs);
 	}    
 	
     /**

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/c7ce9598/framework/src/org/apache/cordova/ExposedJsApi.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/ExposedJsApi.java b/framework/src/org/apache/cordova/ExposedJsApi.java
index 710b2e0..b386a40 100755
--- a/framework/src/org/apache/cordova/ExposedJsApi.java
+++ b/framework/src/org/apache/cordova/ExposedJsApi.java
@@ -40,7 +40,7 @@ import org.json.JSONException;
     public String exec(String service, String action, String callbackId, String arguments) throws JSONException {
         jsMessageQueue.setPaused(true);
         try {
-            boolean wasSync = pluginManager.exec(service, action, callbackId, arguments, true /* async */);
+            boolean wasSync = pluginManager.exec(service, action, callbackId, arguments);
             String ret = "";
             if (!NativeToJsMessageQueue.DISABLE_EXEC_CHAINING || wasSync) {
                 ret = jsMessageQueue.popAndEncode();

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/c7ce9598/framework/src/org/apache/cordova/api/PluginManager.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/api/PluginManager.java b/framework/src/org/apache/cordova/api/PluginManager.java
index 589b103..e51739b 100755
--- a/framework/src/org/apache/cordova/api/PluginManager.java
+++ b/framework/src/org/apache/cordova/api/PluginManager.java
@@ -209,20 +209,16 @@ public class PluginManager {
      *                      this is an async plugin call.
      * @param args          An Array literal string containing any arguments needed in the
      *                      plugin execute method.
-     * @param async         Boolean indicating whether the calling JavaScript code is expecting an
-     *                      immediate return value. If true, either Cordova.callbackSuccess(...) or
-     *                      Cordova.callbackError(...) is called once the plugin code has executed.
      * @return Whether the task completed synchronously.
      */
-    public boolean exec(final String service, final String action, final String callbackId, final String jsonArgs, final boolean async) {
+    public boolean exec(final String service, final String action, final String callbackId, final String jsonArgs) {
         PluginResult cr = null;
-        boolean runAsync = async;
+        final IPlugin plugin = this.getPlugin(service);
+        boolean runAsync = !plugin.isSynch(action);
         try {
             final JSONArray args = new JSONArray(jsonArgs);
-            final IPlugin plugin = this.getPlugin(service);
             //final CordovaInterface ctx = this.ctx;
             if (plugin != null) {
-                runAsync = async && !plugin.isSynch(action);
                 if (runAsync) {
                     // Run this on a different thread so that this one can return back to JS
                     ctx.getThreadPool().execute(new Runnable() {
@@ -266,6 +262,11 @@ public class PluginManager {
         return true;
     }
 
+    @Deprecated
+    public boolean exec(String service, String action, String callbackId, String jsonArgs, boolean async) {
+        return exec(service, action, callbackId, jsonArgs);
+    }
+
     /**
      * Get the plugin object that implements the service.
      * If the plugin object does not already exist, then create it.