[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: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52169}
This commit is contained in:
Michael Lippautz 2018-03-22 16:04:16 +01:00 committed by Commit Bot
parent efca73ea1a
commit 447d384802

View File

@ -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;
}
}