destroy guest webcontents before embedder
This commit is contained in:
parent
16f9754445
commit
72adbf7a2f
3 changed files with 12 additions and 9 deletions
|
@ -411,14 +411,18 @@ WebContents::~WebContents() {
|
||||||
if (type_ == WEB_VIEW)
|
if (type_ == WEB_VIEW)
|
||||||
guest_delegate_->Destroy();
|
guest_delegate_->Destroy();
|
||||||
|
|
||||||
// The WebContentsDestroyed will not be called automatically because we
|
|
||||||
// unsubscribe from webContents before destroying it. So we have to manually
|
|
||||||
// call it here to make sure "destroyed" event is emitted.
|
|
||||||
RenderViewDeleted(web_contents()->GetRenderViewHost());
|
RenderViewDeleted(web_contents()->GetRenderViewHost());
|
||||||
WebContentsDestroyed();
|
DestroyWebContents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebContents::DestroyWebContents() {
|
||||||
|
// This event is only for internal use, which is emitted when WebContents is
|
||||||
|
// being destroyed.
|
||||||
|
Emit("will-destroy");
|
||||||
|
CommonWebContentsDelegate::DestroyWebContents();
|
||||||
|
}
|
||||||
|
|
||||||
bool WebContents::DidAddMessageToConsole(content::WebContents* source,
|
bool WebContents::DidAddMessageToConsole(content::WebContents* source,
|
||||||
int32_t level,
|
int32_t level,
|
||||||
const base::string16& message,
|
const base::string16& message,
|
||||||
|
@ -919,10 +923,6 @@ bool WebContents::OnMessageReceived(const IPC::Message& message) {
|
||||||
// be destroyed on close, and WebContentsDestroyed would be called for it, so
|
// be destroyed on close, and WebContentsDestroyed would be called for it, so
|
||||||
// we need to make sure the api::WebContents is also deleted.
|
// we need to make sure the api::WebContents is also deleted.
|
||||||
void WebContents::WebContentsDestroyed() {
|
void WebContents::WebContentsDestroyed() {
|
||||||
// This event is only for internal use, which is emitted when WebContents is
|
|
||||||
// being destroyed.
|
|
||||||
Emit("will-destroy");
|
|
||||||
|
|
||||||
// Cleanup relationships with other parts.
|
// Cleanup relationships with other parts.
|
||||||
RemoveFromWeakMap();
|
RemoveFromWeakMap();
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,9 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
static void BuildPrototype(v8::Isolate* isolate,
|
static void BuildPrototype(v8::Isolate* isolate,
|
||||||
v8::Local<v8::FunctionTemplate> prototype);
|
v8::Local<v8::FunctionTemplate> prototype);
|
||||||
|
|
||||||
|
// Notifies to destroy any guest web contents before destroying self.
|
||||||
|
void DestroyWebContents();
|
||||||
|
|
||||||
int64_t GetID() const;
|
int64_t GetID() const;
|
||||||
int GetProcessID() const;
|
int GetProcessID() const;
|
||||||
Type GetType() const;
|
Type GetType() const;
|
||||||
|
|
2
vendor/brightray
vendored
2
vendor/brightray
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit d0144ba2c9024d65cdf260abf5c03c742afff3fd
|
Subproject commit 53aa2cfc8a40627d62bf5be757ff9dea444f80bd
|
Loading…
Reference in a new issue