| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tab_contents/render_view_host_manager.h" | 5 #include "content/browser/tab_contents/render_view_host_manager.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "content/browser/content_browser_client.h" | 9 #include "content/browser/content_browser_client.h" |
| 10 #include "content/browser/renderer_host/render_view_host.h" | 10 #include "content/browser/renderer_host/render_view_host.h" |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 | 663 |
| 664 // render_view_host_ will not be deleted before the end of this method, so we | 664 // render_view_host_ will not be deleted before the end of this method, so we |
| 665 // don't have to worry about this SiteInstance's ref count dropping to zero. | 665 // don't have to worry about this SiteInstance's ref count dropping to zero. |
| 666 SiteInstance* curr_instance = render_view_host_->site_instance(); | 666 SiteInstance* curr_instance = render_view_host_->site_instance(); |
| 667 | 667 |
| 668 // Determine if we need a new SiteInstance for this entry. | 668 // Determine if we need a new SiteInstance for this entry. |
| 669 // Again, new_instance won't be deleted before the end of this method, so it | 669 // Again, new_instance won't be deleted before the end of this method, so it |
| 670 // is safe to use a normal pointer here. | 670 // is safe to use a normal pointer here. |
| 671 SiteInstance* new_instance = curr_instance; | 671 SiteInstance* new_instance = curr_instance; |
| 672 bool force_swap = ShouldSwapProcessesForNavigation( | 672 bool force_swap = ShouldSwapProcessesForNavigation( |
| 673 delegate_->GetLastCommittedNavigationEntryForRenderManager(), | 673 delegate_->GetLastCommittedNavigationEntryForRenderManager(), &entry); |
| 674 &entry); | |
| 675 if (ShouldTransitionCrossSite() || force_swap) | 674 if (ShouldTransitionCrossSite() || force_swap) |
| 676 new_instance = GetSiteInstanceForEntry(entry, curr_instance); | 675 new_instance = GetSiteInstanceForEntry(entry, curr_instance); |
| 677 | 676 |
| 678 if (new_instance != curr_instance || force_swap) { | 677 if (new_instance != curr_instance || force_swap) { |
| 679 // New SiteInstance. | 678 // New SiteInstance. |
| 680 DCHECK(!cross_navigation_pending_); | 679 DCHECK(!cross_navigation_pending_); |
| 681 | 680 |
| 682 // Create a pending RVH and navigate it. | 681 // Create a pending RVH and navigate it. |
| 683 bool success = CreatePendingRenderView(entry, new_instance); | 682 bool success = CreatePendingRenderView(entry, new_instance); |
| 684 if (!success) | 683 if (!success) |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 delegate_->NotifySwappedFromRenderManager(); | 863 delegate_->NotifySwappedFromRenderManager(); |
| 865 } | 864 } |
| 866 | 865 |
| 867 bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) { | 866 bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) { |
| 868 if (!rvh->site_instance()) | 867 if (!rvh->site_instance()) |
| 869 return false; | 868 return false; |
| 870 | 869 |
| 871 return swapped_out_hosts_.find(rvh->site_instance()->id()) != | 870 return swapped_out_hosts_.find(rvh->site_instance()->id()) != |
| 872 swapped_out_hosts_.end(); | 871 swapped_out_hosts_.end(); |
| 873 } | 872 } |
| OLD | NEW |