~lutostag/ubuntu/utopic/maas/1.5.2

« back to all changes in this revision

Viewing changes to src/maasserver/static/js/yui/3.4.1/loader-rollup/loader-rollup-debug.js

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-03-15 18:14:08 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20120315181408-zgl94hzo0x4n99an
Tags: 0.1+bzr295+dfsg-0ubuntu2
* debian/patches:
  - 01-fix-database-settings.patch: Update to set PSERV_URL.
  - 02-pserv-config.patch: Set port to 8001.
* debian/maas.postinst: Run maas-import-isos on install.
* debian/control: Depends on rabbitmq-server.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
YUI 3.4.1 (build 4118)
3
 
Copyright 2011 Yahoo! Inc. All rights reserved.
4
 
Licensed under the BSD License.
5
 
http://yuilibrary.com/license/
6
 
*/
7
 
YUI.add('loader-rollup', function(Y) {
8
 
 
9
 
/**
10
 
 * Optional automatic rollup logic for reducing http connections
11
 
 * when not using a combo service.
12
 
 * @module loader
13
 
 * @submodule rollup
14
 
 */
15
 
 
16
 
/**
17
 
 * Look for rollup packages to determine if all of the modules a
18
 
 * rollup supersedes are required.  If so, include the rollup to
19
 
 * help reduce the total number of connections required.  Called
20
 
 * by calculate().  This is an optional feature, and requires the
21
 
 * appropriate submodule to function.
22
 
 * @method _rollup
23
 
 * @for Loader
24
 
 * @private
25
 
 */
26
 
Y.Loader.prototype._rollup = function() {
27
 
    var i, j, m, s, r = this.required, roll,
28
 
        info = this.moduleInfo, rolled, c, smod;
29
 
 
30
 
    // find and cache rollup modules
31
 
    if (this.dirty || !this.rollups) {
32
 
        this.rollups = {};
33
 
        for (i in info) {
34
 
            if (info.hasOwnProperty(i)) {
35
 
                m = this.getModule(i);
36
 
                // if (m && m.rollup && m.supersedes) {
37
 
                if (m && m.rollup) {
38
 
                    this.rollups[i] = m;
39
 
                }
40
 
            }
41
 
        }
42
 
 
43
 
        this.forceMap = (this.force) ? Y.Array.hash(this.force) : {};
44
 
    }
45
 
 
46
 
    // make as many passes as needed to pick up rollup rollups
47
 
    for (;;) {
48
 
        rolled = false;
49
 
 
50
 
        // go through the rollup candidates
51
 
        for (i in this.rollups) {
52
 
            if (this.rollups.hasOwnProperty(i)) {
53
 
                // there can be only one, unless forced
54
 
                if (!r[i] && ((!this.loaded[i]) || this.forceMap[i])) {
55
 
                    m = this.getModule(i);
56
 
                    s = m.supersedes || [];
57
 
                    roll = false;
58
 
 
59
 
                    // @TODO remove continue
60
 
                    if (!m.rollup) {
61
 
                        continue;
62
 
                    }
63
 
 
64
 
                    c = 0;
65
 
 
66
 
                    // check the threshold
67
 
                    for (j = 0; j < s.length; j++) {
68
 
                        smod = info[s[j]];
69
 
 
70
 
                        // if the superseded module is loaded, we can't
71
 
                        // load the rollup unless it has been forced.
72
 
                        if (this.loaded[s[j]] && !this.forceMap[s[j]]) {
73
 
                            roll = false;
74
 
                            break;
75
 
                        // increment the counter if this module is required.
76
 
                        // if we are beyond the rollup threshold, we will
77
 
                        // use the rollup module
78
 
                        } else if (r[s[j]] && m.type == smod.type) {
79
 
                            c++;
80
 
                            // Y.log("adding to thresh: " + c + ", " + s[j]);
81
 
                            roll = (c >= m.rollup);
82
 
                            if (roll) {
83
 
                                // Y.log("over thresh " + c + ", " + s[j]);
84
 
                                break;
85
 
                            }
86
 
                        }
87
 
                    }
88
 
 
89
 
                    if (roll) {
90
 
                        // Y.log("adding rollup: " +  i);
91
 
                        // add the rollup
92
 
                        r[i] = true;
93
 
                        rolled = true;
94
 
 
95
 
                        // expand the rollup's dependencies
96
 
                        this.getRequires(m);
97
 
                    }
98
 
                }
99
 
            }
100
 
        }
101
 
 
102
 
        // if we made it here w/o rolling up something, we are done
103
 
        if (!rolled) {
104
 
            break;
105
 
        }
106
 
    }
107
 
};
108
 
 
109
 
 
110
 
}, '3.4.1' ,{requires:['loader-base']});