Avoid re-registration of a RenderViewHost with NotificationRegistrar which can occur after a renderer crashes.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@980 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2013-01-11 23:20:13 +00:00
parent 7d3bac19a9
commit 60319f0cea
1 changed files with 13 additions and 4 deletions

View File

@ -1647,14 +1647,23 @@ void CefBrowserHostImpl::RenderViewCreated(
devtools_delegate->GetDevToolsURL(render_view_host, false);
}
registrar_->Add(this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
content::Source<content::RenderViewHost>(render_view_host));
// May be already registered if the renderer crashed previously.
if (!registrar_->IsRegistered(
this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
content::Source<content::RenderViewHost>(render_view_host))) {
registrar_->Add(this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
content::Source<content::RenderViewHost>(render_view_host));
}
}
void CefBrowserHostImpl::RenderViewDeleted(
content::RenderViewHost* render_view_host) {
registrar_->Remove(this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
content::Source<content::RenderViewHost>(render_view_host));
if (registrar_->IsRegistered(
this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
content::Source<content::RenderViewHost>(render_view_host))) {
registrar_->Remove(this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
content::Source<content::RenderViewHost>(render_view_host));
}
}
void CefBrowserHostImpl::RenderViewReady() {