Chromium Code Reviews| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 267 } | 267 } |
| 268 | 268 |
| 269 RenderViewHostImpl* FrameTree::CreateRenderViewHost(SiteInstance* site_instance, | 269 RenderViewHostImpl* FrameTree::CreateRenderViewHost(SiteInstance* site_instance, |
| 270 int32 routing_id, | 270 int32 routing_id, |
| 271 int32 main_frame_routing_id, | 271 int32 main_frame_routing_id, |
| 272 bool swapped_out, | 272 bool swapped_out, |
| 273 bool hidden) { | 273 bool hidden) { |
| 274 RenderViewHostMap::iterator iter = | 274 RenderViewHostMap::iterator iter = |
| 275 render_view_host_map_.find(site_instance->GetId()); | 275 render_view_host_map_.find(site_instance->GetId()); |
| 276 if (iter != render_view_host_map_.end()) { | 276 if (iter != render_view_host_map_.end()) { |
| 277 // If a RenderViewHost's main frame is pending deletion for this | 277 // If a RenderViewHost is pending deletion for this |site_instance|, it |
| 278 // |site_instance|, put it in the map of RenderViewHosts pending shutdown. | 278 // shouldn't be reused, so put it in the map of RenderViewHosts pending |
| 279 // Otherwise return the existing RenderViewHost for the SiteInstance. | 279 // shutdown. Otherwise, return the existing RenderViewHost for the |
| 280 RenderFrameHostImpl* main_frame = static_cast<RenderFrameHostImpl*>( | 280 // SiteInstance. Note that if swapped-out is forbidden, the |
| 281 iter->second->GetMainFrame()); | 281 // RenderViewHost's main frame has already been cleared, so we cannot rely |
| 282 if (main_frame && | 282 // on checking whether the main frame is pending deletion. |
| 283 main_frame->frame_tree_node()->render_manager()->IsPendingDeletion( | 283 if (iter->second->is_pending_deletion()) { |
| 284 main_frame)) { | |
| 285 render_view_host_pending_shutdown_map_.insert( | 284 render_view_host_pending_shutdown_map_.insert( |
|
alexmos
2015/09/18 18:32:17
Note that as we discussed, FrameTree::ReleaseRende
nasko
2015/09/18 19:06:17
Acknowledged.
| |
| 286 std::make_pair(site_instance->GetId(), iter->second)); | 285 std::make_pair(site_instance->GetId(), iter->second)); |
| 287 render_view_host_map_.erase(iter); | 286 render_view_host_map_.erase(iter); |
| 288 } else { | 287 } else { |
| 289 return iter->second; | 288 return iter->second; |
| 290 } | 289 } |
| 291 } | 290 } |
| 292 RenderViewHostImpl* rvh = | 291 RenderViewHostImpl* rvh = |
| 293 static_cast<RenderViewHostImpl*>(RenderViewHostFactory::Create( | 292 static_cast<RenderViewHostImpl*>(RenderViewHostFactory::Create( |
| 294 site_instance, render_view_delegate_, render_widget_delegate_, | 293 site_instance, render_view_delegate_, render_widget_delegate_, |
| 295 routing_id, main_frame_routing_id, swapped_out, hidden)); | 294 routing_id, main_frame_routing_id, swapped_out, hidden)); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 load_progress_ = 0.0; | 392 load_progress_ = 0.0; |
| 394 } | 393 } |
| 395 | 394 |
| 396 bool FrameTree::IsLoading() { | 395 bool FrameTree::IsLoading() { |
| 397 bool is_loading = false; | 396 bool is_loading = false; |
| 398 ForEach(base::Bind(&IsNodeLoading, &is_loading)); | 397 ForEach(base::Bind(&IsNodeLoading, &is_loading)); |
| 399 return is_loading; | 398 return is_loading; |
| 400 } | 399 } |
| 401 | 400 |
| 402 } // namespace content | 401 } // namespace content |
| OLD | NEW |