| 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 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 } | 960 } |
| 960 | 961 |
| 961 RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost( | 962 RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost( |
| 962 SiteInstance* instance) { | 963 SiteInstance* instance) { |
| 963 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); | 964 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); |
| 964 if (iter != swapped_out_hosts_.end()) | 965 if (iter != swapped_out_hosts_.end()) |
| 965 return iter->second; | 966 return iter->second; |
| 966 | 967 |
| 967 return NULL; | 968 return NULL; |
| 968 } | 969 } |
| OLD | NEW |