From 9df0cdee8f7bb4b7b38809e7173aff051824978c Mon Sep 17 00:00:00 2001 From: SmallMain Date: Tue, 22 Oct 2024 14:29:26 +0800 Subject: [PATCH] =?UTF-8?q?[adapters]=20=E5=A2=9E=E5=8A=A0=20CC=5FWORKER?= =?UTF-8?q?=5FASSET=5FPIPELINE=5FINCLUDE=5FLOAD=20=E5=AE=8F=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E8=B0=83=E6=95=B4=20CC=5FWORKER=5FDEBUG=20=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=80=BC=E4=B8=BA=20false?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adapters/platforms/wechat/res/worker_adapter/ipc-main.js | 1 + adapters/platforms/wechat/res/worker_adapter/macro.js | 5 ++++- adapters/platforms/wechat/res/workers/ipc-worker.js | 2 ++ adapters/platforms/wechat/res/workers/macro.js | 5 ++++- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/adapters/platforms/wechat/res/worker_adapter/ipc-main.js b/adapters/platforms/wechat/res/worker_adapter/ipc-main.js index ca6dc175..31ee9845 100644 --- a/adapters/platforms/wechat/res/worker_adapter/ipc-main.js +++ b/adapters/platforms/wechat/res/worker_adapter/ipc-main.js @@ -96,6 +96,7 @@ const ipcMain = { _handlers, CC_WORKER_FS_SYNC, CC_WORKER_ASSET_PIPELINE, + CC_WORKER_ASSET_PIPELINE_INCLUDE_LOAD, ]); }, diff --git a/adapters/platforms/wechat/res/worker_adapter/macro.js b/adapters/platforms/wechat/res/worker_adapter/macro.js index f8e7dadf..306a6a8e 100644 --- a/adapters/platforms/wechat/res/worker_adapter/macro.js +++ b/adapters/platforms/wechat/res/worker_adapter/macro.js @@ -9,11 +9,14 @@ const hasWorker = sdkVersion[0] > 2 || (sdkVersion[0] === 2 && (sdkVersion[1] > // 是否启用 Worker 驱动资源管线(下载、缓存) globalThis.CC_WORKER_ASSET_PIPELINE = false; +// 是否启用 Worker 驱动资源管线(加载) +globalThis.CC_WORKER_ASSET_PIPELINE_INCLUDE_LOAD = false; + // 是否启用 Worker globalThis.CC_USE_WORKER = (CC_WORKER_ASSET_PIPELINE) && hasWorker && !isSubContext; // 是否启用 Worker 调试模式 -globalThis.CC_WORKER_DEBUG = true; +globalThis.CC_WORKER_DEBUG = false; // 是否启用 Worker 调度模式,这也许能减少通信次数带来的性能消耗(必须一致) globalThis.CC_WORKER_SCHEDULER = true; diff --git a/adapters/platforms/wechat/res/workers/ipc-worker.js b/adapters/platforms/wechat/res/workers/ipc-worker.js index 767dda9b..ec36a506 100644 --- a/adapters/platforms/wechat/res/workers/ipc-worker.js +++ b/adapters/platforms/wechat/res/workers/ipc-worker.js @@ -144,6 +144,7 @@ function _initFromWorker(id, meta) { wrappers, CC_WORKER_FS_SYNC, CC_WORKER_ASSET_PIPELINE, + CC_WORKER_ASSET_PIPELINE_INCLUDE_LOAD, ] = meta; for (const wrapper of wrappers) { @@ -158,6 +159,7 @@ function _initFromWorker(id, meta) { globalThis.CC_WORKER_FS_SYNC = CC_WORKER_FS_SYNC; globalThis.CC_WORKER_ASSET_PIPELINE = CC_WORKER_ASSET_PIPELINE; + globalThis.CC_WORKER_ASSET_PIPELINE_INCLUDE_LOAD = CC_WORKER_ASSET_PIPELINE_INCLUDE_LOAD; _inited = true; if (_initCallback) _initCallback(); diff --git a/adapters/platforms/wechat/res/workers/macro.js b/adapters/platforms/wechat/res/workers/macro.js index 097c5d53..8d3d8785 100644 --- a/adapters/platforms/wechat/res/workers/macro.js +++ b/adapters/platforms/wechat/res/workers/macro.js @@ -2,7 +2,7 @@ globalThis.CC_WORKER_SCHEDULER = true; // 是否启用 Worker 调试模式 -globalThis.CC_WORKER_DEBUG = true; +globalThis.CC_WORKER_DEBUG = false; // --- 以下从主线程同步值 --- @@ -11,3 +11,6 @@ globalThis.CC_WORKER_FS_SYNC = null; // 是否启用 Worker 驱动资源管线(下载、缓存) globalThis.CC_WORKER_ASSET_PIPELINE = null; + +// 是否启用 Worker 驱动资源管线(加载) +globalThis.CC_WORKER_ASSET_PIPELINE_INCLUDE_LOAD = null;