| 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/debugger/devtools_manager.h" | 9 #include "content/browser/debugger/devtools_manager_impl.h" |
| 10 #include "content/browser/renderer_host/render_view_host.h" | 10 #include "content/browser/renderer_host/render_view_host.h" |
| 11 #include "content/browser/renderer_host/render_view_host_delegate.h" | 11 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 12 #include "content/browser/renderer_host/render_view_host_factory.h" | 12 #include "content/browser/renderer_host/render_view_host_factory.h" |
| 13 #include "content/browser/renderer_host/render_widget_host_view.h" | 13 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 14 #include "content/browser/site_instance.h" | 14 #include "content/browser/site_instance.h" |
| 15 #include "content/browser/tab_contents/navigation_controller.h" | 15 #include "content/browser/tab_contents/navigation_controller.h" |
| 16 #include "content/browser/tab_contents/navigation_entry.h" | 16 #include "content/browser/tab_contents/navigation_entry.h" |
| 17 #include "content/browser/tab_contents/tab_contents_view.h" | 17 #include "content/browser/tab_contents/tab_contents_view.h" |
| 18 #include "content/browser/webui/web_ui.h" | 18 #include "content/browser/webui/web_ui.h" |
| 19 #include "content/browser/webui/web_ui_factory.h" | 19 #include "content/browser/webui/web_ui_factory.h" |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 // Same SiteInstance can be used. Navigate render_view_host_ if we are not | 746 // Same SiteInstance can be used. Navigate render_view_host_ if we are not |
| 747 // cross navigating. | 747 // cross navigating. |
| 748 DCHECK(!cross_navigation_pending_); | 748 DCHECK(!cross_navigation_pending_); |
| 749 return render_view_host_; | 749 return render_view_host_; |
| 750 } | 750 } |
| 751 | 751 |
| 752 void RenderViewHostManager::CancelPending() { | 752 void RenderViewHostManager::CancelPending() { |
| 753 RenderViewHost* pending_render_view_host = pending_render_view_host_; | 753 RenderViewHost* pending_render_view_host = pending_render_view_host_; |
| 754 pending_render_view_host_ = NULL; | 754 pending_render_view_host_ = NULL; |
| 755 | 755 |
| 756 DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); | 756 content::DevToolsManagerImpl::GetInstance()->OnCancelPendingNavigation( |
| 757 if (devtools_manager) { // NULL in unit tests. | 757 pending_render_view_host, |
| 758 devtools_manager->OnCancelPendingNavigation(pending_render_view_host, | 758 render_view_host_); |
| 759 render_view_host_); | |
| 760 } | |
| 761 | 759 |
| 762 // We no longer need to prevent the process from exiting. | 760 // We no longer need to prevent the process from exiting. |
| 763 pending_render_view_host->process()->RemovePendingView(); | 761 pending_render_view_host->process()->RemovePendingView(); |
| 764 | 762 |
| 765 // The pending RVH may already be on the swapped out list if we started to | 763 // The pending RVH may already be on the swapped out list if we started to |
| 766 // swap it back in and then canceled. If so, make sure it gets swapped out | 764 // swap it back in and then canceled. If so, make sure it gets swapped out |
| 767 // again. If it's not on the swapped out list (e.g., aborting a pending | 765 // again. If it's not on the swapped out list (e.g., aborting a pending |
| 768 // load), then it's safe to shut down. | 766 // load), then it's safe to shut down. |
| 769 if (IsSwappedOut(pending_render_view_host)) { | 767 if (IsSwappedOut(pending_render_view_host)) { |
| 770 // Any currently suspended navigations are no longer needed. | 768 // Any currently suspended navigations are no longer needed. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 } | 807 } |
| 810 } | 808 } |
| 811 | 809 |
| 812 bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) { | 810 bool RenderViewHostManager::IsSwappedOut(RenderViewHost* rvh) { |
| 813 if (!rvh->site_instance()) | 811 if (!rvh->site_instance()) |
| 814 return false; | 812 return false; |
| 815 | 813 |
| 816 return swapped_out_hosts_.find(rvh->site_instance()->id()) != | 814 return swapped_out_hosts_.find(rvh->site_instance()->id()) != |
| 817 swapped_out_hosts_.end(); | 815 swapped_out_hosts_.end(); |
| 818 } | 816 } |
| OLD | NEW |