• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_HEAP_FINALIZATION_REGISTRY_CLEANUP_TASK_H_
6 #define V8_HEAP_FINALIZATION_REGISTRY_CLEANUP_TASK_H_
7 
8 #include "src/objects/js-weak-refs.h"
9 #include "src/tasks/cancelable-task.h"
10 
11 namespace v8 {
12 namespace internal {
13 
14 // The GC schedules a cleanup task when the dirty FinalizationRegistry list is
15 // non-empty. The task processes a single FinalizationRegistry and posts another
16 // cleanup task if there are remaining dirty FinalizationRegistries on the list.
17 class FinalizationRegistryCleanupTask : public CancelableTask {
18  public:
19   explicit FinalizationRegistryCleanupTask(Heap* heap);
20   ~FinalizationRegistryCleanupTask() override = default;
21   FinalizationRegistryCleanupTask(const FinalizationRegistryCleanupTask&) =
22       delete;
23   void operator=(const FinalizationRegistryCleanupTask&) = delete;
24 
25  private:
26   void RunInternal() override;
27   void SlowAssertNoActiveJavaScript();
28 
29   Heap* heap_;
30 };
31 
32 }  // namespace internal
33 }  // namespace v8
34 
35 #endif  // V8_HEAP_FINALIZATION_REGISTRY_CLEANUP_TASK_H_
36