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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 render_widget_delegate_(render_widget_delegate), | 49 render_widget_delegate_(render_widget_delegate), |
50 render_view_host_(NULL), | 50 render_view_host_(NULL), |
51 pending_render_view_host_(NULL), | 51 pending_render_view_host_(NULL), |
52 interstitial_page_(NULL) { | 52 interstitial_page_(NULL) { |
53 } | 53 } |
54 | 54 |
55 RenderViewHostManager::~RenderViewHostManager() { | 55 RenderViewHostManager::~RenderViewHostManager() { |
56 if (pending_render_view_host_) | 56 if (pending_render_view_host_) |
57 CancelPending(); | 57 CancelPending(); |
58 | 58 |
59 // We should always have a main RenderViewHost. | 59 // We should always have a main RenderViewHost except in some tests. |
60 RenderViewHostImpl* render_view_host = render_view_host_; | 60 RenderViewHostImpl* render_view_host = render_view_host_; |
61 render_view_host_ = NULL; | 61 render_view_host_ = NULL; |
62 render_view_host->Shutdown(); | 62 if (render_view_host) |
| 63 render_view_host->Shutdown(); |
63 | 64 |
64 // Shut down any swapped out RenderViewHosts. | 65 // Shut down any swapped out RenderViewHosts. |
65 for (RenderViewHostMap::iterator iter = swapped_out_hosts_.begin(); | 66 for (RenderViewHostMap::iterator iter = swapped_out_hosts_.begin(); |
66 iter != swapped_out_hosts_.end(); | 67 iter != swapped_out_hosts_.end(); |
67 ++iter) { | 68 ++iter) { |
68 iter->second->Shutdown(); | 69 iter->second->Shutdown(); |
69 } | 70 } |
70 } | 71 } |
71 | 72 |
72 void RenderViewHostManager::Init(content::BrowserContext* browser_context, | 73 void RenderViewHostManager::Init(content::BrowserContext* browser_context, |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 } | 913 } |
913 | 914 |
914 RenderViewHost* RenderViewHostManager::GetSwappedOutRenderViewHost( | 915 RenderViewHost* RenderViewHostManager::GetSwappedOutRenderViewHost( |
915 SiteInstance* instance) { | 916 SiteInstance* instance) { |
916 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); | 917 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); |
917 if (iter != swapped_out_hosts_.end()) | 918 if (iter != swapped_out_hosts_.end()) |
918 return iter->second; | 919 return iter->second; |
919 | 920 |
920 return NULL; | 921 return NULL; |
921 } | 922 } |
OLD | NEW |