refactor: cleanup how WebContents is destroyed (#27920)

This commit is contained in:
Cheng Zhao 2021-03-07 21:14:12 +09:00 committed by GitHub
parent b3a0743121
commit f4e1a343b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 131 additions and 235 deletions

View file

@ -114,8 +114,7 @@ BaseWindow::BaseWindow(gin_helper::Arguments* args,
}
BaseWindow::~BaseWindow() {
if (!window_->IsClosed())
window_->CloseImmediately();
CloseImmediately();
// Destroy the native window in next tick because the native code might be
// iterating all windows.
@ -318,6 +317,11 @@ void BaseWindow::SetContentView(gin::Handle<View> view) {
window_->SetContentView(view->view());
}
void BaseWindow::CloseImmediately() {
if (!window_->IsClosed())
window_->CloseImmediately();
}
void BaseWindow::Close() {
window_->Close();
}