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

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

Issue 599253002: Fix SiteInstance ref counting issue in RenderFrameHostManager::CommitNavigation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | no next file » | 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/render_frame_host_manager.h" 5 #include "content/browser/frame_host/render_frame_host_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 // active request. 619 // active request.
620 if (navigation_request_->navigation_request_id() != 620 if (navigation_request_->navigation_request_id() !=
621 info.navigation_request_id) { 621 info.navigation_request_id) {
622 return; 622 return;
623 } 623 }
624 624
625 // Pick the right RenderFrameHost to commit the navigation. 625 // Pick the right RenderFrameHost to commit the navigation.
626 SiteInstance* current_instance = render_frame_host_->GetSiteInstance(); 626 SiteInstance* current_instance = render_frame_host_->GetSiteInstance();
627 // TODO(clamy): Replace the default values by the right ones. This may require 627 // TODO(clamy): Replace the default values by the right ones. This may require
628 // some storing in RequestNavigation. 628 // some storing in RequestNavigation.
629 SiteInstance* new_instance = GetSiteInstanceForNavigation( 629 scoped_refptr<SiteInstance> new_instance = GetSiteInstanceForNavigation(
630 info.navigation_url, 630 info.navigation_url,
631 NULL, 631 NULL,
632 navigation_request_->info().navigation_params.transition_type, 632 navigation_request_->info().navigation_params.transition_type,
633 false, 633 false,
634 false); 634 false);
635 DCHECK(!pending_render_frame_host_.get()); 635 DCHECK(!pending_render_frame_host_.get());
636 636
637 // TODO(clamy): Update how pending WebUI objects are handled. 637 // TODO(clamy): Update how pending WebUI objects are handled.
638 if (current_instance != new_instance) { 638 if (current_instance != new_instance.get()) {
639 CreateRenderFrameHostForNewSiteInstance( 639 CreateRenderFrameHostForNewSiteInstance(
640 current_instance, new_instance, frame_tree_node_->IsMainFrame()); 640 current_instance, new_instance.get(), frame_tree_node_->IsMainFrame());
641 DCHECK(pending_render_frame_host_.get()); 641 DCHECK(pending_render_frame_host_.get());
642 // TODO(clamy): Wait until the navigation has committed before swapping 642 // TODO(clamy): Wait until the navigation has committed before swapping
643 // renderers. 643 // renderers.
644 scoped_ptr<RenderFrameHostImpl> old_render_frame_host = 644 scoped_ptr<RenderFrameHostImpl> old_render_frame_host =
645 SetRenderFrameHost(pending_render_frame_host_.Pass()); 645 SetRenderFrameHost(pending_render_frame_host_.Pass());
646 if (frame_tree_node_->IsMainFrame()) 646 if (frame_tree_node_->IsMainFrame())
647 render_frame_host_->render_view_host()->AttachToFrameTree(); 647 render_frame_host_->render_view_host()->AttachToFrameTree();
648 } 648 }
649 649
650 // If the renderer that needs to navigate is not live (it was just created or 650 // If the renderer that needs to navigate is not live (it was just created or
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 void RenderFrameHostManager::DeleteRenderFrameProxyHost( 1712 void RenderFrameHostManager::DeleteRenderFrameProxyHost(
1713 SiteInstance* instance) { 1713 SiteInstance* instance) {
1714 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); 1714 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId());
1715 if (iter != proxy_hosts_.end()) { 1715 if (iter != proxy_hosts_.end()) {
1716 delete iter->second; 1716 delete iter->second;
1717 proxy_hosts_.erase(iter); 1717 proxy_hosts_.erase(iter);
1718 } 1718 }
1719 } 1719 }
1720 1720
1721 } // namespace content 1721 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698