| OLD | NEW |
| 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/web_contents/render_view_host_manager.h" | 5 #include "content/browser/web_contents/render_view_host_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 // do this check if the curr_instance has a site, because for now, we want | 493 // do this check if the curr_instance has a site, because for now, we want |
| 494 // to compare against the current URL and not the SiteInstance's site. In | 494 // to compare against the current URL and not the SiteInstance's site. In |
| 495 // this case, there is no current URL, so comparing against the site is ok. | 495 // this case, there is no current URL, so comparing against the site is ok. |
| 496 // See additional comments below.) | 496 // See additional comments below.) |
| 497 // | 497 // |
| 498 // Also, if the URL should use process-per-site mode and there is an | 498 // Also, if the URL should use process-per-site mode and there is an |
| 499 // existing process for the site, we should use it. We can call | 499 // existing process for the site, we should use it. We can call |
| 500 // GetRelatedSiteInstance() for this, which will eagerly set the site and | 500 // GetRelatedSiteInstance() for this, which will eagerly set the site and |
| 501 // thus use the correct process. | 501 // thus use the correct process. |
| 502 bool use_process_per_site = | 502 bool use_process_per_site = |
| 503 RenderProcessHostImpl::ShouldUseProcessPerSite(browser_context, | 503 RenderProcessHost::ShouldUseProcessPerSite(browser_context, dest_url) && |
| 504 dest_url) && | |
| 505 RenderProcessHostImpl::GetProcessHostForSite(browser_context, dest_url); | 504 RenderProcessHostImpl::GetProcessHostForSite(browser_context, dest_url); |
| 506 if (curr_site_instance->HasRelatedSiteInstance(dest_url) || | 505 if (curr_site_instance->HasRelatedSiteInstance(dest_url) || |
| 507 use_process_per_site) { | 506 use_process_per_site) { |
| 508 return curr_site_instance->GetRelatedSiteInstance(dest_url); | 507 return curr_site_instance->GetRelatedSiteInstance(dest_url); |
| 509 } | 508 } |
| 510 | 509 |
| 511 // For extensions, Web UI URLs (such as the new tab page), and apps we do | 510 // For extensions, Web UI URLs (such as the new tab page), and apps we do |
| 512 // not want to use the curr_instance if it has no site, since it will have a | 511 // not want to use the curr_instance if it has no site, since it will have a |
| 513 // RenderProcessHost of PRIV_NORMAL. Create a new SiteInstance for this | 512 // RenderProcessHost of PRIV_NORMAL. Create a new SiteInstance for this |
| 514 // URL instead (with the correct process type). | 513 // URL instead (with the correct process type). |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost( | 972 RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost( |
| 974 SiteInstance* instance) { | 973 SiteInstance* instance) { |
| 975 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); | 974 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); |
| 976 if (iter != swapped_out_hosts_.end()) | 975 if (iter != swapped_out_hosts_.end()) |
| 977 return iter->second; | 976 return iter->second; |
| 978 | 977 |
| 979 return NULL; | 978 return NULL; |
| 980 } | 979 } |
| 981 | 980 |
| 982 } // namespace content | 981 } // namespace content |
| OLD | NEW |