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 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1432 GetSiteInstanceForNavigation( | 1432 GetSiteInstanceForNavigation( |
1433 entry.GetURL(), | 1433 entry.GetURL(), |
1434 entry.site_instance(), | 1434 entry.site_instance(), |
1435 entry.GetTransitionType(), | 1435 entry.GetTransitionType(), |
1436 entry.restore_type() != NavigationEntryImpl::RESTORE_NONE, | 1436 entry.restore_type() != NavigationEntryImpl::RESTORE_NONE, |
1437 entry.IsViewSourceMode()); | 1437 entry.IsViewSourceMode()); |
1438 | 1438 |
1439 const NavigationEntry* current_entry = | 1439 const NavigationEntry* current_entry = |
1440 delegate_->GetLastCommittedNavigationEntryForRenderManager(); | 1440 delegate_->GetLastCommittedNavigationEntryForRenderManager(); |
1441 | 1441 |
1442 if (new_instance != current_instance) { | 1442 if (new_instance.get() != current_instance) { |
1443 // New SiteInstance: create a pending RFH to navigate. | 1443 // New SiteInstance: create a pending RFH to navigate. |
1444 DCHECK(!cross_navigation_pending_); | 1444 DCHECK(!cross_navigation_pending_); |
1445 | 1445 |
1446 // This will possibly create (set to NULL) a Web UI object for the pending | 1446 // This will possibly create (set to NULL) a Web UI object for the pending |
1447 // page. We'll use this later to give the page special access. This must | 1447 // page. We'll use this later to give the page special access. This must |
1448 // happen before the new renderer is created below so it will get bindings. | 1448 // happen before the new renderer is created below so it will get bindings. |
1449 // It must also happen after the above conditional call to CancelPending(), | 1449 // It must also happen after the above conditional call to CancelPending(), |
1450 // otherwise CancelPending may clear the pending_web_ui_ and the page will | 1450 // otherwise CancelPending may clear the pending_web_ui_ and the page will |
1451 // not have its bindings set appropriately. | 1451 // not have its bindings set appropriately. |
1452 SetPendingWebUI(entry); | 1452 SetPendingWebUI(entry); |
1453 CreateRenderFrameHostForNewSiteInstance( | 1453 CreateRenderFrameHostForNewSiteInstance( |
1454 current_instance, new_instance, frame_tree_node_->IsMainFrame()); | 1454 current_instance, new_instance.get(), frame_tree_node_->IsMainFrame()); |
1455 if (!pending_render_frame_host_.get()) { | 1455 if (!pending_render_frame_host_.get()) { |
1456 return NULL; | 1456 return NULL; |
1457 } | 1457 } |
1458 | 1458 |
1459 // Check if our current RFH is live before we set up a transition. | 1459 // Check if our current RFH is live before we set up a transition. |
1460 if (!render_frame_host_->render_view_host()->IsRenderViewLive()) { | 1460 if (!render_frame_host_->render_view_host()->IsRenderViewLive()) { |
1461 if (!cross_navigation_pending_) { | 1461 if (!cross_navigation_pending_) { |
1462 // The current RFH is not live. There's no reason to sit around with a | 1462 // The current RFH is not live. There's no reason to sit around with a |
1463 // sad tab or a newly created RFH while we wait for the pending RFH to | 1463 // sad tab or a newly created RFH while we wait for the pending RFH to |
1464 // navigate. Just switch to the pending RFH now and go back to non | 1464 // navigate. Just switch to the pending RFH now and go back to non |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1512 } | 1512 } |
1513 | 1513 |
1514 // Otherwise the same SiteInstance can be used. Navigate render_frame_host_. | 1514 // Otherwise the same SiteInstance can be used. Navigate render_frame_host_. |
1515 DCHECK(!cross_navigation_pending_); | 1515 DCHECK(!cross_navigation_pending_); |
1516 | 1516 |
1517 // It's possible to swap out the current RFH and then decide to navigate in it | 1517 // It's possible to swap out the current RFH and then decide to navigate in it |
1518 // anyway (e.g., a cross-process navigation that redirects back to the | 1518 // anyway (e.g., a cross-process navigation that redirects back to the |
1519 // original site). In that case, we have a proxy for the current RFH but | 1519 // original site). In that case, we have a proxy for the current RFH but |
1520 // haven't deleted it yet. The new navigation will swap it back in, so we can | 1520 // haven't deleted it yet. The new navigation will swap it back in, so we can |
1521 // delete the proxy. | 1521 // delete the proxy. |
1522 DeleteRenderFrameProxyHost(new_instance); | 1522 DeleteRenderFrameProxyHost(new_instance.get()); |
1523 | 1523 |
1524 if (ShouldReuseWebUI(current_entry, &entry)) { | 1524 if (ShouldReuseWebUI(current_entry, &entry)) { |
1525 pending_web_ui_.reset(); | 1525 pending_web_ui_.reset(); |
1526 pending_and_current_web_ui_ = web_ui_->AsWeakPtr(); | 1526 pending_and_current_web_ui_ = web_ui_->AsWeakPtr(); |
1527 } else { | 1527 } else { |
1528 SetPendingWebUI(entry); | 1528 SetPendingWebUI(entry); |
1529 | 1529 |
1530 // Make sure the new RenderViewHost has the right bindings. | 1530 // Make sure the new RenderViewHost has the right bindings. |
1531 if (pending_web_ui() && | 1531 if (pending_web_ui() && |
1532 !render_frame_host_->GetProcess()->IsIsolatedGuest()) { | 1532 !render_frame_host_->GetProcess()->IsIsolatedGuest()) { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1658 void RenderFrameHostManager::DeleteRenderFrameProxyHost( | 1658 void RenderFrameHostManager::DeleteRenderFrameProxyHost( |
1659 SiteInstance* instance) { | 1659 SiteInstance* instance) { |
1660 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); | 1660 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); |
1661 if (iter != proxy_hosts_.end()) { | 1661 if (iter != proxy_hosts_.end()) { |
1662 delete iter->second; | 1662 delete iter->second; |
1663 proxy_hosts_.erase(iter); | 1663 proxy_hosts_.erase(iter); |
1664 } | 1664 } |
1665 } | 1665 } |
1666 | 1666 |
1667 } // namespace content | 1667 } // namespace content |
OLD | NEW |