Add SiteIsolation.IsolateExtensions metrics and tests.
These new UMA metrics estimate the process-count impact of a policy
wherein extension content and web content never share processes,
even if one contains the other in an iframe.
SiteDetailsBrowserTest: add tests for the new metrics.
WebContentsImpl: Fix a UMA metrics counting error where
<iframe src="about:blank"> was counted as a distinct site.
Now we'll only do that if we see "about:blank" in an
undifferentiated SiteInstance.
BUG=528049
Review URL: https://codereview.chromium.org/1313863006
Cr-Commit-Position: refs/heads/master@{#348690}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 99e2fa4..7d03dc1 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -171,6 +171,14 @@
bool CollectSites(BrowserContext* context,
std::set<GURL>* sites,
FrameTreeNode* node) {
+ // Record about:blank as a real (process-having) site only if the SiteInstance
+ // is unassigned. Do not otherwise depend on the siteinstance's site URL,
+ // since its value reflects the current process model, and this function
+ // should behave identically across all process models.
+ if (node->current_url() == GURL(url::kAboutBlankURL) &&
+ node->current_frame_host()->GetSiteInstance()->HasSite()) {
+ return true;
+ }
sites->insert(SiteInstance::GetSiteForURL(context, node->current_url()));
return true;
}