e371fe50702011b7021c8d79181e88184c23448bAdam Moore * Optional automatic rollup logic for reducing http connections
e371fe50702011b7021c8d79181e88184c23448bAdam Moore * when not using a combo service.
e371fe50702011b7021c8d79181e88184c23448bAdam Moore * @module loader
e371fe50702011b7021c8d79181e88184c23448bAdam Moore * @submodule rollup
e371fe50702011b7021c8d79181e88184c23448bAdam Moore * Look for rollup packages to determine if all of the modules a
e371fe50702011b7021c8d79181e88184c23448bAdam Moore * rollup supersedes are required. If so, include the rollup to
e371fe50702011b7021c8d79181e88184c23448bAdam Moore * help reduce the total number of connections required. Called
e371fe50702011b7021c8d79181e88184c23448bAdam Moore * by calculate(). This is an optional feature, and requires the
e371fe50702011b7021c8d79181e88184c23448bAdam Moore * appropriate submodule to function.
e371fe50702011b7021c8d79181e88184c23448bAdam Moore * @method _rollup
e371fe50702011b7021c8d79181e88184c23448bAdam Moore * @for Loader
e371fe50702011b7021c8d79181e88184c23448bAdam Moore // find and cache rollup modules
e371fe50702011b7021c8d79181e88184c23448bAdam Moore for (i in info) {
e371fe50702011b7021c8d79181e88184c23448bAdam Moore // if (m && m.rollup && m.supersedes) {
e371fe50702011b7021c8d79181e88184c23448bAdam Moore if (m && m.rollup) {
e371fe50702011b7021c8d79181e88184c23448bAdam Moore // make as many passes as needed to pick up rollup rollups
e371fe50702011b7021c8d79181e88184c23448bAdam Moore // go through the rollup candidates
54119bda17c0eb663f4d2147df7363de8019647fAdam Moore for (i in this.rollups) {
e371fe50702011b7021c8d79181e88184c23448bAdam Moore // there can be only one, unless forced
e371fe50702011b7021c8d79181e88184c23448bAdam Moore if (!r[i] && ((!this.loaded[i]) || this.forceMap[i])) {
e371fe50702011b7021c8d79181e88184c23448bAdam Moore // @TODO remove continue
e371fe50702011b7021c8d79181e88184c23448bAdam Moore // check the threshold
531a5eaa1b3229b1e88802ccfeb1ece1ef004f53Adam Moore // if the superseded module is loaded, we can't
b39897a381c2203466da5568bfd2862a54a81311Adam Moore // load the rollup unless it has been forced.
531a5eaa1b3229b1e88802ccfeb1ece1ef004f53Adam Moore // increment the counter if this module is required.
531a5eaa1b3229b1e88802ccfeb1ece1ef004f53Adam Moore // if we are beyond the rollup threshold, we will
b39897a381c2203466da5568bfd2862a54a81311Adam Moore // use the rollup module
e371fe50702011b7021c8d79181e88184c23448bAdam Moore // Y.log("adding to thresh: " + c + ", " + s[j]);
e371fe50702011b7021c8d79181e88184c23448bAdam Moore // Y.log("over thresh " + c + ", " + s[j]);
e371fe50702011b7021c8d79181e88184c23448bAdam Moore // Y.log("adding rollup: " + i);
e371fe50702011b7021c8d79181e88184c23448bAdam Moore // add the rollup
e371fe50702011b7021c8d79181e88184c23448bAdam Moore r[i] = true;
e371fe50702011b7021c8d79181e88184c23448bAdam Moore // expand the rollup's dependencies
e371fe50702011b7021c8d79181e88184c23448bAdam Moore // if we made it here w/o rolling up something, we are done