Improve logging of frame connection state (see issue #3260)

Run with "--vmodule=frame_*=1 --enable-logging=stderr --no-sandbox" on the
command-line to see these log messages from both the browser and renderer
processes.
This commit is contained in:
Marshall Greenblatt
2022-08-16 13:10:43 -04:00
parent a7e50dfe7f
commit 2bf3d536ea
5 changed files with 151 additions and 49 deletions

View File

@@ -225,8 +225,10 @@ void CefBrowserInfo::RemoveFrame(content::RenderFrameHost* host) {
// Explicitly Detach everything but the current main frame.
const auto& frame_info = *it2;
if (frame_info->frame_ && !frame_info->IsCurrentMainFrame()) {
if (frame_info->frame_->Detach())
if (frame_info->frame_->Detach(
CefFrameHostImpl::DetachReason::RENDER_FRAME_DELETED)) {
MaybeNotifyFrameDetached(browser_, frame_info->frame_);
}
}
frame_info_set_.erase(it2);
@@ -408,8 +410,9 @@ void CefBrowserInfo::SetMainFrame(CefRefPtr<CefBrowserHostBase> browser,
CefRefPtr<CefFrameHostImpl> old_frame;
if (main_frame_) {
old_frame = main_frame_;
if (old_frame->Detach())
if (old_frame->Detach(CefFrameHostImpl::DetachReason::NEW_MAIN_FRAME)) {
MaybeNotifyFrameDetached(browser, old_frame);
}
}
main_frame_ = frame;
@@ -489,8 +492,10 @@ void CefBrowserInfo::RemoveAllFrames(
// Explicitly Detach everything but the current main frame.
for (auto& info : frame_info_set_) {
if (info->frame_ && !info->IsCurrentMainFrame()) {
if (info->frame_->Detach())
if (info->frame_->Detach(
CefFrameHostImpl::DetachReason::BROWSER_DESTROYED)) {
MaybeNotifyFrameDetached(old_browser, info->frame_);
}
}
}