Change 20100329-maxcarlson-5 by maxcarl...@bank on 2010-03-29 14:06:03 PDT
    in /Users/maxcarlson/openlaszlo/trunk-clean
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Fix bugs in event system optimizations

Bugs Fixed: LPP-8822 - Improve layout performance 

Technical Reviewer: [email protected]
QA Reviewer: ptw

Details: In response to Andre's review:
LzTextSprite (swf8):
> +  if (! this['scrolldel']) {
> +    this.scrolldel = new LzDelegate(this, "__LZupdateScrollAttrs");
> +  }
and later:
> +    if (this.scrolldel.hasevents) {
> +        this.scrolldel.destroy();
> +    }
I'm asking myself why you've used the "save" property access (bracket syntax) 
when no harm can occur, but later the "brute force" method (scrolldel could be 
undefined)? I'd just remove the bracket syntax and use direct property access.

I was using 'save' property access because I was getting debugger warnings with 
warnUndefinedReferences turned on.  I turned it off again.

LzXMLLoader
> +        // To keep delegates from resurrecting us.  See LzDelegate#execute
> +        this.__LZdeleted = true;
LzXMLLoader is a LzLoader, which is a LzEventable, so you must not set 
_LZdeleted.

Good catch!

LzDelegate
> -        } else {
> -            keep.push( ev );
> +            this.__events.splice(i, 1);
> +            break;
>          }
You cannot use 'break' here, a delegate can be registered to an event more than 
once.

I fixed this, but I wonder if we should prevent this from occurring?  I can't 
think of a case where you'd want the same delegate registered for an event more 
than once...

LzHTTPDataProvider
> +    /**
> +     * @access private
> +     * @param LzHTTPDataRequest dreq:
> +     * @param LzDataElement data:
> +     */
> +    override function destroy() {
Wrong comment..

LzDataset
>  override function destroy () {
>      this.$lzc$set_childNodes([ ]);
> +    this.dataprovider.destroy();
You must not destroy the dataprovider, dataproviders are singleton objects! For 
example the default dataprovider for a dataset is canvas.defaultdataprovider, 
so all datasets share the same dataprovider!

LzTextSprite - Use simple property lookup for scrolldel.

LzXMLLoader - Don't set __LZdeleted, rely on LzEventable for delegate cleanup.  

LaszloEvents - Don't break early in LzDelegate.unregisterFrom().

LzHTTPDataProvider - Update comment on destroy().

LzDataset - Don't call destroy() on dataproviders.

Tests: smokecheck across runtimes.

Files:
M       WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as
M       WEB-INF/lps/lfc/kernel/swf/LzXMLLoader.lzs
M       WEB-INF/lps/lfc/events/LaszloEvents.lzs
M       WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs
M       WEB-INF/lps/lfc/data/LzDataset.lzs

Changeset: 
http://svn.openlaszlo.org/openlaszlo/patches/20100329-maxcarlson-5.tar

Reply via email to