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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
492 // actually commits. This is to support better process sharing in case | 492 // 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 | 493 // the site redirects to some other site: we want to use the destination |
494 // site in the site instance. | 494 // site in the site instance. |
495 // | 495 // |
496 // In the case of session restore, as it loads all the pages immediately | 496 // 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 | 497 // we need to set the site first, otherwise after a restore none of the |
498 // pages would share renderers in process-per-site. | 498 // pages would share renderers in process-per-site. |
499 if (entry.restore_type() != NavigationEntryImpl::RESTORE_NONE) | 499 if (entry.restore_type() != NavigationEntryImpl::RESTORE_NONE) |
500 curr_site_instance->SetSite(dest_url); | 500 curr_site_instance->SetSite(dest_url); |
501 | 501 |
502 // View-source URLs must use a new SiteInstance and BrowsingInstance. | |
503 // TODO(nasko): This is the same condition as later in the function. This | |
504 // should be taken into account when refactoring this method. | |
505 if (entry.IsViewSourceMode()) | |
506 return SiteInstance::CreateForURL(browser_context, dest_url); | |
Charlie Reis
2012/08/16 22:28:09
Please move this check between the HasWrongProcess
nasko
2012/08/16 22:59:23
Done.
| |
507 | |
502 return curr_site_instance; | 508 return curr_site_instance; |
503 } | 509 } |
504 | 510 |
505 // Otherwise, only create a new SiteInstance for cross-site navigation. | 511 // Otherwise, only create a new SiteInstance for cross-site navigation. |
506 | 512 |
507 // TODO(creis): Once we intercept links and script-based navigations, we | 513 // TODO(creis): Once we intercept links and script-based navigations, we |
508 // will be able to enforce that all entries in a SiteInstance actually have | 514 // will be able to enforce that all entries in a SiteInstance actually have |
509 // the same site, and it will be safe to compare the URL against the | 515 // the same site, and it will be safe to compare the URL against the |
510 // SiteInstance's site, as follows: | 516 // SiteInstance's site, as follows: |
511 // const GURL& current_url = curr_instance->site(); | 517 // const GURL& current_url = curr_instance->site(); |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
914 } | 920 } |
915 | 921 |
916 RenderViewHost* RenderViewHostManager::GetSwappedOutRenderViewHost( | 922 RenderViewHost* RenderViewHostManager::GetSwappedOutRenderViewHost( |
917 SiteInstance* instance) { | 923 SiteInstance* instance) { |
918 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); | 924 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); |
919 if (iter != swapped_out_hosts_.end()) | 925 if (iter != swapped_out_hosts_.end()) |
920 return iter->second; | 926 return iter->second; |
921 | 927 |
922 return NULL; | 928 return NULL; |
923 } | 929 } |
OLD | NEW |