fix: early GC of WebFrameMain instances (#27648)
This commit is contained in:
parent
bc7c290601
commit
1bbfa934f0
2 changed files with 13 additions and 2 deletions
|
@ -57,6 +57,9 @@ WebFrameMain::~WebFrameMain() {
|
|||
}
|
||||
|
||||
void WebFrameMain::MarkRenderFrameDisposed() {
|
||||
if (render_frame_disposed_)
|
||||
return;
|
||||
Unpin();
|
||||
g_render_frame_map.Get().erase(render_frame_);
|
||||
render_frame_disposed_ = true;
|
||||
}
|
||||
|
@ -305,8 +308,14 @@ gin::Handle<WebFrameMain> WebFrameMain::From(v8::Isolate* isolate,
|
|||
if (rfh == nullptr)
|
||||
return gin::Handle<WebFrameMain>();
|
||||
auto* web_frame = FromRenderFrameHost(rfh);
|
||||
auto handle = gin::CreateHandle(
|
||||
isolate, web_frame == nullptr ? new WebFrameMain(rfh) : web_frame);
|
||||
if (web_frame)
|
||||
return gin::CreateHandle(isolate, web_frame);
|
||||
|
||||
auto handle = gin::CreateHandle(isolate, new WebFrameMain(rfh));
|
||||
|
||||
// Prevent garbage collection of frame until it has been deleted internally.
|
||||
handle->Pin(isolate);
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue