mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-26 11:41:13 +08:00
refactor: 晋升族整文件退役加生产调用点清理
This commit is contained in:
@@ -38,6 +38,7 @@ pub(crate) fn promise_native_edges(obj: &JsObject) -> Vec<JsValue> {
|
||||
/// 结算链指针是裸指针边、不在本函数改写面:晋升克隆新分配于 session arena
|
||||
/// (原件地址不变),改写场景指针天然有效;结算链接链由
|
||||
/// `migrate_settlement_to_newest_clone` 负责。
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn rewrite_promise_native(obj: &JsObject, mut rewrite: impl FnMut(JsValue) -> JsValue) {
|
||||
let Some(state) = promise_state_mut(obj) else {
|
||||
return;
|
||||
@@ -59,6 +60,7 @@ pub(crate) fn rewrite_promise_native(obj: &JsObject, mut rewrite: impl FnMut(JsV
|
||||
/// 永久丢失、原件侧消费者永不触发;每条反应的 JsValue 随状态盒其余字段同一
|
||||
/// pass 晋升/改写。结算链指针按原值保留(接链由
|
||||
/// `migrate_settlement_to_newest_clone` 负责)。
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn clone_promise_native_with_rewrite(
|
||||
old: &JsObject, new: &mut JsObject, mut rewrite: impl FnMut(JsValue) -> JsValue,
|
||||
) {
|
||||
@@ -110,6 +112,7 @@ pub(crate) fn clone_promise_native_with_rewrite(
|
||||
/// `clone_promise_native_with_rewrite`);session 搬移(GC sweep)不改结算
|
||||
/// 拓扑,不得调用。
|
||||
/// - 源非 pending 时无事可做直接返回(已结算原件不再传导)。
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn migrate_settlement_to_newest_clone(
|
||||
old: &JsObject, new: &mut JsObject, mut rewrite: impl FnMut(JsValue) -> JsValue,
|
||||
) {
|
||||
@@ -146,6 +149,7 @@ pub(crate) fn migrate_settlement_to_newest_clone(
|
||||
|
||||
/// 改写单条反应的四条 JsValue 引用(派生 promise 能力与处理器),源反应迁移
|
||||
/// 与再晋升合并共用。
|
||||
#[allow(dead_code)]
|
||||
fn rewrite_reaction<F: FnMut(JsValue) -> JsValue>(r: PromiseReaction, rewrite: &mut F) -> PromiseReaction {
|
||||
PromiseReaction {
|
||||
promise: rewrite(r.promise),
|
||||
|
||||
@@ -109,6 +109,7 @@ pub(crate) fn for_each_job_value(job: &Microtask, mut f: impl FnMut(JsValue)) {
|
||||
}
|
||||
|
||||
/// 供外部改写微任务队列中的 JsValue(session GC sweep 用)。
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn rewrite_job_values(job: &mut Microtask, mut rewrite: impl FnMut(JsValue) -> JsValue) {
|
||||
match job {
|
||||
Microtask::Reaction {
|
||||
|
||||
@@ -17,10 +17,7 @@ mod jobs;
|
||||
mod reactions;
|
||||
mod settlement;
|
||||
|
||||
pub(crate) use gc_edges::{
|
||||
clone_promise_native_with_rewrite, drop_promise_native, migrate_settlement_to_newest_clone, promise_native_edges,
|
||||
promise_native_size, rewrite_promise_native,
|
||||
};
|
||||
pub(crate) use gc_edges::{drop_promise_native, promise_native_edges, promise_native_size};
|
||||
pub(crate) use jobs::{for_each_job_value, rewrite_job_values};
|
||||
pub use reactions::promise_settled_value;
|
||||
|
||||
@@ -161,6 +158,7 @@ fn promise_state_ref(obj: &JsObject) -> Option<&PromiseState> {
|
||||
}
|
||||
|
||||
#[expect(clippy::mut_from_ref)]
|
||||
#[allow(dead_code)]
|
||||
fn promise_state_mut(obj: &JsObject) -> Option<&mut PromiseState> {
|
||||
let ptr = obj.native_data() as *mut PromiseState;
|
||||
if ptr.is_null() {
|
||||
|
||||
Reference in New Issue
Block a user