| 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/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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 SiteInstance* current_site_instance = render_frame_host_->GetSiteInstance(); | 744 SiteInstance* current_site_instance = render_frame_host_->GetSiteInstance(); |
| 745 | 745 |
| 746 scoped_refptr<SiteInstance> dest_site_instance = GetSiteInstanceForNavigation( | 746 scoped_refptr<SiteInstance> dest_site_instance = GetSiteInstanceForNavigation( |
| 747 request.common_params().url, request.source_site_instance(), | 747 request.common_params().url, request.source_site_instance(), |
| 748 request.dest_site_instance(), request.common_params().transition, | 748 request.dest_site_instance(), request.common_params().transition, |
| 749 request.restore_type() != NavigationEntryImpl::RESTORE_NONE, | 749 request.restore_type() != NavigationEntryImpl::RESTORE_NONE, |
| 750 request.is_view_source()); | 750 request.is_view_source()); |
| 751 // The appropriate RenderFrameHost to commit the navigation. | 751 // The appropriate RenderFrameHost to commit the navigation. |
| 752 RenderFrameHostImpl* navigation_rfh = nullptr; | 752 RenderFrameHostImpl* navigation_rfh = nullptr; |
| 753 | 753 |
| 754 // TODO(carlosk): do not swap processes for renderer initiated navigations | 754 // Renderer-initiated navigations that may require a SiteInstance swap are |
| 755 // (see crbug.com/440266). | 755 // sent to the browser via the OpenURL IPC and are afterwards treated as |
| 756 // browser-initiated navigations. NavigationRequests marked as |
| 757 // renderer-initiated are created by receiving a BeginNavigation IPC, and will |
| 758 // then proceed in the same renderer that sent the IPC due to the condition |
| 759 // below. |
| 760 // TODO(carlosk): Once there is support for cross-process scripting check for |
| 761 // non-browser-initiated navigations should be removed (see crbug.com/440266). |
| 756 if (current_site_instance == dest_site_instance.get() || | 762 if (current_site_instance == dest_site_instance.get() || |
| 763 !request.browser_initiated() || |
| 757 (!frame_tree_node_->IsMainFrame() && | 764 (!frame_tree_node_->IsMainFrame() && |
| 758 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 765 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 759 switches::kSitePerProcess))) { | 766 switches::kSitePerProcess))) { |
| 760 // Reuse the current RFH if its SiteInstance matches the the navigation's | 767 // Reuse the current RFH if its SiteInstance matches the the navigation's |
| 761 // or if this is a subframe navigation. We only swap RFHs for subframes when | 768 // or if this is a subframe navigation. We only swap RFHs for subframes when |
| 762 // --site-per-process is enabled. | 769 // --site-per-process is enabled. |
| 763 CleanUpNavigation(); | 770 CleanUpNavigation(); |
| 764 navigation_rfh = render_frame_host_.get(); | 771 navigation_rfh = render_frame_host_.get(); |
| 765 | 772 |
| 766 // As SiteInstances are the same, check if the WebUI should be reused. | 773 // As SiteInstances are the same, check if the WebUI should be reused. |
| (...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2012 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 2019 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
| 2013 SiteInstance* instance) { | 2020 SiteInstance* instance) { |
| 2014 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 2021 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
| 2015 if (iter != proxy_hosts_.end()) { | 2022 if (iter != proxy_hosts_.end()) { |
| 2016 delete iter->second; | 2023 delete iter->second; |
| 2017 proxy_hosts_.erase(iter); | 2024 proxy_hosts_.erase(iter); |
| 2018 } | 2025 } |
| 2019 } | 2026 } |
| 2020 | 2027 |
| 2021 } // namespace content | 2028 } // namespace content |
| OLD | NEW |