cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [2/2] android commit: Disable limiting of payload size when sending data to JS.
Date Fri, 26 Oct 2012 20:10:50 GMT
Disable limiting of payload size when sending data to JS.

Fixes https://issues.apache.org/jira/browse/CB-1745


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/678ae2d6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/678ae2d6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/678ae2d6

Branch: refs/heads/master
Commit: 678ae2d684a39017bec3586883c3a528190d4d20
Parents: e4f8f44
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Fri Oct 26 16:08:35 2012 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Fri Oct 26 16:08:35 2012 -0400

----------------------------------------------------------------------
 .../org/apache/cordova/NativeToJsMessageQueue.java |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/678ae2d6/framework/src/org/apache/cordova/NativeToJsMessageQueue.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/NativeToJsMessageQueue.java b/framework/src/org/apache/cordova/NativeToJsMessageQueue.java
index 4f9f9ad..3146623 100755
--- a/framework/src/org/apache/cordova/NativeToJsMessageQueue.java
+++ b/framework/src/org/apache/cordova/NativeToJsMessageQueue.java
@@ -50,8 +50,13 @@ public class NativeToJsMessageQueue {
     // exec() is asynchronous. Set this to true when running bridge benchmarks.
     static final boolean DISABLE_EXEC_CHAINING = false;
     
-    // Arbitrarily chosen upper limit for how much data to send to JS in one shot. 
-    private static final int MAX_PAYLOAD_SIZE = 50 * 1024;
+    // Upper limit for how much data to send to JS in one shot.
+    // TODO(agrieve): This is currently disable. It should be re-enabled once we
+    // remove support for returning values from exec() calls. This was
+    // deprecated in 2.2.0.
+    // Also, this currently only chops up on message boundaries. It may be useful
+    // to allow it to break up messages.
+    private static int MAX_PAYLOAD_SIZE = -1; //50 * 1024 * 10240;
     
     /**
      * The index into registeredListeners to treat as active. 
@@ -144,7 +149,7 @@ public class NativeToJsMessageQueue {
             int numMessagesToSend = 0;
             for (JsMessage message : queue) {
                 int messageSize = calculatePackedMessageLength(message);
-                if (numMessagesToSend > 0 && totalPayloadLen + messageSize >
MAX_PAYLOAD_SIZE) {
+                if (numMessagesToSend > 0 && totalPayloadLen + messageSize >
MAX_PAYLOAD_SIZE && MAX_PAYLOAD_SIZE > 0) {
                     break;
                 }
                 totalPayloadLen += messageSize;
@@ -178,7 +183,7 @@ public class NativeToJsMessageQueue {
             int numMessagesToSend = 0;
             for (JsMessage message : queue) {
                 int messageSize = message.calculateEncodedLength() + 50; // overestimate.
-                if (numMessagesToSend > 0 && totalPayloadLen + messageSize >
MAX_PAYLOAD_SIZE) {
+                if (numMessagesToSend > 0 && totalPayloadLen + messageSize >
MAX_PAYLOAD_SIZE && MAX_PAYLOAD_SIZE > 0) {
                     break;
                 }
                 totalPayloadLen += messageSize;


Mime
View raw message