Commit 447d3848 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[global-handles] Improve documentation on assertion

First pass callbacks are required to reset the handle before entering
the second callback.

Make this a CHECK and properly document what is required to fix when
hitting this assertion.

Change-Id: I13c6b0342fca16544cec01620ac74a87c290b87d
Reviewed-on: https://chromium-review.googlesource.com/975609
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52169}
parent efca73ea
......@@ -877,8 +877,12 @@ void GlobalHandles::PendingPhantomCallback::Invoke(Isolate* isolate) {
callback_ = nullptr;
callback(data);
if (node_ != nullptr) {
// Transition to second pass state.
DCHECK(node_->state() == Node::FREE);
// Transition to second pass. It is required that the first pass callback
// resets the handle using |v8::PersistentBase::Reset|. Also see comments on
// |v8::WeakCallbackInfo|.
CHECK_WITH_MSG(Node::FREE == node_->state(),
"Handle not reset in first callback. See comments on "
"|v8::WeakCallbackInfo|.");
node_ = nullptr;
}
}
......
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