Author: max
Date: 2007-07-24 16:41:17 -0700 (Tue, 24 Jul 2007)
New Revision: 5776
Modified:
openlaszlo/branches/legals/WEB-INF/lps/lfc/data/LzReplicationManager.lzs
Log:
20070724-maxcarlson-P by [EMAIL PROTECTED] on 2007-07-24 15:42:47 PDT
in /Users/maxcarlson/openlaszlo/legals-checkin/WEB-INF/lps/lfc
for http://svn.openlaszlo.org/openlaszlo/branches/legals/WEB-INF/lps/lfc
Summary: Lock layouts during replication
New Features:
Bugs Fixed: LPP-2111 - Horrendously inefficient looping in layout classes!!
Technical Reviewer: promanik
QA Reviewer: jcrowley
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details: Lock layouts before replication, and unlock afterwards.
Tests: See testcase attached to LPP-2111. With the patch applied,
http://localhost:8080/legals-checkin/my-apps/wrappinglayoutupdate.lzx?lzr=dhtml&lzt=html
shows 16733 calls in the profiler when the puttun click is profiled. Without
the patch, it shows 80389 calls and takes ~593ms.
Modified:
openlaszlo/branches/legals/WEB-INF/lps/lfc/data/LzReplicationManager.lzs
===================================================================
--- openlaszlo/branches/legals/WEB-INF/lps/lfc/data/LzReplicationManager.lzs
2007-07-24 22:58:27 UTC (rev 5775)
+++ openlaszlo/branches/legals/WEB-INF/lps/lfc/data/LzReplicationManager.lzs
2007-07-24 23:41:17 UTC (rev 5776)
@@ -289,7 +289,8 @@
*/
function getNodeOffset ( p ){
if (this.nodes != null) {
- for ( var i = 0; i < this.nodes.length; i++ ){
+ var l = this.nodes.length;
+ for ( var i = 0; i < l; i++ ){
if ( p == this.nodes[ i ] ){
return i;
}
@@ -366,6 +367,10 @@
* @access private
*/
function __LZHandleMultiNodes ( n ){
+ var layouts = this.parent && this.parent.layouts ? this.parent.layouts :
[];
+ for (var i in layouts) {
+ layouts[i].lock();
+ }
this.hasdata = true;
var lastnodes = this.nodes;
this.nodes = n;
@@ -380,7 +385,8 @@
this.__LZadjustVisibleClones( lastnodes , true );
- for ( var i = 0; i < this.clones.length ; i++ ){
+ var l = this.clones.length;
+ for (var i = 0; i < l; i++ ){
var cl = this.clones[ i ] ;
var iplusoffset = i + this.__LZdataoffset;
cl.clonenumber = iplusoffset ;
@@ -389,18 +395,16 @@
}
if (cl.onclonenumber.ready) cl.onclonenumber.sendEvent( iplusoffset );
}
-
-
if (this.onclones.ready) this.onclones.sendEvent( this.clones );
-
-
+ for (var i in layouts) {
+ layouts[i].unlock();
+ }
}
/**
* @access private
*/
-function __LZadjustVisibleClones( lastnodes ,
- newnodes){
+function __LZadjustVisibleClones( lastnodes , newnodes){
var stpt = this.__LZdiffArrays( lastnodes , this.nodes);
if ( ! this.pooling ) {
@@ -415,7 +419,7 @@
LzInstantiator.enableDataReplicationQueuing( );
while ( this.nodes.length > this.clones.length ){
- this.clones[ this.clones.length ] = this.getNewClone();
+ this.clones.push( this.getNewClone() );
}
LzInstantiator.clearDataReplicationQueue( );
@@ -604,7 +608,8 @@
* @return LzView: A clone mapped to the given data.
*/
function getCloneForNode ( p ){
- for ( var i = 0; i < this.clones.length; i++ ){
+ var l = this.clones.length;
+ for ( var i = 0; i < l; i++ ){
if ( this.clones[ i ].datapath.p == p ){
return this.clones[ i ];
}
@@ -624,7 +629,8 @@
*/
function setVisible ( vis ){
this.visible = vis;
- for ( var i = 0; i < this.clones.length; i++ ){
+ var l = this.clones.length;
+ for ( var i = 0; i < l; i++ ){
this.clones[ i ].setVisible( vis );
}
if (this.onvisible.ready) this.onvisible.sendEvent( vis );
@@ -650,7 +656,8 @@
if ( !didrun ){
var who = chgpkg.who;
- for ( var i = 0; i < this.clones.length; i++ ){
+ var l = this.clones.length;
+ for ( var i = 0; i < l; i++ ){
var cl = this.clones[ i ];
if ( cl.datapath.__LZneedsOpUpdate( chgpkg ) ){
cl.datapath.__LZsetData();
@@ -733,7 +740,8 @@
* @access private
*/
function updateData ( a , b ){
- for ( var i = 0; i < this.clones.length; i++ ){
+ var l = this.clones.length;
+ for ( var i = 0; i < l; i++ ){
this.clones[ i ].datapath.updateData( );
}
}
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins