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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 return curr_site_instance->GetRelatedSiteInstance(dest_url); | 481 return curr_site_instance->GetRelatedSiteInstance(dest_url); |
482 } | 482 } |
483 | 483 |
484 // For extensions, Web UI URLs (such as the new tab page), and apps we do | 484 // For extensions, Web UI URLs (such as the new tab page), and apps we do |
485 // not want to use the curr_instance if it has no site, since it will have a | 485 // not want to use the curr_instance if it has no site, since it will have a |
486 // RenderProcessHost of PRIV_NORMAL. Create a new SiteInstance for this | 486 // RenderProcessHost of PRIV_NORMAL. Create a new SiteInstance for this |
487 // URL instead (with the correct process type). | 487 // URL instead (with the correct process type). |
488 if (curr_site_instance->HasWrongProcessForURL(dest_url)) | 488 if (curr_site_instance->HasWrongProcessForURL(dest_url)) |
489 return curr_site_instance->GetRelatedSiteInstance(dest_url); | 489 return curr_site_instance->GetRelatedSiteInstance(dest_url); |
490 | 490 |
| 491 // View-source URLs must use a new SiteInstance and BrowsingInstance. |
| 492 // TODO(nasko): This is the same condition as later in the function. This |
| 493 // should be taken into account when refactoring this method as part of |
| 494 // http://crbug.com/123007. |
| 495 if (entry.IsViewSourceMode()) |
| 496 return SiteInstance::CreateForURL(browser_context, dest_url); |
| 497 |
491 // Normally the "site" on the SiteInstance is set lazily when the load | 498 // Normally the "site" on the SiteInstance is set lazily when the load |
492 // actually commits. This is to support better process sharing in case | 499 // actually commits. This is to support better process sharing in case |
493 // the site redirects to some other site: we want to use the destination | 500 // the site redirects to some other site: we want to use the destination |
494 // site in the site instance. | 501 // site in the site instance. |
495 // | 502 // |
496 // In the case of session restore, as it loads all the pages immediately | 503 // In the case of session restore, as it loads all the pages immediately |
497 // we need to set the site first, otherwise after a restore none of the | 504 // we need to set the site first, otherwise after a restore none of the |
498 // pages would share renderers in process-per-site. | 505 // pages would share renderers in process-per-site. |
499 if (entry.restore_type() != NavigationEntryImpl::RESTORE_NONE) | 506 if (entry.restore_type() != NavigationEntryImpl::RESTORE_NONE) |
500 curr_site_instance->SetSite(dest_url); | 507 curr_site_instance->SetSite(dest_url); |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 } | 921 } |
915 | 922 |
916 RenderViewHost* RenderViewHostManager::GetSwappedOutRenderViewHost( | 923 RenderViewHost* RenderViewHostManager::GetSwappedOutRenderViewHost( |
917 SiteInstance* instance) { | 924 SiteInstance* instance) { |
918 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); | 925 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); |
919 if (iter != swapped_out_hosts_.end()) | 926 if (iter != swapped_out_hosts_.end()) |
920 return iter->second; | 927 return iter->second; |
921 | 928 |
922 return NULL; | 929 return NULL; |
923 } | 930 } |
OLD | NEW |