You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jm...@apache.org on 2013/11/10 00:03:48 UTC

git commit: [flex-sdk] [refs/heads/develop] - FLEX-33874 improve binding performance

Updated Branches:
  refs/heads/develop 6a07ef67d -> ccdbfebd4


FLEX-33874 improve binding performance


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

Branch: refs/heads/develop
Commit: ccdbfebd403b913c67d58b096f570d4c088fd0c1
Parents: 6a07ef6
Author: Justin Mclean <jm...@apache.org>
Authored: Sun Nov 10 09:53:24 2013 +1100
Committer: Justin Mclean <jm...@apache.org>
Committed: Sun Nov 10 09:53:24 2013 +1100

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


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/ccdbfebd/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..013c1a4 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,8 @@ public class Binding
      *  @productversion Flex 3
      */
     mx_internal var destFunc:Function;
+    
+    mx_internal var destFuncFailed:Boolean;
 
 	/**
      *  The destination represented as a String.
@@ -285,6 +288,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 +413,9 @@ public class Binding
         try
         {
             var result:Object = wrappedFunction.apply(thisArg, args);
+            if (destFuncFailed) {
+                return null;
+            }
             wrappedFunctionSuccessful = true;
             return result;
         }
@@ -492,9 +507,11 @@ public class Binding
         	{
 	            destFunc.call(document, value);
 
-	            //	Note: state is not updated if destFunc throws
-	            lastValue = value;
-	            hasHadValue = true;
+                if (!destFuncFailed) {
+                    //	Note: state is not updated if destFunc throws
+                    lastValue = value;
+                    hasHadValue = true;
+	            }
 	        }
         }
     }