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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 | 1193 |
1194 scoped_refptr<SiteInstance> new_instance = | 1194 scoped_refptr<SiteInstance> new_instance = |
1195 ConvertToSiteInstance(new_instance_descriptor, candidate_instance); | 1195 ConvertToSiteInstance(new_instance_descriptor, candidate_instance); |
1196 // If |force_swap| is true, we must use a different SiteInstance than the | 1196 // If |force_swap| is true, we must use a different SiteInstance than the |
1197 // current one. If we didn't, we would have two RenderFrameHosts in the same | 1197 // current one. If we didn't, we would have two RenderFrameHosts in the same |
1198 // SiteInstance and the same frame, breaking lookup of RenderFrameHosts by | 1198 // SiteInstance and the same frame, breaking lookup of RenderFrameHosts by |
1199 // SiteInstance. | 1199 // SiteInstance. |
1200 if (force_swap) | 1200 if (force_swap) |
1201 CHECK_NE(new_instance, current_instance); | 1201 CHECK_NE(new_instance, current_instance); |
1202 | 1202 |
| 1203 if (new_instance == current_instance) { |
| 1204 // If we're navigating to the same site instance, we won't need to use any |
| 1205 // spare RenderProcessHost. |
| 1206 RenderProcessHostImpl::CleanupSpareRenderProcessHost(); |
| 1207 } |
| 1208 |
1203 // Double-check that the new SiteInstance is associated with the right | 1209 // Double-check that the new SiteInstance is associated with the right |
1204 // BrowserContext. | 1210 // BrowserContext. |
1205 DCHECK_EQ(new_instance->GetBrowserContext(), browser_context); | 1211 DCHECK_EQ(new_instance->GetBrowserContext(), browser_context); |
1206 | 1212 |
1207 // If |new_instance| is a new SiteInstance for a subframe with an isolated | 1213 // If |new_instance| is a new SiteInstance for a subframe with an isolated |
1208 // origin, set its process reuse policy so that such subframes are | 1214 // origin, set its process reuse policy so that such subframes are |
1209 // consolidated into existing processes for that isolated origin. | 1215 // consolidated into existing processes for that isolated origin. |
1210 SiteInstanceImpl* new_instance_impl = | 1216 SiteInstanceImpl* new_instance_impl = |
1211 static_cast<SiteInstanceImpl*>(new_instance.get()); | 1217 static_cast<SiteInstanceImpl*>(new_instance.get()); |
1212 auto* policy = ChildProcessSecurityPolicyImpl::GetInstance(); | 1218 auto* policy = ChildProcessSecurityPolicyImpl::GetInstance(); |
(...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2828 ->is_hidden() != delegate_->IsHidden()) { | 2834 ->is_hidden() != delegate_->IsHidden()) { |
2829 if (delegate_->IsHidden()) { | 2835 if (delegate_->IsHidden()) { |
2830 view->Hide(); | 2836 view->Hide(); |
2831 } else { | 2837 } else { |
2832 view->Show(); | 2838 view->Show(); |
2833 } | 2839 } |
2834 } | 2840 } |
2835 } | 2841 } |
2836 | 2842 |
2837 } // namespace content | 2843 } // namespace content |
OLD | NEW |