Commit 4fffe0b3 authored by Shu-yu Guo's avatar Shu-yu Guo Committed by Commit Bot

[weakrefs] Make FinalizationGroupCleanupTask cancelable

Though the task is never explicitly canceled, making it cancelable
ensures that it is canceled on Isolate teardown.

R=ulan@chromium.org

Bug: v8:8179
Change-Id: Ic3912b7acc7249aed8397010c98dc407222e84be
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2049898Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66250}
parent 6b59380c
......@@ -16,7 +16,7 @@ namespace v8 {
namespace internal {
FinalizationGroupCleanupTask::FinalizationGroupCleanupTask(Heap* heap)
: heap_(heap) {}
: CancelableTask(heap->isolate()), heap_(heap) {}
void FinalizationGroupCleanupTask::SlowAssertNoActiveJavaScript() {
#ifdef ENABLE_SLOW_DCHECKS
......@@ -35,7 +35,7 @@ void FinalizationGroupCleanupTask::SlowAssertNoActiveJavaScript() {
#endif // ENABLE_SLOW_DCHECKS
}
void FinalizationGroupCleanupTask::Run() {
void FinalizationGroupCleanupTask::RunInternal() {
Isolate* isolate = heap_->isolate();
DCHECK(!isolate->host_cleanup_finalization_group_callback());
SlowAssertNoActiveJavaScript();
......
......@@ -5,8 +5,8 @@
#ifndef V8_HEAP_FINALIZATION_GROUP_CLEANUP_TASK_H_
#define V8_HEAP_FINALIZATION_GROUP_CLEANUP_TASK_H_
#include "include/v8-platform.h"
#include "src/objects/js-weak-refs.h"
#include "src/tasks/cancelable-task.h"
namespace v8 {
namespace internal {
......@@ -14,17 +14,16 @@ namespace internal {
// The GC schedules a cleanup task when the dirty FinalizationGroup list is
// non-empty. The task processes a single FinalizationGroup and posts another
// cleanup task if there are remaining dirty FinalizationGroups on the list.
class FinalizationGroupCleanupTask : public Task {
class FinalizationGroupCleanupTask : public CancelableTask {
public:
explicit FinalizationGroupCleanupTask(Heap* heap);
~FinalizationGroupCleanupTask() override = default;
void Run() override;
private:
FinalizationGroupCleanupTask(const FinalizationGroupCleanupTask&) = delete;
void operator=(const FinalizationGroupCleanupTask&) = delete;
void RunInternal() override;
void SlowAssertNoActiveJavaScript();
Heap* heap_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment