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

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: Created 5 years, 1 month 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 SiteInstance* site_instance = render_view_host->GetSiteInstance(); 349 SiteInstance* site_instance = render_view_host->GetSiteInstance();
350 int32 site_instance_id = site_instance->GetId(); 350 int32 site_instance_id = site_instance->GetId();
351 RenderViewHostMap::iterator iter = 351 RenderViewHostMap::iterator iter =
352 render_view_host_map_.find(site_instance_id); 352 render_view_host_map_.find(site_instance_id);
353 if (iter != render_view_host_map_.end() && iter->second == render_view_host) { 353 if (iter != render_view_host_map_.end() && iter->second == render_view_host) {
354 // Decrement the refcount and shutdown the RenderViewHost if no one else is 354 // Decrement the refcount and shutdown the RenderViewHost if no one else is
355 // using it. 355 // using it.
356 CHECK_GT(iter->second->ref_count(), 0); 356 CHECK_GT(iter->second->ref_count(), 0);
357 iter->second->decrement_ref_count(); 357 iter->second->decrement_ref_count();
358 if (iter->second->ref_count() == 0) { 358 if (iter->second->ref_count() == 0) {
359 iter->second->Shutdown(); 359 iter->second->ShutdownAndDestroy();
360 render_view_host_map_.erase(iter); 360 render_view_host_map_.erase(iter);
361 } 361 }
362 } else { 362 } else {
363 // The RenderViewHost should be in the list of RenderViewHosts pending 363 // The RenderViewHost should be in the list of RenderViewHosts pending
364 // shutdown. 364 // shutdown.
365 bool render_view_host_found = false; 365 bool render_view_host_found = false;
366 std::pair<RenderViewHostMultiMap::iterator, 366 std::pair<RenderViewHostMultiMap::iterator,
367 RenderViewHostMultiMap::iterator> result = 367 RenderViewHostMultiMap::iterator> result =
368 render_view_host_pending_shutdown_map_.equal_range(site_instance_id); 368 render_view_host_pending_shutdown_map_.equal_range(site_instance_id);
369 for (RenderViewHostMultiMap::iterator multi_iter = result.first; 369 for (RenderViewHostMultiMap::iterator multi_iter = result.first;
370 multi_iter != result.second; 370 multi_iter != result.second;
371 ++multi_iter) { 371 ++multi_iter) {
372 if (multi_iter->second != render_view_host) 372 if (multi_iter->second != render_view_host)
373 continue; 373 continue;
374 render_view_host_found = true; 374 render_view_host_found = true;
375 // Decrement the refcount and shutdown the RenderViewHost if no one else 375 // Decrement the refcount and shutdown the RenderViewHost if no one else
376 // is using it. 376 // is using it.
377 CHECK_GT(render_view_host->ref_count(), 0); 377 CHECK_GT(render_view_host->ref_count(), 0);
378 render_view_host->decrement_ref_count(); 378 render_view_host->decrement_ref_count();
379 if (render_view_host->ref_count() == 0) { 379 if (render_view_host->ref_count() == 0) {
380 render_view_host->Shutdown(); 380 render_view_host->ShutdownAndDestroy();
381 render_view_host_pending_shutdown_map_.erase(multi_iter); 381 render_view_host_pending_shutdown_map_.erase(multi_iter);
382 } 382 }
383 break; 383 break;
384 } 384 }
385 CHECK(render_view_host_found); 385 CHECK(render_view_host_found);
386 } 386 }
387 } 387 }
388 388
389 void FrameTree::FrameRemoved(FrameTreeNode* frame) { 389 void FrameTree::FrameRemoved(FrameTreeNode* frame) {
390 if (frame->frame_tree_node_id() == focused_frame_tree_node_id_) 390 if (frame->frame_tree_node_id() == focused_frame_tree_node_id_)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 // This is only used to set page-level focus in cross-process subframes, and 447 // This is only used to set page-level focus in cross-process subframes, and
448 // requests to set focus in main frame's SiteInstance are ignored. 448 // requests to set focus in main frame's SiteInstance are ignored.
449 if (instance != root_manager->current_frame_host()->GetSiteInstance()) { 449 if (instance != root_manager->current_frame_host()->GetSiteInstance()) {
450 RenderFrameProxyHost* proxy = 450 RenderFrameProxyHost* proxy =
451 root_manager->GetRenderFrameProxyHost(instance); 451 root_manager->GetRenderFrameProxyHost(instance);
452 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused)); 452 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused));
453 } 453 }
454 } 454 }
455 455
456 } // namespace content 456 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698