diff options
Diffstat (limited to 'chromium/content/browser/browser_plugin/browser_plugin_guest.cc')
-rw-r--r-- | chromium/content/browser/browser_plugin/browser_plugin_guest.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/chromium/content/browser/browser_plugin/browser_plugin_guest.cc b/chromium/content/browser/browser_plugin/browser_plugin_guest.cc index a7501a57c51..2e47c128f4d 100644 --- a/chromium/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/chromium/content/browser/browser_plugin/browser_plugin_guest.cc @@ -25,9 +25,10 @@ namespace content { BrowserPluginGuest::BrowserPluginGuest(WebContentsImpl* web_contents, BrowserPluginGuestDelegate* delegate) - : WebContentsObserver(web_contents), delegate_(delegate) { - DCHECK(web_contents); - DCHECK(delegate); + : WebContentsObserver(web_contents), + delegate_(delegate->GetGuestDelegateWeakPtr()) { + CHECK(web_contents); + CHECK(delegate_); RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Create")); } @@ -97,6 +98,11 @@ WebContentsImpl* BrowserPluginGuest::GetWebContents() const { } RenderFrameHostImpl* BrowserPluginGuest::GetProspectiveOuterDocument() { + if (!delegate_) { + // The guest delegate may only be null during some destruction scenarios. + CHECK(web_contents()->IsBeingDestroyed()); + return nullptr; + } return static_cast<RenderFrameHostImpl*>( delegate_->GetProspectiveOuterDocument()); } |