cefclient: Add RootWindowManager tracking of other browsers (see #3790)

The message loop should not quit until all browsers have closed,
including browsers that are not directly associated with a RootWindow.
This commit is contained in:
Marshall Greenblatt
2024-11-04 17:12:29 -05:00
parent 47d60f3a60
commit e23264eedc
5 changed files with 65 additions and 5 deletions

View File

@@ -4,6 +4,9 @@
#include "tests/cefclient/browser/base_client_handler.h"
#include "tests/cefclient/browser/main_context.h"
#include "tests/cefclient/browser/root_window_manager.h"
namespace client {
BaseClientHandler::BaseClientHandler() {
@@ -49,6 +52,10 @@ void BaseClientHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
message_router_->AddHandler(message_handler, false);
}
}
if (track_as_other_browser_) {
MainContext::Get()->GetRootWindowManager()->OtherBrowserCreated();
}
}
void BaseClientHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
@@ -63,6 +70,10 @@ void BaseClientHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
message_handler_set_.clear();
message_router_ = nullptr;
}
if (track_as_other_browser_) {
MainContext::Get()->GetRootWindowManager()->OtherBrowserClosed();
}
}
bool BaseClientHandler::OnBeforeBrowse(CefRefPtr<CefBrowser> browser,