diff --git a/cocos2d/core/load-pipeline/downloader.js b/cocos2d/core/load-pipeline/downloader.js index ecbc597fc1..a6f1cab166 100644 --- a/cocos2d/core/load-pipeline/downloader.js +++ b/cocos2d/core/load-pipeline/downloader.js @@ -312,7 +312,6 @@ var Downloader = function (extMap) { this.id = ID; this.async = true; this.pipeline = null; - this.maxConcurrent = cc.sys.isMobile ? 2 : 512; this._curConcurrent = 0; this._loadQueue = []; @@ -332,13 +331,13 @@ Downloader.prototype.addHandlers = function (extMap) { Downloader.prototype.handle = function (item, callback) { var self = this; var downloadFunc = this.extMap[item.type] || this.extMap['default']; - if (this._curConcurrent < this.maxConcurrent) { + if (this._curConcurrent < cc.macro.DOWNLOAD_MAX_CONCURRENT) { this._curConcurrent++; downloadFunc.call(this, item, function (err, result) { // Concurrent logic setTimeout(function () { self._curConcurrent = Math.max(0, self._curConcurrent - 1); - while (self._curConcurrent < self.maxConcurrent) { + while (self._curConcurrent < cc.macro.DOWNLOAD_MAX_CONCURRENT) { var nextOne = self._loadQueue.shift(); if (!nextOne) { break; diff --git a/cocos2d/core/platform/CCMacro.js b/cocos2d/core/platform/CCMacro.js index 04c76a19bc..6f5a603041 100644 --- a/cocos2d/core/platform/CCMacro.js +++ b/cocos2d/core/platform/CCMacro.js @@ -1898,6 +1898,16 @@ cc.macro = { * @default true */ ENABLE_TILEDMAP_CULLING: true, + + /** + * !#en + * The max concurrent task number for the downloader + * !#zh + * 下载任务的最大并发数限制,在安卓平台部分机型或版本上可能需要限制在较低的水平 + * @property {Number} DOWNLOAD_MAX_CONCURRENT + * @default 64 + */ + DOWNLOAD_MAX_CONCURRENT: 64, }; /**