pooling and children removal

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

pooling and children removal

Schock, Johannes <NIVUS GmbH>
Hello,
I try to use pooling with my qx.application, because it gives me a significant performance boost on mobile devices (especially Android devices).
For structuring (and for setting huge widget selections to "excluded" with one command) I use many widgets including qx.ui.core.MChildrenHandling.
After leaving a menu I iterate through all containers recursively  and add them and their children to a pool.
For widget creation I try to get an instance from the pool.

This is working really fine but after some time I get the following error (on Chrome for Android):

"Uncaught HierarchyRequestError: Failed to execute 'appendChild' on 'Node': The new child element contains the parent"

With disposal of the Elements, everything runs fine.
This leads me to the conclusion that the objects aren't always removed from their DOM parent which leads to recursion (the parent node is added to an old child node).
Can someone point me in right direction how to ensure the removal of the child nodes before pooling them?

function getPoolElement(type) {
  var elem = pool.getObject(type);
  //console.log(type.toString() + " " + elem.$$hash + " " + elem.classname);
  return elem;
}

function poolElements(container) {
  var children = container.removeAll();
  for(var i = 0; i < children.length; i++) {
    if(children[i].classname == "guibuilder.group")
      poolElements(children[i]);
    else if(children[i].classname == "guibuilder.picgroup")
      poolElements(children[i]);
    else if(children[i].classname == "guibuilder.tablegroup")
      poolElements(children[i]);
    else if(children[i].classname == "guibuilder.bordergroup")
      poolElements(children[i]);
    else if(children[i].classname == "guibuilder.smallchoice" || children[i].classname == "guibuilder.choice") {
      var opts = children[i].removeAll();
      for(var j = 0; j < opts.length; j++) {
        pool.poolObject(opts[j]);
        //opts[j].dispose();
      }
    }
    pool.poolObject(children[i]);
    //children[i].dispose();
  }
}

Regards, Johannes

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: pooling and children removal

Dietrich Streifert
Hi Johannes,

Please could you re-ask your question via Stack Overflow with the
"qooxdoo" tag?  We’re trying to build up a more public list of Q&A and
it would be really helpful to have your question listed there.

http://stackoverflow.com/questions/tagged/qooxdoo

Thank you.

Regards
Dietrich

Am 03.06.2016 um 15:52 schrieb Schock, Johannes <NIVUS GmbH>:

> Hello,
> I try to use pooling with my qx.application, because it gives me a significant performance boost on mobile devices (especially Android devices).
> For structuring (and for setting huge widget selections to "excluded" with one command) I use many widgets including qx.ui.core.MChildrenHandling.
> After leaving a menu I iterate through all containers recursively  and add them and their children to a pool.
> For widget creation I try to get an instance from the pool.
>
> This is working really fine but after some time I get the following error (on Chrome for Android):
>
> "Uncaught HierarchyRequestError: Failed to execute 'appendChild' on 'Node': The new child element contains the parent"
>
> With disposal of the Elements, everything runs fine.
> This leads me to the conclusion that the objects aren't always removed from their DOM parent which leads to recursion (the parent node is added to an old child node).
> Can someone point me in right direction how to ensure the removal of the child nodes before pooling them?
>
> function getPoolElement(type) {
>    var elem = pool.getObject(type);
>    //console.log(type.toString() + " " + elem.$$hash + " " + elem.classname);
>    return elem;
> }
>
> function poolElements(container) {
>    var children = container.removeAll();
>    for(var i = 0; i < children.length; i++) {
>      if(children[i].classname == "guibuilder.group")
>        poolElements(children[i]);
>      else if(children[i].classname == "guibuilder.picgroup")
>        poolElements(children[i]);
>      else if(children[i].classname == "guibuilder.tablegroup")
>        poolElements(children[i]);
>      else if(children[i].classname == "guibuilder.bordergroup")
>        poolElements(children[i]);
>      else if(children[i].classname == "guibuilder.smallchoice" || children[i].classname == "guibuilder.choice") {
>        var opts = children[i].removeAll();
>        for(var j = 0; j < opts.length; j++) {
>          pool.poolObject(opts[j]);
>          //opts[j].dispose();
>        }
>      }
>      pool.poolObject(children[i]);
>      //children[i].dispose();
>    }
> }
>
> Regards, Johannes
> s://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel