Chromium Code Reviews| 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 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1652 // This will swap it out and then put it on the proxy list (if there are other | 1652 // This will swap it out and then put it on the proxy list (if there are other |
| 1653 // active views in its SiteInstance) or schedule it for deletion when the swap | 1653 // active views in its SiteInstance) or schedule it for deletion when the swap |
| 1654 // out ack arrives (or immediately if the process isn't live). | 1654 // out ack arrives (or immediately if the process isn't live). |
| 1655 // In the --site-per-process case, old subframe RHFs are not kept alive inside | 1655 // In the --site-per-process case, old subframe RHFs are not kept alive inside |
| 1656 // the proxy. | 1656 // the proxy. |
| 1657 SwapOutOldFrame(old_render_frame_host.Pass()); | 1657 SwapOutOldFrame(old_render_frame_host.Pass()); |
| 1658 | 1658 |
| 1659 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1659 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1660 switches::kSitePerProcess) && | 1660 switches::kSitePerProcess) && |
| 1661 !is_main_frame) { | 1661 !is_main_frame) { |
| 1662 // If this is a subframe, it should have a CrossProcessFrameConnector | |
| 1663 // created already. Use it to link the new RFH's view to the proxy that | |
| 1664 // belongs to the parent frame's SiteInstance. | |
| 1665 // Note: We do this after swapping out the old RFH because that may create | |
| 1666 // the proxy we're looking for. | |
| 1667 RenderFrameProxyHost* proxy_to_parent = GetProxyToParent(); | |
| 1668 if (proxy_to_parent) { | |
| 1669 proxy_to_parent->SetChildRWHView(render_frame_host_->GetView()); | |
| 1670 } | |
| 1671 | |
| 1672 // Since the new RenderFrameHost is now committed, there must be no proxies | 1662 // Since the new RenderFrameHost is now committed, there must be no proxies |
| 1673 // for its SiteInstance. Delete any existing ones. | 1663 // for its SiteInstance. Delete any existing ones. |
| 1674 RenderFrameProxyHostMap::iterator iter = | 1664 RenderFrameProxyHostMap::iterator iter = |
| 1675 proxy_hosts_.find(render_frame_host_->GetSiteInstance()->GetId()); | 1665 proxy_hosts_.find(render_frame_host_->GetSiteInstance()->GetId()); |
| 1676 if (iter != proxy_hosts_.end()) { | 1666 if (iter != proxy_hosts_.end()) { |
| 1677 delete iter->second; | 1667 delete iter->second; |
| 1678 proxy_hosts_.erase(iter); | 1668 proxy_hosts_.erase(iter); |
| 1679 } | 1669 } |
| 1670 | |
| 1671 // If this is a subframe, it should have a CrossProcessFrameConnector | |
| 1672 // created already. Use it to link the new RFH's view to the proxy that | |
| 1673 // belongs to the parent frame's SiteInstance. If this navigation causes | |
| 1674 // an out of process frame to return to the same process as its parent, the | |
|
nasko
2015/03/12 17:32:13
nit: "out-of-process"
kenrb
2015/03/12 19:03:35
Done.
| |
| 1675 // proxy would have been removed from proxy_hosts_ above. | |
| 1676 // Note: We do this after swapping out the old RFH because that may create | |
| 1677 // the proxy we're looking for. | |
| 1678 RenderFrameProxyHost* proxy_to_parent = GetProxyToParent(); | |
| 1679 if (proxy_to_parent) { | |
|
nasko
2015/03/12 17:32:13
nit: this is a oneliner, so no need for {}, I've m
kenrb
2015/03/12 19:03:35
Done.
| |
| 1680 proxy_to_parent->SetChildRWHView(render_frame_host_->GetView()); | |
| 1681 } | |
| 1680 } | 1682 } |
| 1681 | 1683 |
| 1682 // After all is done, there must never be a proxy in the list which has the | 1684 // After all is done, there must never be a proxy in the list which has the |
| 1683 // same SiteInstance as the current RenderFrameHost. | 1685 // same SiteInstance as the current RenderFrameHost. |
| 1684 CHECK(proxy_hosts_.find(render_frame_host_->GetSiteInstance()->GetId()) == | 1686 CHECK(proxy_hosts_.find(render_frame_host_->GetSiteInstance()->GetId()) == |
| 1685 proxy_hosts_.end()); | 1687 proxy_hosts_.end()); |
| 1686 } | 1688 } |
| 1687 | 1689 |
| 1688 void RenderFrameHostManager::ShutdownRenderFrameProxyHostsInSiteInstance( | 1690 void RenderFrameHostManager::ShutdownRenderFrameProxyHostsInSiteInstance( |
| 1689 int32 site_instance_id) { | 1691 int32 site_instance_id) { |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1950 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 1952 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
| 1951 SiteInstance* instance) { | 1953 SiteInstance* instance) { |
| 1952 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 1954 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
| 1953 if (iter != proxy_hosts_.end()) { | 1955 if (iter != proxy_hosts_.end()) { |
| 1954 delete iter->second; | 1956 delete iter->second; |
| 1955 proxy_hosts_.erase(iter); | 1957 proxy_hosts_.erase(iter); |
| 1956 } | 1958 } |
| 1957 } | 1959 } |
| 1958 | 1960 |
| 1959 } // namespace content | 1961 } // namespace content |
| OLD | NEW |