cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [2/2] js commit: [ios] Delete now-unnecessary cordova.commandQueueFlushing flag.
Date Thu, 04 Oct 2012 19:57:32 GMT
[ios] Delete now-unnecessary cordova.commandQueueFlushing flag.

Also moved cordova.commandQueue into exec.js since it is not common
code.


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

Branch: refs/heads/master
Commit: da71266af8a4355e8b28584fa13cca92872f5500
Parents: 99fed6d
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Thu Oct 4 12:52:04 2012 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Thu Oct 4 15:57:14 2012 -0400

----------------------------------------------------------------------
 lib/cordova.js  |    8 --------
 lib/ios/exec.js |   15 ++++++++-------
 2 files changed, 8 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/da71266a/lib/cordova.js
----------------------------------------------------------------------
diff --git a/lib/cordova.js b/lib/cordova.js
index 36b305d..ef68b2b 100644
--- a/lib/cordova.js
+++ b/lib/cordova.js
@@ -164,14 +164,6 @@ var cordova = {
         }
     },
 
-    // TODO: iOS only
-    // This queue holds the currently executing command and all pending
-    // commands executed with cordova.exec().
-    commandQueue:[],
-    // Indicates if we're currently in the middle of flushing the command
-    // queue on the native side.
-    commandQueueFlushing:false,
-    // END TODO
     /**
      * Plugin callback mechanism.
      */

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/da71266a/lib/ios/exec.js
----------------------------------------------------------------------
diff --git a/lib/ios/exec.js b/lib/ios/exec.js
index 18b616d..7c8d136 100644
--- a/lib/ios/exec.js
+++ b/lib/ios/exec.js
@@ -41,6 +41,7 @@ var cordova = require('cordova'),
     execIframe,
     execXhr,
     requestCount = 0,
+    commandQueue = [], // Contains pending JS->Native messages.
     isInContextOfEvalJs = 0;
 
 function createExecIframe() {
@@ -56,8 +57,8 @@ function shouldBundleCommandJson() {
     }
     if (bridgeMode == jsToNativeModes.XHR_OPTIONAL_PAYLOAD) {
         var payloadLength = 0;
-        for (var i = 0; i < cordova.commandQueue.length; ++i) {
-            payloadLength += cordova.commandQueue[i].length;
+        for (var i = 0; i < commandQueue.length; ++i) {
+            payloadLength += commandQueue[i].length;
         }
         // The value here was determined using the benchmark within CordovaLibApp on an iPad
3.
         return payloadLength < 4500;
@@ -108,9 +109,9 @@ function iOSExec() {
     // Stringify and queue the command. We stringify to command now to
     // effectively clone the command arguments in case they are mutated before
     // the command is executed.
-    cordova.commandQueue.push(JSON.stringify(command));
+    commandQueue.push(JSON.stringify(command));
 
-    if (!cordova.commandQueueFlushing && !isInContextOfEvalJs) {
+    if (!isInContextOfEvalJs) {
         if (bridgeMode != jsToNativeModes.IFRAME_NAV) {
             // Re-using the XHR improves exec() performance by about 10%.
             // It is possible for a native stringByEvaluatingJavascriptFromString call
@@ -152,11 +153,11 @@ iOSExec.setJsToNativeBridgeMode = function(mode) {
 
 iOSExec.nativeFetchMessages = function() {
     // Each entry in commandQueue is a JSON string already.
-    if (!cordova.commandQueue.length) {
+    if (!commandQueue.length) {
         return '';
     }
-    var json = '[' + cordova.commandQueue.join(',') + ']';
-    cordova.commandQueue.length = 0;
+    var json = '[' + commandQueue.join(',') + ']';
+    commandQueue.length = 0;
     return json;
 };
 


Mime
View raw message