@@ -377,9 +377,6 @@ struct CurrentTaskState {
377377 task_id : Option < TaskId > ,
378378 execution_id : ExecutionId ,
379379
380- /// True if the current task has state in cells
381- stateful : bool ,
382-
383380 /// True if the current task uses an external invalidator
384381 has_invalidator : bool ,
385382
@@ -402,7 +399,6 @@ impl CurrentTaskState {
402399 Self {
403400 task_id : Some ( task_id) ,
404401 execution_id,
405- stateful : false ,
406402 has_invalidator : false ,
407403 cell_counters : Some ( AutoMap :: default ( ) ) ,
408404 local_tasks : Vec :: new ( ) ,
@@ -414,7 +410,6 @@ impl CurrentTaskState {
414410 Self {
415411 task_id : None ,
416412 execution_id,
417- stateful : false ,
418413 has_invalidator : false ,
419414 cell_counters : None ,
420415 local_tasks : Vec :: new ( ) ,
@@ -732,17 +727,14 @@ impl<B: Backend + 'static> TurboTasks<B> {
732727 Err ( err) => Err ( TurboTasksExecutionError :: Panic ( Arc :: new ( err) ) ) ,
733728 } ;
734729
735- let FinishedTaskState {
736- stateful,
737- has_invalidator,
738- } = this. finish_current_task_state ( ) ;
730+ let FinishedTaskState { has_invalidator } =
731+ this. finish_current_task_state ( ) ;
739732 let cell_counters = CURRENT_TASK_STATE
740733 . with ( |ts| ts. write ( ) . unwrap ( ) . cell_counters . take ( ) . unwrap ( ) ) ;
741734 this. backend . task_execution_completed (
742735 task_id,
743736 result,
744737 & cell_counters,
745- stateful,
746738 has_invalidator,
747739 & * this,
748740 )
@@ -1129,19 +1121,14 @@ impl<B: Backend + 'static> TurboTasks<B> {
11291121 }
11301122
11311123 fn finish_current_task_state ( & self ) -> FinishedTaskState {
1132- let ( stateful , has_invalidator) = CURRENT_TASK_STATE . with ( |cell| {
1124+ let has_invalidator = CURRENT_TASK_STATE . with ( |cell| {
11331125 let CurrentTaskState {
1134- stateful,
1135- has_invalidator,
1136- ..
1126+ has_invalidator, ..
11371127 } = & mut * cell. write ( ) . unwrap ( ) ;
1138- ( * stateful , * has_invalidator)
1128+ * has_invalidator
11391129 } ) ;
11401130
1141- FinishedTaskState {
1142- stateful,
1143- has_invalidator,
1144- }
1131+ FinishedTaskState { has_invalidator }
11451132 }
11461133
11471134 pub fn backend ( & self ) -> & B {
@@ -1150,9 +1137,6 @@ impl<B: Backend + 'static> TurboTasks<B> {
11501137}
11511138
11521139struct FinishedTaskState {
1153- /// True if the task has state in cells
1154- stateful : bool ,
1155-
11561140 /// True if the task uses an external invalidator
11571141 has_invalidator : bool ,
11581142}
@@ -1665,20 +1649,15 @@ pub fn mark_finished() {
16651649 } ) ;
16661650}
16671651
1668- /// Marks the current task as stateful. This prevents the tasks from being
1669- /// dropped without persisting the state.
1670- ///
16711652/// Returns a [`SerializationInvalidator`] that can be used to invalidate the
16721653/// serialization of the current task cells
1673- pub fn mark_stateful ( ) -> SerializationInvalidator {
1654+ pub fn get_serialization_invalidator ( ) -> SerializationInvalidator {
16741655 CURRENT_TASK_STATE . with ( |cell| {
1675- let CurrentTaskState {
1676- stateful, task_id, ..
1677- } = & mut * cell. write ( ) . unwrap ( ) ;
1678- * stateful = true ;
1656+ let CurrentTaskState { task_id, .. } = & mut * cell. write ( ) . unwrap ( ) ;
16791657 let Some ( task_id) = * task_id else {
16801658 panic ! (
1681- "mark_stateful() can only be used in the context of a turbo_tasks task execution"
1659+ "get_serialization_invalidator() can only be used in the context of a turbo_tasks \
1660+ task execution"
16821661 ) ;
16831662 } ;
16841663 SerializationInvalidator :: new ( task_id)
@@ -1695,8 +1674,7 @@ pub fn mark_invalidator() {
16951674}
16961675
16971676pub fn prevent_gc ( ) {
1698- // There is a hack in UpdateCellOperation that need to be updated when this is changed.
1699- mark_stateful ( ) ;
1677+ // TODO implement garbage collection
17001678}
17011679
17021680pub fn emit < T : VcValueTrait + ?Sized > ( collectible : ResolvedVc < T > ) {
0 commit comments