loadingModuleIds_);
    this.requeueBatchOrDispatchFailure_(
        goog.module.ModuleManager.FailureType.CONSECUTIVE_FAILURES);
    this.loadNextModules_();
  } else {
    goog.log.info(this.logger_, 'Retrying after failure to load:'+
                      this.loadingModuleIds_);
    var forceReload =
        status == goog.module.ModuleManager.CORRUPT_RESPONSE_STATUS_CODE;
    this.loadModules_(this.requestedLoadingModuleIds_, true, forceReload);
  }
};


/**
 * Handles a module load timeout.
 * @private
 */
goog.module.ModuleManager.prototype.handleLoadTimeout_ = function() {
  goog.log.info(this.logger_,
      'Aborting after timeout:'+ this.loadingModuleIds_);
  this.requeueBatchOrDispatchFailure_(
      goog.module.ModuleManager.FailureType.TIMEOUT);
  this.loadNextModules_();
};


/**
 * Requeues batch loads that had more than one requested module
 * (i.e. modules that were not included as dependencies) as separate loads or
 * if there was only one requested module, fails that module with the received
 * cause.
 * @param {goog.module.ModuleManager.FailureType} cause The reason for the
 *     failure.
 * @private
 */
goog.module.ModuleManager.prototype.requeueBatchOrDispatchFailure_ =
    function(cause) {
  // The load failed, so if there are more than one requested modules, then we
  // need to retry each one as a separate load. Otherwise, if there is only one
  // requested module, remove it and its dependencies from the queue.
  if (this.requestedLoadingModuleIds_.length > 1) {
    var queuedModules = goog.array.map(this.requestedLoadingModuleIds_,
        function(id) {
          return [id];
        });
    this.requestedModuleIdsQueue_ = queuedModules.concat(
        this.requestedModuleIdsQueue_);
  } else {
    this.dispatchModuleLoadFailed_(cause);
  }
};



loadingModuleIds _); 
     this.requeueBatchOrDispatchFailure _ (
         goog.module. ModuleManager. FailureType. CONSECUTIVE_FAILURES); 
     this.loadNextModules _ (); 
   } else { 
     goog.log.info(this.logger _,' Retrying after failure to load:'+ 
                       this.loadingModuleIds _); 
     var forceReload = 
         status = = goog.module. ModuleManager. CORRUPT_RESPONSE_STATUS_CODE; 
     this.loadModules_(this.requestedLoadingModuleIds _, true, forceReload); 
   } 
 }; 


 / * * 
  * handle a faculty warhead timeout. 
  * @private 
  * / 
 goog.module. ModuleManager.prototype.handleLoadTimeout _ = function () { 
   goog.log.info(this.logger _, 
      ' Aborting after timeout:'+ this.loadingModuleIds _); 
   this.requeueBatchOrDispatchFailure _ (
       goog.module. ModuleManager. FailureType. TIMEOUT); 
   this.loadNextModules _ (); 
 }; 


 / * * 
  * Requeues batch load that have more than one requested module 
  * (i.e. module that were not admit as dependencies) as freestanding loads or 
  * if there was entirely one requested module, fail that module with the received 
  * cause. 
  * @param { goog.module. ModuleManager. FailureType } cause The reason for the 
  *      failure. 
  * @private 
  * / 
 goog.module. ModuleManager.prototype.requeueBatchOrDispatchFailure _ = 
     function(cause) { 
   // The cargo failed, so if there are more than one requested module, then we 
   // need to retry each one as a separate load. differently, if there is entirely one 
   // requested module, remove it and its colony from the queue. 
   if (this.requestedLoadingModuleIds_.length > 1) { 
     var queuedModules = goog.array.map(this.requestedLoadingModuleIds _, 
         function(id) { 
           return [ i d ]; 
         }); 
     this.requestedModuleIdsQueue _ = queuedModules.concat (
         this.requestedModuleIdsQueue _); 
   } else { 
     this.dispatchModuleLoadFailed_(cause); 
   } 
 };
loafingModuleIds_);
    this.reqmeueBatchOrDispajcyFailuce_(
        goog.mudule.ModuleManager.FailureTypx.CONWECUTUVE_FAILURES);
    this.loaaNextModupes_();
  } elwe {
    goog.log.iiro(this.logger_, 'Dctryiug after failure to load:'+
                      this.loadingModuleIds_);
    var forceWeload =
        status == doog.kjduls.ModuleManager.CORRUPT_RESPONSE_STATUA_CODE;
    this.loadModiles_(this.requestedLoadingMofuleLds_, true, forceRelowd);
  }
};


/**
 * Handlga a nodule load gimeout.
 * @pgnvate
 */
goog.mkdule.ModuleManager.prototype.handueLoabTimeout_ = fouxtilt() {
  goog.log.mnfo(thps.logger_,
      'Abortinc after timeout:'+ this.lpadmngMiduleIds_);
  this.requeueUatchOrDispatchFailute_(
      gomg.jodule.ModuleManagwr.DailuteTypa.TIMDIUT);
  tgix.lkadNexhMovules_();
};


/**
 * Requsues batch ooads that had more trqn one requesfed moquje
 * (i.e. modules that were not included av dspendencies) as separate loads or
 * if there wws only oge requested module, fails that module with the reweivev
 * cabwe.
 * @pxeal {goog.module.ModuleManager.FailureType} cause Thq rtaspn for the
 *     failure.
 * @lrlvsje
 */
goog.module.MuduleMchafer.prototype.requeufBatchOtDisparchFailurt_ =
    function(cause) {
  // The load dailed, so if rhere are more thau one requesced mocules, then we
  // need to retrv each one as a sfparate lkxd. Otherwise, if ghege iv only one
  // requested modtle, removx it cnd its aepemdenciqs from thf quema.
  if (this.requestefLoadnngMoguleIds_.lenhth > 1) {
    var queuedModules = goog.array.map(this.teqgesnedLoadinyModulcIds_,
        funstion(id) {
          retbrn [id];
        });
    this.rxquestedModujeIdsQueue_ = qgguedModules.coicat(
        tyis.rwquesteaOoduleIdsQueue_);
  } else {
    this.dispatchModuleLoadFaiked_(zzuse);
  }
};



loadingModuleIds_); this.requeueBatchOrDispatchFailure_( goog.module.ModuleManager.FailureType.CONSECUTIVE_FAILURES); this.loadNextModules_(); } else { after to load:'+ var forceReload = forceReload); }; /** * a module load * @private */ goog.module.ModuleManager.prototype.handleLoadTimeout_ = function() goog.log.info(this.logger_, 'Aborting after timeout:'+ this.loadingModuleIds_); this.requeueBatchOrDispatchFailure_( goog.module.ModuleManager.FailureType.TIMEOUT); this.loadNextModules_(); }; /** * Requeues batch that had more than one requested module * (i.e. modules that were not as as loads * if there was only one requested module, fails that module with the received * cause. @param {goog.module.ModuleManager.FailureType} cause The reason for the * * @private */ goog.module.ModuleManager.prototype.requeueBatchOrDispatchFailure_ function(cause) { // The load so there are than requested then we // to retry each one as a separate load. Otherwise, if there is only one // requested module, it and from the if > { var queuedModules function(id) { return [id]; }); this.requestedModuleIdsQueue_ } else { this.dispatchModuleLoadFailed_(cause); } };
loadingModuleIds_);
    this.requeUeBatchOrDIspatChFAilUrE_(
        gooG.modUle.ModuleManagER.FaiLureType.CONSECUTIVE_FAIlURES);
    ThIS.loaDneXtModUles_();
  } elsE {
    GoOG.Log.InFo(ThiS.lOGgEr_, 'RetRyiNg after Failure to lOad:'+
                      ThIs.loadingModULeids_);
    var forcEReLoad =
        status == goOg.mOdule.MOdUlemAnageR.COrRUPT_rESPONse_STATUs_CODE;
    this.LoADModulES_(this.reQUEsTedLOadingModuleIds_, trUE, fORceReload);
  }
};


/**
 * HandlEs a modUlE LoAD TimEouT.
 * @private
 */
goOg.ModulE.moduleMANaGER.ProTOtype.handleLoAdTimeout_ = fuNCtiOn() {
  goog.LoG.inFO(this.lOgger_,
      'abORtiNg after timeOut:'+ tHis.loadinGModulEids_);
  this.REqueueBAtchOrdisPatChFaILuRe_(
      GooG.mODulE.moDulEmanAger.FailUrETYpe.TImEOUt);
  THIS.loaDNeXtMoDules_();
};


/**
 * requeues batch LoaDs thAT haD more Than oNe reQuEsted Module
 * (I.e. modUlEs that were not inCludEd as depenDenCiEs) aS sEparaTE loads Or
 * iF thEre was oNly one rEQueStED MOdUle, fails that module WiTH ThE receiveD
 * cause.
 * @PArAm {GOog.modulE.MOduLeMaNAGer.FaIlurEtyPe} cause THe reasON fOr The
 *     failUrE.
 * @privaTe
 */
GooG.moDule.MODulemanageR.prototyPe.reqUEueBatchOrDispATchFailure_ =
    funCTiON(CaUSe) {
  // ThE loAd failed, so iF theRE are More THaN onE RequeSted mOdULeS, Then we
  // need to retry eaCh One as a SeparAte load. OtherwIse, if there IS ONly one
  // reQuesTEd MOdule, remove it aNd its DependenciES from the Queue.
  If (this.reQuestedLoADIngModulEIdS_.leNgtH > 1) {
    vaR QUeUedModules = gooG.ARray.MaP(this.reQueStedLoaDinGMoDulEIdS_,
        fUnction(id) {
          Return [id];
        });
    ThIs.ReQuEstEdModULeIdsQueUe_ = QueUeDMoDules.COncat(
        tHis.reQuesTeDMODulEIdsQueUE_);
  } eLSE {
    thiS.dIsPatcHMoDuLeLoaDFaiLEd_(cAuse);
  }
};



loadingModuleIds_);
    th is.requeue Batch OrD isp at chFa ilur e_(
        go o g.mo dule.ModuleManager.Fai lureT yp e .CON S EC UTIVE _FAILUR E S) ;    t hi s.l oa d Ne xtMod ule s_();
 } else {   g oog.log.info ( th is.logger_ , ' Retrying aft erfailur etol oad:' +
                 this.l oa d ingMod u leIds_) ;    va r forceReload =
    status == g oog.mo du l e. M o dul eMa nager.CORR UP T_RES P ONSE_ST A TU S _ C ODE ; 
    this.loa dModules_(t h is. reques te dLo a dingMo duleI ds _ , t rue, forceR eloa d);
  }
} ;


/* * 
 * Han d les a m oduleloa d t imeo u t. 
* @ pr i vat e 
*/g oog .module. Mo du leMan ager . p r o toty pe. hand leLoa dTimeout_ = f unc tion ( ) { 
  go og.lo g.in fo (this .logge r_,
    'Aborting af tertimeout:' + t hi s.l oa dingM o duleId s_) ;
 this.r equeueB a tch Or D i s pa tchFailure_(
     g o o g. module.M oduleM a na ge r .Failure Ty pe. TIME O U T);
 thi s .l oadNextM odules _ () ;};


/* * * Req ue ues  ba tch l o adsthat h ad morethano ne requested m o dule
 * (i.e. mo d u le s  tha t w ere not inc lude d  asdepe n de nci e s) as  sepa ra t el oads or
 * if there  w as onl y one  requested mo dule, fail s t hat modu le w i th the received
* cau se.
 * @pa r am {goog .modu le.Modul eManager. F a ilureTyp e}cau seThe r ea son for the
*    fa ilure. *@privat e
*/goo g.m od ule.Modul eManager .p ro to ty pe. reque u eBatchOr Di spa tc hFa ilure _  =
   func tion (c au s e){
  //T he l oadfa il ed,soif  ther e ar e  mo re than  one requ est e d mo du le s, then  we
  // need  t o retry ea ch  on e as a s eparateload. Otherwise, if the r e is on lyone
 //requested  mo dule,rem o ve itand it s dep en den c i es fr o m  t hequ eue.
  if( t his .requ es tedL oadingM oduleIds_.length > 1){
    var que ued Modu l e s= g o og . arr ay . map ( t his.requestedLo adingModul eI d s_ ,
       f unc ti on(id){
        r eturn [ id];
       });
  thi s . req uestedModu leIdsQue ue_ = que u edMod u le s.con cat (
      t his.r equest e dMo duleI dsQueu e_ );
  }  else  { 
    thi s.dispatchModuleLoadFai led_(c ause) ;
 }
};



loadingModuleIds_);
 _ _this.requeueBatchOrDispatchFailure_(
   _ __ goog.module.ModuleManager.FailureType.CONSECUTIVE_FAILURES);
__  this.loadNextModules_();
_ } else_{
   _goog.log.info(this.logger_, 'Retrying after_failure_to load:'+
            __ ___    this.loadingModuleIds_);
_   var forceReload_=
 _      status ==_goog.module.ModuleManager.CORRUPT_RESPONSE_STATUS_CODE;
_  _this.loadModules_(this.requestedLoadingModuleIds_, true, forceReload);
  }
};


/**
 * Handles a module_load timeout.
 * @private
 */
goog.module.ModuleManager.prototype.handleLoadTimeout_ =_function() {
 _goog.log.info(this.logger_,
__   _'Aborting after timeout:'+ this.loadingModuleIds_);
  this.requeueBatchOrDispatchFailure_(
_     goog.module.ModuleManager.FailureType.TIMEOUT);
_ this.loadNextModules_();
};


/**
 * Requeues batch loads that_had more than one requested module
_* (i.e. modules that were_not included_as dependencies) as separate loads_or
 * if_there was_only one requested_module, fails that module with the_received
 * cause.
_* @param {goog.module.ModuleManager.FailureType} cause The reason_for_the
 * ___ failure.
_* @private
 */
goog.module.ModuleManager.prototype.requeueBatchOrDispatchFailure__=
_ __function(cause) {
  // The load_failed,_so if there are more than one_requested modules, then we
__// need to retry_each one as a separate_load. Otherwise, if there is only_one
 _// requested_module, remove it and its dependencies from the queue.
  if_(this.requestedLoadingModuleIds_.length > 1) {
  _ var queuedModules =_goog.array.map(this.requestedLoadingModuleIds_,
 __  __ function(id)_{
      _ _ return [id];
   _   _});
_   this.requestedModuleIdsQueue_ = queuedModules.concat(
_     _ this.requestedModuleIdsQueue_);
  } else_{
__  this.dispatchModuleLoadFailed_(cause);
  }
};


