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 if (CommandLine::ForCurrentProcess()->HasSwitch( |
1361 proxy_hosts_.end()); | 1361 switches::kSitePerProcess) && !is_main_frame) { |
awong
2014/09/03 21:58:38
Document why we care that it's not a mainframe?
nasko
2014/09/03 23:50:19
Done.
| |
1362 // In --site-per-process, delete the proxy for the SiteInstance we are | |
1363 // committing | |
1364 RenderFrameProxyHostMap::iterator iter = | |
1365 proxy_hosts_.find(render_frame_host_->GetSiteInstance()->GetId()); | |
1366 if (iter != proxy_hosts_.end()) { | |
1367 delete iter->second; | |
1368 proxy_hosts_.erase(iter); | |
1369 } | |
1370 } | |
1362 | 1371 |
1363 // Capture the active view count on the old RFH SiteInstance, since the | 1372 // 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 | 1373 // ownership might be passed into the proxy and the pointer will be |
1365 // invalid. | 1374 // invalid. |
1366 int active_view_count = | 1375 int active_view_count = |
1367 static_cast<SiteInstanceImpl*>(old_render_frame_host->GetSiteInstance()) | 1376 static_cast<SiteInstanceImpl*>(old_render_frame_host->GetSiteInstance()) |
1368 ->active_view_count(); | 1377 ->active_view_count(); |
1369 | 1378 |
1370 if (is_main_frame) { | 1379 if (is_main_frame) { |
1371 RenderFrameProxyHostMap::iterator iter = | 1380 RenderFrameProxyHostMap::iterator iter = |
(...skipping 14 matching lines...) Expand all Loading... | |
1386 // new process. | 1395 // new process. |
1387 if (!is_main_frame) { | 1396 if (!is_main_frame) { |
1388 RenderFrameProxyHost* proxy = GetProxyToParent(); | 1397 RenderFrameProxyHost* proxy = GetProxyToParent(); |
1389 if (proxy) { | 1398 if (proxy) { |
1390 proxy->SetChildRWHView( | 1399 proxy->SetChildRWHView( |
1391 render_frame_host_->render_view_host()->GetView()); | 1400 render_frame_host_->render_view_host()->GetView()); |
1392 } | 1401 } |
1393 } | 1402 } |
1394 } | 1403 } |
1395 } | 1404 } |
1405 CHECK(proxy_hosts_.find(render_frame_host_->GetSiteInstance()->GetId()) == | |
awong
2014/09/03 21:58:38
Explain why this check is sensible?
nasko
2014/09/03 23:50:19
Done.
| |
1406 proxy_hosts_.end()); | |
1396 } | 1407 } |
1397 | 1408 |
1398 void RenderFrameHostManager::ShutdownRenderFrameProxyHostsInSiteInstance( | 1409 void RenderFrameHostManager::ShutdownRenderFrameProxyHostsInSiteInstance( |
1399 int32 site_instance_id) { | 1410 int32 site_instance_id) { |
1400 // First remove any swapped out RFH for this SiteInstance from our own list. | 1411 // First remove any swapped out RFH for this SiteInstance from our own list. |
1401 ClearProxiesInSiteInstance(site_instance_id, frame_tree_node_); | 1412 ClearProxiesInSiteInstance(site_instance_id, frame_tree_node_); |
1402 | 1413 |
1403 // Use the safe RenderWidgetHost iterator for now to find all RenderViewHosts | 1414 // Use the safe RenderWidgetHost iterator for now to find all RenderViewHosts |
1404 // in the SiteInstance, then tell their respective FrameTrees to remove all | 1415 // in the SiteInstance, then tell their respective FrameTrees to remove all |
1405 // RenderFrameProxyHosts corresponding to them. | 1416 // RenderFrameProxyHosts corresponding to them. |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1673 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 1684 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
1674 SiteInstance* instance) { | 1685 SiteInstance* instance) { |
1675 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 1686 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
1676 if (iter != proxy_hosts_.end()) { | 1687 if (iter != proxy_hosts_.end()) { |
1677 delete iter->second; | 1688 delete iter->second; |
1678 proxy_hosts_.erase(iter); | 1689 proxy_hosts_.erase(iter); |
1679 } | 1690 } |
1680 } | 1691 } |
1681 | 1692 |
1682 } // namespace content | 1693 } // namespace content |
OLD | NEW |