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