Commit 2018a9ef authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

bindings: Fix second pass callbacks fired during teardown sequence

Work around the problem where second pass callbacks are fired during
teardown.

Previously, these callbacks where just dropped which is not correct for
other reason, e.g., when components keep a state per process and not
just per Isolate.

Bug: chromium:890631
Change-Id: I1fd66f9ffee86c5c7bff053303c741c4dedefdb0
Reviewed-on: https://chromium-review.googlesource.com/c/1253782Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#597525}
parent f6fb96da
...@@ -21,8 +21,14 @@ void WrapperTypeInfo::WrapperCreated() { ...@@ -21,8 +21,14 @@ void WrapperTypeInfo::WrapperCreated() {
} }
void WrapperTypeInfo::WrapperDestroyed() { void WrapperTypeInfo::WrapperDestroyed() {
ThreadState* const thread_state = ThreadState::Current();
// WrapperDestroyed may be called during thread teardown as part of invoking
// V8 callbacks in which case ThreadState has already been destroyed.
if (!thread_state)
return;
ThreadHeapStatsCollector* stats_collector = ThreadHeapStatsCollector* stats_collector =
ThreadState::Current()->Heap().stats_collector(); thread_state->Heap().stats_collector();
stats_collector->DecreaseWrapperCount(1); stats_collector->DecreaseWrapperCount(1);
stats_collector->IncreaseCollectedWrapperCount(1); stats_collector->IncreaseCollectedWrapperCount(1);
} }
......
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