Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: content/browser/frame_host/frame_tree.cc

Issue 1345353003: Fix detection of RenderViewHosts pending deletion in CreateRenderViewHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweak test per Nasko's suggestions; fix pending RVH check Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(
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_,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_impl.h » ('j') | content/browser/site_per_process_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698