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

Unified Diff: content/browser/tab_contents/render_view_host_manager.cc

Issue 7725005: Fix for a memory corruption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 | « content/browser/renderer_host/render_view_host_manager_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/tab_contents/render_view_host_manager.cc
===================================================================
--- content/browser/tab_contents/render_view_host_manager.cc (revision 97282)
+++ content/browser/tab_contents/render_view_host_manager.cc (working copy)
@@ -635,8 +635,19 @@
// in case we navigate back to it.
if (old_render_view_host->IsRenderViewLive()) {
DCHECK(old_render_view_host->is_swapped_out());
- swapped_out_hosts_[old_render_view_host->site_instance()->id()] =
- old_render_view_host;
+ // Temp fix for http://crbug.com/90867 until we do a better cleanup to make
+ // sure we don't get different rvh instances for the same site instance
+ // in the same rvhmgr.
+ // TODO(creis): Clean this up, and duplication in SwapInRenderViewHost.
+ int32 old_site_instance_id = old_render_view_host->site_instance()->id();
+ RenderViewHostMap::iterator iter =
+ swapped_out_hosts_.find(old_site_instance_id);
+ if (iter != swapped_out_hosts_.end() &&
+ iter->second != old_render_view_host) {
+ // Shutdown the RVH that will be replaced in the map to avoid a leak.
+ iter->second->Shutdown();
+ }
+ swapped_out_hosts_[old_site_instance_id] = old_render_view_host;
} else {
old_render_view_host->Shutdown();
}
@@ -855,8 +866,19 @@
// in case we navigate back to it.
if (old_render_view_host->IsRenderViewLive()) {
DCHECK(old_render_view_host->is_swapped_out());
- swapped_out_hosts_[old_render_view_host->site_instance()->id()] =
- old_render_view_host;
+ // Temp fix for http://crbug.com/90867 until we do a better cleanup to make
+ // sure we don't get different rvh instances for the same site instance
+ // in the same rvhmgr.
+ // TODO(creis): Clean this up as well as duplication with CommitPending.
+ int32 old_site_instance_id = old_render_view_host->site_instance()->id();
+ RenderViewHostMap::iterator iter =
+ swapped_out_hosts_.find(old_site_instance_id);
+ if (iter != swapped_out_hosts_.end() &&
+ iter->second != old_render_view_host) {
+ // Shutdown the RVH that will be replaced in the map to avoid a leak.
+ iter->second->Shutdown();
+ }
+ swapped_out_hosts_[old_site_instance_id] = old_render_view_host;
} else {
old_render_view_host->Shutdown();
}
« no previous file with comments | « content/browser/renderer_host/render_view_host_manager_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698