Release render view's remote objects when it's deleted.
Privously we release them when the window is unloaded, which is not correct since a render view can have multiple windows (or js contexts) and when the unload event is emitted the render view could already have gone. This PR does the cleaning work purely in browser, so here is no need to worry about renderer's life time.
This commit is contained in:
parent
e9e90b481a
commit
623e0f3ae4
8 changed files with 28 additions and 11 deletions
|
@ -268,6 +268,11 @@ void NativeWindow::NotifyWindowClosed() {
|
|||
if (is_closed_)
|
||||
return;
|
||||
|
||||
// The OnRenderViewDeleted is not called when the WebContents is destroyed
|
||||
// directly (e.g. when closing the window), so we make sure it's always
|
||||
// emitted to users by sending it before window is closed..
|
||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnRenderViewDeleted());
|
||||
|
||||
is_closed_ = true;
|
||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowClosed());
|
||||
|
||||
|
@ -393,6 +398,10 @@ bool NativeWindow::OnMessageReceived(const IPC::Message& message) {
|
|||
return handled;
|
||||
}
|
||||
|
||||
void NativeWindow::RenderViewDeleted(content::RenderViewHost*) {
|
||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnRenderViewDeleted());
|
||||
}
|
||||
|
||||
void NativeWindow::RenderViewGone(base::TerminationStatus status) {
|
||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnRendererCrashed());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue