Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Unified Diff: extensions/browser/process_manager.cc

Issue 169413002: Removing unnecessary creation of RenderViewHostDestructionObserver for all WebContents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/browser/process_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/process_manager.cc
diff --git a/extensions/browser/process_manager.cc b/extensions/browser/process_manager.cc
index 89f28095a3d0388fdec7f08c54061a0e65a700fd..96a8b2867c18a7b4c84774dea5d9e13ab07d93ab 100644
--- a/extensions/browser/process_manager.cc
+++ b/extensions/browser/process_manager.cc
@@ -343,11 +343,11 @@ void ProcessManager::UnregisterRenderViewHost(
}
}
-void ProcessManager::RegisterRenderViewHost(RenderViewHost* render_view_host) {
+bool ProcessManager::RegisterRenderViewHost(RenderViewHost* render_view_host) {
const Extension* extension = GetExtensionForRenderViewHost(
render_view_host);
if (!extension)
- return;
+ return false;
WebContents* web_contents = WebContents::FromRenderViewHost(render_view_host);
all_extension_views_[render_view_host] = GetViewType(web_contents);
@@ -356,6 +356,7 @@ void ProcessManager::RegisterRenderViewHost(RenderViewHost* render_view_host) {
// extension views are visible. Keepalive count balanced in
// UnregisterRenderViewHost.
IncrementLazyKeepaliveCountForView(render_view_host);
+ return true;
}
SiteInstance* ProcessManager::GetSiteInstanceForURL(const GURL& url) {
@@ -672,8 +673,9 @@ void ProcessManager::Observe(int type,
// The above will unregister a RVH when it gets swapped out with a new
// one. However we need to watch the WebContents to know when a RVH is
// deleted because the WebContents has gone away.
- RenderViewHostDestructionObserver::CreateForWebContents(contents);
- RegisterRenderViewHost(switched_details->second);
+ if (RegisterRenderViewHost(switched_details->second)) {
+ RenderViewHostDestructionObserver::CreateForWebContents(contents);
+ }
break;
}
« no previous file with comments | « extensions/browser/process_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698