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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1350 proxy_hosts_.erase(iter); | 1350 proxy_hosts_.erase(iter); |
| 1351 } | 1351 } |
| 1352 RFHPendingDeleteMap::iterator pending_delete_iter = | 1352 RFHPendingDeleteMap::iterator pending_delete_iter = |
| 1353 pending_delete_hosts_.find(old_site_instance_id); | 1353 pending_delete_hosts_.find(old_site_instance_id); |
| 1354 if (pending_delete_iter == pending_delete_hosts_.end() || | 1354 if (pending_delete_iter == pending_delete_hosts_.end() || |
| 1355 pending_delete_iter->second.get() != old_render_frame_host) { | 1355 pending_delete_iter->second.get() != old_render_frame_host) { |
| 1356 pending_delete_hosts_[old_site_instance_id] = | 1356 pending_delete_hosts_[old_site_instance_id] = |
| 1357 linked_ptr<RenderFrameHostImpl>(old_render_frame_host.release()); | 1357 linked_ptr<RenderFrameHostImpl>(old_render_frame_host.release()); |
| 1358 } | 1358 } |
| 1359 } else { | 1359 } else { |
| 1360 CHECK(proxy_hosts_.find(render_frame_host_->GetSiteInstance()->GetId()) == | 1360 // In --site-per-process, delete the proxy for the SiteInstance we are |
|
Charlie Reis
2014/09/10 07:39:10
I'm having trouble understanding this part. Is th
nasko
2014/09/10 19:36:34
Added a TODO as per our chat.
| |
| 1361 proxy_hosts_.end()); | 1361 // committing. In the case of main frame, the proxy wraps the |
| 1362 // |old_render_frame_host|, so it must be left intact. | |
| 1363 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
| 1364 switches::kSitePerProcess) && !is_main_frame) { | |
| 1365 RenderFrameProxyHostMap::iterator iter = | |
| 1366 proxy_hosts_.find(render_frame_host_->GetSiteInstance()->GetId()); | |
| 1367 if (iter != proxy_hosts_.end()) { | |
| 1368 delete iter->second; | |
| 1369 proxy_hosts_.erase(iter); | |
| 1370 } | |
| 1371 } | |
| 1362 | 1372 |
| 1363 // Capture the active view count on the old RFH SiteInstance, since the | 1373 // Capture the active view count on the old RFH SiteInstance, since the |
| 1364 // ownership might be passed into the proxy and the pointer will be | 1374 // ownership might be passed into the proxy and the pointer will be |
| 1365 // invalid. | 1375 // invalid. |
| 1366 int active_view_count = | 1376 int active_view_count = |
| 1367 static_cast<SiteInstanceImpl*>(old_render_frame_host->GetSiteInstance()) | 1377 static_cast<SiteInstanceImpl*>(old_render_frame_host->GetSiteInstance()) |
| 1368 ->active_view_count(); | 1378 ->active_view_count(); |
| 1369 | 1379 |
| 1370 if (is_main_frame) { | 1380 if (is_main_frame) { |
| 1371 RenderFrameProxyHostMap::iterator iter = | 1381 RenderFrameProxyHostMap::iterator iter = |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 1386 // new process. | 1396 // new process. |
| 1387 if (!is_main_frame) { | 1397 if (!is_main_frame) { |
| 1388 RenderFrameProxyHost* proxy = GetProxyToParent(); | 1398 RenderFrameProxyHost* proxy = GetProxyToParent(); |
| 1389 if (proxy) { | 1399 if (proxy) { |
| 1390 proxy->SetChildRWHView( | 1400 proxy->SetChildRWHView( |
| 1391 render_frame_host_->render_view_host()->GetView()); | 1401 render_frame_host_->render_view_host()->GetView()); |
| 1392 } | 1402 } |
| 1393 } | 1403 } |
| 1394 } | 1404 } |
| 1395 } | 1405 } |
| 1406 | |
| 1407 // After all is done, there must never be a proxy in the list which has the | |
| 1408 // same SiteInstance as the current RenderFrameHost. | |
| 1409 CHECK(proxy_hosts_.find(render_frame_host_->GetSiteInstance()->GetId()) == | |
| 1410 proxy_hosts_.end()); | |
| 1396 } | 1411 } |
| 1397 | 1412 |
| 1398 void RenderFrameHostManager::ShutdownRenderFrameProxyHostsInSiteInstance( | 1413 void RenderFrameHostManager::ShutdownRenderFrameProxyHostsInSiteInstance( |
| 1399 int32 site_instance_id) { | 1414 int32 site_instance_id) { |
| 1400 // First remove any swapped out RFH for this SiteInstance from our own list. | 1415 // First remove any swapped out RFH for this SiteInstance from our own list. |
| 1401 ClearProxiesInSiteInstance(site_instance_id, frame_tree_node_); | 1416 ClearProxiesInSiteInstance(site_instance_id, frame_tree_node_); |
| 1402 | 1417 |
| 1403 // Use the safe RenderWidgetHost iterator for now to find all RenderViewHosts | 1418 // Use the safe RenderWidgetHost iterator for now to find all RenderViewHosts |
| 1404 // in the SiteInstance, then tell their respective FrameTrees to remove all | 1419 // in the SiteInstance, then tell their respective FrameTrees to remove all |
| 1405 // RenderFrameProxyHosts corresponding to them. | 1420 // RenderFrameProxyHosts corresponding to them. |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1673 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 1688 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
| 1674 SiteInstance* instance) { | 1689 SiteInstance* instance) { |
| 1675 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 1690 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
| 1676 if (iter != proxy_hosts_.end()) { | 1691 if (iter != proxy_hosts_.end()) { |
| 1677 delete iter->second; | 1692 delete iter->second; |
| 1678 proxy_hosts_.erase(iter); | 1693 proxy_hosts_.erase(iter); |
| 1679 } | 1694 } |
| 1680 } | 1695 } |
| 1681 | 1696 |
| 1682 } // namespace content | 1697 } // namespace content |
| OLD | NEW |