| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/frame_tree.h" | 5 #include "content/browser/frame_host/frame_tree.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 230 |
| 231 RenderViewHostImpl* FrameTree::CreateRenderViewHost(SiteInstance* site_instance, | 231 RenderViewHostImpl* FrameTree::CreateRenderViewHost(SiteInstance* site_instance, |
| 232 int routing_id, | 232 int routing_id, |
| 233 int main_frame_routing_id, | 233 int main_frame_routing_id, |
| 234 bool swapped_out, | 234 bool swapped_out, |
| 235 bool hidden) { | 235 bool hidden) { |
| 236 DCHECK(main_frame_routing_id != MSG_ROUTING_NONE); | 236 DCHECK(main_frame_routing_id != MSG_ROUTING_NONE); |
| 237 RenderViewHostMap::iterator iter = | 237 RenderViewHostMap::iterator iter = |
| 238 render_view_host_map_.find(site_instance->GetId()); | 238 render_view_host_map_.find(site_instance->GetId()); |
| 239 if (iter != render_view_host_map_.end()) { | 239 if (iter != render_view_host_map_.end()) { |
| 240 // If a RenderViewHost's main frame is pending shutdown for this | 240 // If a RenderViewHost's main frame is pending deletion for this |
| 241 // |site_instance|, put it in the map of RenderViewHosts pending shutdown. | 241 // |site_instance|, put it in the map of RenderViewHosts pending shutdown. |
| 242 // Otherwise return the existing RenderViewHost for the SiteInstance. | 242 // Otherwise return the existing RenderViewHost for the SiteInstance. |
| 243 RenderFrameHost* main_frame = iter->second->GetMainFrame(); | 243 RenderFrameHostImpl* main_frame = static_cast<RenderFrameHostImpl*>( |
| 244 if (static_cast<RenderFrameHostImpl*>(main_frame)->rfh_state() == | 244 iter->second->GetMainFrame()); |
| 245 RenderFrameHostImpl::STATE_PENDING_SHUTDOWN) { | 245 if (main_frame->frame_tree_node()->render_manager()->IsPendingDeletion( |
| 246 main_frame)) { |
| 246 render_view_host_pending_shutdown_map_.insert( | 247 render_view_host_pending_shutdown_map_.insert( |
| 247 std::pair<int, RenderViewHostImpl*>(site_instance->GetId(), | 248 std::pair<int, RenderViewHostImpl*>(site_instance->GetId(), |
| 248 iter->second)); | 249 iter->second)); |
| 249 render_view_host_map_.erase(iter); | 250 render_view_host_map_.erase(iter); |
| 250 } else { | 251 } else { |
| 251 return iter->second; | 252 return iter->second; |
| 252 } | 253 } |
| 253 } | 254 } |
| 254 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( | 255 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
| 255 RenderViewHostFactory::Create(site_instance, | 256 RenderViewHostFactory::Create(site_instance, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 rvh->Shutdown(); | 324 rvh->Shutdown(); |
| 324 render_view_host_pending_shutdown_map_.erase(multi_iter); | 325 render_view_host_pending_shutdown_map_.erase(multi_iter); |
| 325 } | 326 } |
| 326 break; | 327 break; |
| 327 } | 328 } |
| 328 CHECK(render_view_host_found); | 329 CHECK(render_view_host_found); |
| 329 } | 330 } |
| 330 } | 331 } |
| 331 | 332 |
| 332 } // namespace content | 333 } // namespace content |
| OLD | NEW |