Chromium Code Reviews| Index: content/browser/web_contents/web_contents_impl.cc |
| diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
| index ea91c32ffe87afe7fef003d6daf03ca5b60b431f..5e79b2fe214c5bbf321369d9fe9d9aec078a4929 100644 |
| --- a/content/browser/web_contents/web_contents_impl.cc |
| +++ b/content/browser/web_contents/web_contents_impl.cc |
| @@ -3872,6 +3872,8 @@ void WebContentsImpl::RenderViewDeleted(RenderViewHost* rvh) { |
| void WebContentsImpl::UpdateState(RenderViewHost* rvh, |
| int32 page_id, |
| const PageState& page_state) { |
| + DCHECK(!SiteIsolationPolicy::UseSubframeNavigationEntries()); |
| + |
| // Ensure that this state update comes from a RenderViewHost that belongs to |
| // this WebContents. |
| // TODO(nasko): This should go through RenderFrameHost. |
| @@ -3892,14 +3894,7 @@ void WebContentsImpl::UpdateState(RenderViewHost* rvh, |
| NavigationEntryImpl* new_entry = controller_.GetEntryWithUniqueID( |
| static_cast<RenderFrameHostImpl*>(rvhi->GetMainFrame())->nav_entry_id()); |
| - if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { |
| - // TODO(creis): We can't properly update state for cross-process subframes |
| - // until PageState is decomposed into FrameStates. Until then, use the new |
| - // method. |
| - entry = new_entry; |
| - } else { |
| - DCHECK_EQ(entry, new_entry); |
| - } |
| + DCHECK_EQ(entry, new_entry); |
| if (page_state == entry->GetPageState()) |
| return; // Nothing to update. |
| @@ -4061,6 +4056,33 @@ void WebContentsImpl::DocumentOnLoadCompleted( |
| NotificationService::NoDetails()); |
| } |
| +void WebContentsImpl::UpdateStateForFrame(RenderFrameHost* render_frame_host, |
| + const PageState& page_state) { |
| + DCHECK(SiteIsolationPolicy::UseSubframeNavigationEntries()); |
| + |
| + // The state update affects the last NavigationEntry associated with the given |
| + // |render_frame_host|. This may not be the last committed NavigationEntry (as |
| + // in the case of an UpdateState from a frame being swapped out). We track |
| + // which entry this is in the RenderFrameHost's nav_entry_id. |
| + RenderFrameHostImpl* rfhi = |
| + static_cast<RenderFrameHostImpl*>(render_frame_host); |
| + NavigationEntryImpl* entry = |
| + controller_.GetEntryWithUniqueID(rfhi->nav_entry_id()); |
| + if (!entry) |
| + return; |
| + |
| + FrameNavigationEntry* frame_entry = |
| + entry->GetFrameEntry(rfhi->frame_tree_node()); |
| + if (!frame_entry) |
| + return; |
| + |
| + CHECK_EQ(frame_entry->site_instance(), rfhi->GetSiteInstance()); |
| + if (page_state == frame_entry->page_state()) |
| + return; // Nothing to update. |
| + frame_entry->set_page_state(page_state); |
|
nasko
2015/11/04 21:12:29
nit: Empty line after the return.
Charlie Reis
2015/11/04 21:17:44
Done.
|
| + controller_.NotifyEntryChanged(entry); |
| +} |
| + |
| void WebContentsImpl::UpdateTitle(RenderFrameHost* render_frame_host, |
| int32 page_id, |
| const base::string16& title, |