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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // overall), including sites in iframes. | 142 // overall), including sites in iframes. |
143 for (IsolationScenario& scenario : site_data->scenarios) { | 143 for (IsolationScenario& scenario : site_data->scenarios) { |
144 std::map<RenderFrameHost*, GURL> frame_urls; | 144 std::map<RenderFrameHost*, GURL> frame_urls; |
145 for (RenderFrameHost* frame : contents->GetAllFrames()) { | 145 for (RenderFrameHost* frame : contents->GetAllFrames()) { |
146 // Determine the site from the frame's origin, with a fallback to the | 146 // Determine the site from the frame's origin, with a fallback to the |
147 // frame's URL. In cases like <iframe sandbox>, we can wind up with an | 147 // frame's URL. In cases like <iframe sandbox>, we can wind up with an |
148 // http URL but a unique origin. The origin of the resource will still | 148 // http URL but a unique origin. The origin of the resource will still |
149 // determine process placement. | 149 // determine process placement. |
150 url::Origin origin = frame->GetLastCommittedOrigin(); | 150 url::Origin origin = frame->GetLastCommittedOrigin(); |
151 GURL site = SiteInstance::GetSiteForURL( | 151 GURL site = SiteInstance::GetSiteForURL( |
152 context, origin.unique() ? frame->GetLastCommittedURL() | 152 context, |
153 : GURL(origin.Serialize())); | 153 origin.unique() ? frame->GetLastCommittedURL() : origin.GetURL()); |
154 | 154 |
155 bool should_isolate = ShouldIsolate(context, scenario, site); | 155 bool should_isolate = ShouldIsolate(context, scenario, site); |
156 | 156 |
157 // Treat a subframe as part of its parent site if neither needs isolation. | 157 // Treat a subframe as part of its parent site if neither needs isolation. |
158 if (!should_isolate && frame->GetParent()) { | 158 if (!should_isolate && frame->GetParent()) { |
159 GURL parent_site = frame_urls[frame->GetParent()]; | 159 GURL parent_site = frame_urls[frame->GetParent()]; |
160 if (!ShouldIsolate(context, scenario, parent_site)) | 160 if (!ShouldIsolate(context, scenario, parent_site)) |
161 site = parent_site; | 161 site = parent_site; |
162 } | 162 } |
163 | 163 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 UMA_HISTOGRAM_COUNTS_100( | 283 UMA_HISTOGRAM_COUNTS_100( |
284 "SiteIsolation.IsolateExtensionsProcessCountLowerBound", | 284 "SiteIsolation.IsolateExtensionsProcessCountLowerBound", |
285 process_count_lower_bound[ISOLATE_EXTENSIONS]); | 285 process_count_lower_bound[ISOLATE_EXTENSIONS]); |
286 UMA_HISTOGRAM_COUNTS_100( | 286 UMA_HISTOGRAM_COUNTS_100( |
287 "SiteIsolation.IsolateExtensionsProcessCountEstimate", | 287 "SiteIsolation.IsolateExtensionsProcessCountEstimate", |
288 process_count_estimate[ISOLATE_EXTENSIONS]); | 288 process_count_estimate[ISOLATE_EXTENSIONS]); |
289 UMA_HISTOGRAM_COUNTS_100( | 289 UMA_HISTOGRAM_COUNTS_100( |
290 "SiteIsolation.IsolateExtensionsTotalProcessCountEstimate", | 290 "SiteIsolation.IsolateExtensionsTotalProcessCountEstimate", |
291 process_count_estimate[ISOLATE_EXTENSIONS] + non_renderer_process_count); | 291 process_count_estimate[ISOLATE_EXTENSIONS] + non_renderer_process_count); |
292 } | 292 } |
OLD | NEW |