summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browsing_instance.cc
diff options
context:
space:
mode:
authorIain Merrick <husky@google.com>2010-11-01 12:19:54 +0000
committerIain Merrick <husky@google.com>2010-11-03 10:21:10 +0000
commit731df977c0511bca2206b5f333555b1205ff1f43 (patch)
tree0e750b949b3f00a1ac11fda25d3c2de512f2b465 /chrome/browser/browsing_instance.cc
parent5add15e10e7bb80512f2c597ca57221314abe577 (diff)
downloadexternal_chromium-731df977c0511bca2206b5f333555b1205ff1f43.zip
external_chromium-731df977c0511bca2206b5f333555b1205ff1f43.tar.gz
external_chromium-731df977c0511bca2206b5f333555b1205ff1f43.tar.bz2
Merge Chromium at r63472 : Initial merge by git.
Change-Id: Ifb9ee821af006a5f2211e81471be93ae440a1f5a
Diffstat (limited to 'chrome/browser/browsing_instance.cc')
-rw-r--r--chrome/browser/browsing_instance.cc22
1 files changed, 21 insertions, 1 deletions
diff --git a/chrome/browser/browsing_instance.cc b/chrome/browser/browsing_instance.cc
index ec433b7..e3d436b 100644
--- a/chrome/browser/browsing_instance.cc
+++ b/chrome/browser/browsing_instance.cc
@@ -121,12 +121,32 @@ void BrowsingInstance::UnregisterSiteInstance(SiteInstance* site_instance) {
// Only unregister the SiteInstance if it is the same one that is registered
// for the site. (It might have been an unregistered SiteInstance. See the
// comments in RegisterSiteInstance.)
- SiteInstanceMap* map = GetSiteInstanceMap(profile_, site_instance->site());
+
+ // We look for the site instance in both the local site_instance_map_ and also
+ // the static profile_site_instance_map_ - this is because the logic in
+ // ShouldUseProcessPerSite() can produce different results over the lifetime
+ // of Chrome (e.g. installation of apps with web extents can change our
+ // process-per-site policy for a given domain), so we don't know which map
+ // the site was put into when it was originally registered.
+ if (!RemoveSiteInstanceFromMap(&site_instance_map_, site, site_instance)) {
+ // Wasn't in our local map, so look in the static per-profile map.
+ ProfileId runtime_id = profile_ ? profile_->GetRuntimeId()
+ : Profile::InvalidProfileId;
+ RemoveSiteInstanceFromMap(
+ &profile_site_instance_map_[runtime_id], site, site_instance);
+ }
+}
+
+bool BrowsingInstance::RemoveSiteInstanceFromMap(SiteInstanceMap* map,
+ const std::string& site,
+ SiteInstance* site_instance) {
SiteInstanceMap::iterator i = map->find(site);
if (i != map->end() && i->second == site_instance) {
// Matches, so erase it.
map->erase(i);
+ return true;
}
+ return false;
}
BrowsingInstance::~BrowsingInstance() {