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

Side by Side Diff: content/browser/site_instance_impl.cc

Issue 1874543002: Inside of content, prefer SiteInstanceImpl to SiteInstance. Base URL: https://chromium.googlesource.com/chromium/src.git@site_instance_unittest
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « content/browser/site_instance_impl.h ('k') | content/browser/site_per_process_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/site_instance_impl.h" 5 #include "content/browser/site_instance_impl.h"
6 6
7 #include "content/browser/browsing_instance.h" 7 #include "content/browser/browsing_instance.h"
8 #include "content/browser/child_process_security_policy_impl.h" 8 #include "content/browser/child_process_security_policy_impl.h"
9 #include "content/browser/frame_host/debug_urls.h" 9 #include "content/browser/frame_host/debug_urls.h"
10 #include "content/browser/frame_host/frame_tree_node.h" 10 #include "content/browser/frame_host/frame_tree_node.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 bool SiteInstanceImpl::HasSite() const { 187 bool SiteInstanceImpl::HasSite() const {
188 return has_site_; 188 return has_site_;
189 } 189 }
190 190
191 bool SiteInstanceImpl::HasRelatedSiteInstance(const GURL& url) { 191 bool SiteInstanceImpl::HasRelatedSiteInstance(const GURL& url) {
192 return browsing_instance_->HasSiteInstance(url); 192 return browsing_instance_->HasSiteInstance(url);
193 } 193 }
194 194
195 scoped_refptr<SiteInstance> SiteInstanceImpl::GetRelatedSiteInstance( 195 scoped_refptr<SiteInstance> SiteInstanceImpl::GetRelatedSiteInstance(
196 const GURL& url) { 196 const GURL& url) {
197 return browsing_instance_->GetSiteInstanceForURL(url); 197 return GetRelatedSiteInstanceImpl(url);
198 } 198 }
199 199
200 bool SiteInstanceImpl::IsRelatedSiteInstance(const SiteInstance* instance) { 200 bool SiteInstanceImpl::IsRelatedSiteInstance(const SiteInstance* instance) {
201 return browsing_instance_.get() == static_cast<const SiteInstanceImpl*>( 201 return browsing_instance_.get() == static_cast<const SiteInstanceImpl*>(
202 instance)->browsing_instance_.get(); 202 instance)->browsing_instance_.get();
203 } 203 }
204 204
205 size_t SiteInstanceImpl::GetRelatedActiveContentsCount() { 205 size_t SiteInstanceImpl::GetRelatedActiveContentsCount() {
206 return browsing_instance_->active_contents_count(); 206 return browsing_instance_->active_contents_count();
207 } 207 }
(...skipping 12 matching lines...) Expand all
220 if (IsRendererDebugURL(url)) 220 if (IsRendererDebugURL(url))
221 return false; 221 return false;
222 222
223 // If the site URL is an extension (e.g., for hosted apps or WebUI) but the 223 // If the site URL is an extension (e.g., for hosted apps or WebUI) but the
224 // process is not (or vice versa), make sure we notice and fix it. 224 // process is not (or vice versa), make sure we notice and fix it.
225 GURL site_url = GetSiteForURL(browsing_instance_->browser_context(), url); 225 GURL site_url = GetSiteForURL(browsing_instance_->browser_context(), url);
226 return !RenderProcessHostImpl::IsSuitableHost( 226 return !RenderProcessHostImpl::IsSuitableHost(
227 GetProcess(), browsing_instance_->browser_context(), site_url); 227 GetProcess(), browsing_instance_->browser_context(), site_url);
228 } 228 }
229 229
230 scoped_refptr<SiteInstanceImpl> SiteInstanceImpl::GetRelatedSiteInstanceImpl(
231 const GURL& url) {
232 return browsing_instance_->GetSiteInstanceForURL(url);
233 }
234
230 scoped_refptr<SiteInstanceImpl> 235 scoped_refptr<SiteInstanceImpl>
231 SiteInstanceImpl::GetDefaultSubframeSiteInstance() { 236 SiteInstanceImpl::GetDefaultSubframeSiteInstance() {
232 return browsing_instance_->GetDefaultSubframeSiteInstance(); 237 return browsing_instance_->GetDefaultSubframeSiteInstance();
233 } 238 }
234 239
235 bool SiteInstanceImpl::RequiresDedicatedProcess() { 240 bool SiteInstanceImpl::RequiresDedicatedProcess() {
236 if (!has_site_) 241 if (!has_site_)
237 return false; 242 return false;
238 243
239 return DoesSiteRequireDedicatedProcess(GetBrowserContext(), site_); 244 return DoesSiteRequireDedicatedProcess(GetBrowserContext(), site_);
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 browsing_instance_->browser_context(), site_)) 447 browsing_instance_->browser_context(), site_))
443 return; 448 return;
444 449
445 ChildProcessSecurityPolicyImpl* policy = 450 ChildProcessSecurityPolicyImpl* policy =
446 ChildProcessSecurityPolicyImpl::GetInstance(); 451 ChildProcessSecurityPolicyImpl::GetInstance();
447 policy->LockToOrigin(process_->GetID(), site_); 452 policy->LockToOrigin(process_->GetID(), site_);
448 } 453 }
449 } 454 }
450 455
451 } // namespace content 456 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/site_instance_impl.h ('k') | content/browser/site_per_process_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698