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

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

Issue 1453803002: Separate RenderViewHost from RenderWidgetHost, part 10: shutdown. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nick's nits Created 5 years 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
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 SiteInstance* site_instance = render_view_host->GetSiteInstance(); 348 SiteInstance* site_instance = render_view_host->GetSiteInstance();
349 int32 site_instance_id = site_instance->GetId(); 349 int32 site_instance_id = site_instance->GetId();
350 RenderViewHostMap::iterator iter = 350 RenderViewHostMap::iterator iter =
351 render_view_host_map_.find(site_instance_id); 351 render_view_host_map_.find(site_instance_id);
352 if (iter != render_view_host_map_.end() && iter->second == render_view_host) { 352 if (iter != render_view_host_map_.end() && iter->second == render_view_host) {
353 // Decrement the refcount and shutdown the RenderViewHost if no one else is 353 // Decrement the refcount and shutdown the RenderViewHost if no one else is
354 // using it. 354 // using it.
355 CHECK_GT(iter->second->ref_count(), 0); 355 CHECK_GT(iter->second->ref_count(), 0);
356 iter->second->decrement_ref_count(); 356 iter->second->decrement_ref_count();
357 if (iter->second->ref_count() == 0) { 357 if (iter->second->ref_count() == 0) {
358 iter->second->Shutdown(); 358 iter->second->ShutdownAndDestroy();
359 render_view_host_map_.erase(iter); 359 render_view_host_map_.erase(iter);
360 } 360 }
361 } else { 361 } else {
362 // The RenderViewHost should be in the list of RenderViewHosts pending 362 // The RenderViewHost should be in the list of RenderViewHosts pending
363 // shutdown. 363 // shutdown.
364 bool render_view_host_found = false; 364 bool render_view_host_found = false;
365 std::pair<RenderViewHostMultiMap::iterator, 365 std::pair<RenderViewHostMultiMap::iterator,
366 RenderViewHostMultiMap::iterator> result = 366 RenderViewHostMultiMap::iterator> result =
367 render_view_host_pending_shutdown_map_.equal_range(site_instance_id); 367 render_view_host_pending_shutdown_map_.equal_range(site_instance_id);
368 for (RenderViewHostMultiMap::iterator multi_iter = result.first; 368 for (RenderViewHostMultiMap::iterator multi_iter = result.first;
369 multi_iter != result.second; 369 multi_iter != result.second;
370 ++multi_iter) { 370 ++multi_iter) {
371 if (multi_iter->second != render_view_host) 371 if (multi_iter->second != render_view_host)
372 continue; 372 continue;
373 render_view_host_found = true; 373 render_view_host_found = true;
374 // Decrement the refcount and shutdown the RenderViewHost if no one else 374 // Decrement the refcount and shutdown the RenderViewHost if no one else
375 // is using it. 375 // is using it.
376 CHECK_GT(render_view_host->ref_count(), 0); 376 CHECK_GT(render_view_host->ref_count(), 0);
377 render_view_host->decrement_ref_count(); 377 render_view_host->decrement_ref_count();
378 if (render_view_host->ref_count() == 0) { 378 if (render_view_host->ref_count() == 0) {
379 render_view_host->Shutdown(); 379 render_view_host->ShutdownAndDestroy();
380 render_view_host_pending_shutdown_map_.erase(multi_iter); 380 render_view_host_pending_shutdown_map_.erase(multi_iter);
381 } 381 }
382 break; 382 break;
383 } 383 }
384 CHECK(render_view_host_found); 384 CHECK(render_view_host_found);
385 } 385 }
386 } 386 }
387 387
388 void FrameTree::FrameRemoved(FrameTreeNode* frame) { 388 void FrameTree::FrameRemoved(FrameTreeNode* frame) {
389 if (frame->frame_tree_node_id() == focused_frame_tree_node_id_) 389 if (frame->frame_tree_node_id() == focused_frame_tree_node_id_)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 // This is only used to set page-level focus in cross-process subframes, and 446 // This is only used to set page-level focus in cross-process subframes, and
447 // requests to set focus in main frame's SiteInstance are ignored. 447 // requests to set focus in main frame's SiteInstance are ignored.
448 if (instance != root_manager->current_frame_host()->GetSiteInstance()) { 448 if (instance != root_manager->current_frame_host()->GetSiteInstance()) {
449 RenderFrameProxyHost* proxy = 449 RenderFrameProxyHost* proxy =
450 root_manager->GetRenderFrameProxyHost(instance); 450 root_manager->GetRenderFrameProxyHost(instance);
451 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); 451 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused));
452 } 452 }
453 } 453 }
454 454
455 } // namespace content 455 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698