OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/site_details.h" | 5 #include "chrome/browser/site_details.h" |
6 | 6 |
7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 #include "content/public/browser/render_frame_host.h" | 9 #include "content/public/browser/render_frame_host.h" |
10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 } | 139 } |
140 } | 140 } |
141 | 141 |
142 // Now keep track of how many sites we have in this BrowsingInstance (and | 142 // Now keep track of how many sites we have in this BrowsingInstance (and |
143 // overall), including sites in iframes. | 143 // overall), including sites in iframes. |
144 for (IsolationScenario& scenario : site_data->scenarios) { | 144 for (IsolationScenario& scenario : site_data->scenarios) { |
145 std::map<RenderFrameHost*, GURL> frame_urls; | 145 std::map<RenderFrameHost*, GURL> frame_urls; |
146 for (RenderFrameHost* frame : contents->GetAllFrames()) { | 146 for (RenderFrameHost* frame : contents->GetAllFrames()) { |
147 // Determine the site from the frame's origin, with a fallback to the | 147 // Determine the site from the frame's origin, with a fallback to the |
148 // frame's URL. In cases like <iframe sandbox>, we can wind up with an | 148 // frame's URL. In cases like <iframe sandbox>, we can wind up with an |
149 // http URL but a unique origin. The origin of the resource will still | 149 // http URL but an opaque origin. The origin of the resource will still |
150 // determine process placement. | 150 // determine process placement. |
151 url::Origin origin = frame->GetLastCommittedOrigin(); | 151 url::Origin origin = frame->GetLastCommittedOrigin(); |
152 GURL site = SiteInstance::GetSiteForURL( | 152 GURL site = SiteInstance::GetSiteForURL( |
153 context, | 153 context, |
154 origin.unique() ? frame->GetLastCommittedURL() : origin.GetURL()); | 154 origin.opaque() ? frame->GetLastCommittedURL() : origin.GetURL()); |
155 | 155 |
156 bool should_isolate = ShouldIsolate(context, scenario, site); | 156 bool should_isolate = ShouldIsolate(context, scenario, site); |
157 | 157 |
158 // Treat a subframe as part of its parent site if neither needs isolation. | 158 // Treat a subframe as part of its parent site if neither needs isolation. |
159 if (!should_isolate && frame->GetParent()) { | 159 if (!should_isolate && frame->GetParent()) { |
160 GURL parent_site = frame_urls[frame->GetParent()]; | 160 GURL parent_site = frame_urls[frame->GetParent()]; |
161 if (!ShouldIsolate(context, scenario, parent_site)) | 161 if (!ShouldIsolate(context, scenario, parent_site)) |
162 site = parent_site; | 162 site = parent_site; |
163 } | 163 } |
164 | 164 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 UMA_HISTOGRAM_COUNTS_100( | 284 UMA_HISTOGRAM_COUNTS_100( |
285 "SiteIsolation.IsolateExtensionsProcessCountLowerBound", | 285 "SiteIsolation.IsolateExtensionsProcessCountLowerBound", |
286 process_count_lower_bound[ISOLATE_EXTENSIONS]); | 286 process_count_lower_bound[ISOLATE_EXTENSIONS]); |
287 UMA_HISTOGRAM_COUNTS_100( | 287 UMA_HISTOGRAM_COUNTS_100( |
288 "SiteIsolation.IsolateExtensionsProcessCountEstimate", | 288 "SiteIsolation.IsolateExtensionsProcessCountEstimate", |
289 process_count_estimate[ISOLATE_EXTENSIONS]); | 289 process_count_estimate[ISOLATE_EXTENSIONS]); |
290 UMA_HISTOGRAM_COUNTS_100( | 290 UMA_HISTOGRAM_COUNTS_100( |
291 "SiteIsolation.IsolateExtensionsTotalProcessCountEstimate", | 291 "SiteIsolation.IsolateExtensionsTotalProcessCountEstimate", |
292 process_count_estimate[ISOLATE_EXTENSIONS] + non_renderer_process_count); | 292 process_count_estimate[ISOLATE_EXTENSIONS] + non_renderer_process_count); |
293 } | 293 } |
OLD | NEW |