Commit 0a78f454 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

Reland "[global-handles] Do not clear finalization callback on moving"

This is a reland of d8a457cb

Original change's description:
> [global-handles] Do not clear finalization callback on moving
>
> Bug: chromium:923361
> Change-Id: Id4a0f6515f6b17cec2732df561c1e82080dc29c8
> Reviewed-on: https://chromium-review.googlesource.com/c/1462963
> Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#59498}

Bug: chromium:923361
Tbr: mlippautz@chromium.org
Change-Id: I05bbaa05daf07232f5356cb0a71d6d1c959ddadd
Reviewed-on: https://chromium-review.googlesource.com/c/1466648Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59533}
parent a439a7a2
......@@ -654,6 +654,7 @@ class GlobalHandles::TracedNode final
set_parameter(parameter);
callback_ = callback;
}
bool HasFinalizationCallback() const { return callback_ != nullptr; }
void CollectPhantomCallbackData(
std::vector<std::pair<TracedNode*, PendingPhantomCallback>>*
......@@ -769,7 +770,12 @@ void GlobalHandles::MoveTracedGlobal(Address** from, Address** to) {
DCHECK_NOT_NULL(*to);
DCHECK_EQ(*from, *to);
TracedNode* node = TracedNode::FromLocation(*from);
node->set_parameter(to);
// Only set the backpointer for clearing a phantom handle when there is no
// finalization callback attached. As soon as a callback is attached to a node
// the embedder is on its own when resetting a handle.
if (!node->HasFinalizationCallback()) {
node->set_parameter(to);
}
}
void GlobalHandles::Destroy(Address* location) {
......
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