flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcl...@apache.org
Subject git commit: [flex-sdk] [refs/heads/develop] - FLEX-33874 binding management is memory inefficient
Date Tue, 24 Dec 2013 00:43:03 GMT
Updated Branches:
  refs/heads/develop 6c5396218 -> 212537d43


FLEX-33874 binding management is memory inefficient


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/212537d4
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/212537d4
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/212537d4

Branch: refs/heads/develop
Commit: 212537d433e612d431ca5d48cbea88ca07e987f1
Parents: 6c53962
Author: Justin Mclean <jmclean@apache.org>
Authored: Tue Dec 24 11:41:41 2013 +1100
Committer: Justin Mclean <jmclean@apache.org>
Committed: Tue Dec 24 11:41:41 2013 +1100

----------------------------------------------------------------------
 .../framework/src/mx/binding/Binding.as         | 28 +++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/212537d4/frameworks/projects/framework/src/mx/binding/Binding.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/src/mx/binding/Binding.as b/frameworks/projects/framework/src/mx/binding/Binding.as
index 230f42b..a03ba16 100644
--- a/frameworks/projects/framework/src/mx/binding/Binding.as
+++ b/frameworks/projects/framework/src/mx/binding/Binding.as
@@ -83,6 +83,7 @@ public class Binding
         this.destFunc = destFunc;
         this.destString = destString;
         this.srcString = srcString;
+        this.destFuncFailed = false;
 
         if (this.srcFunc == null)
         {
@@ -234,6 +235,11 @@ public class Binding
      *  @productversion Flex 3
      */
     mx_internal var destFunc:Function;
+    
+    /**
+     * @private 
+     */
+    mx_internal var destFuncFailed:Boolean;
 
 	/**
      *  The destination represented as a String.
@@ -285,6 +291,15 @@ public class Binding
         while (i < (chain.length - 1))
         {
             element = element[chain[i++]];
+            //if the element does not exist : avoid exception as it's heavy on memory allocations
+            if(element == null || element == undefined) {
+                destFuncFailed = true;
+                if (BindingManager.debugDestinationStrings[destString])
+                {
+                    trace("Binding: destString = " + destString + ", error = 1009");
+                }
+                return;
+            }
         }
 
         element[chain[i]] = value;
@@ -401,6 +416,10 @@ public class Binding
         try
         {
             var result:Object = wrappedFunction.apply(thisArg, args);
+            if(destFuncFailed == true) {
+                destFuncFailed = false;
+                return null;
+            }
             wrappedFunctionSuccessful = true;
             return result;
         }
@@ -474,6 +493,7 @@ public class Binding
      */
     private function innerExecute():void
     {
+        destFuncFailed = false;
         var value:Object = wrapFunctionCall(document, srcFunc);
 
         if (BindingManager.debugDestinationStrings[destString])
@@ -492,9 +512,11 @@ public class Binding
         	{
 	            destFunc.call(document, value);
 
-	            //	Note: state is not updated if destFunc throws
-	            lastValue = value;
-	            hasHadValue = true;
+                if(destFuncFailed == false) {
+                    //	Note: state is not updated if destFunc throws
+                    lastValue = value;
+                    hasHadValue = true;
+	            }
 	        }
         }
     }


Mime
View raw message