Commit ecd3b020 authored by Fergal Daly's avatar Fergal Daly Committed by Commit Bot

Rename InitializeRenderFrameForImmediateUse to include "Main".

All uses of it are for main frame. We do not want any new uses of it, so
renaming makes things clearer. Also, add a DCHECK to enforce it.

Change-Id: I7c34f4b6bc7bbf3f02572a684aeb3ecb34e090c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2263512Reviewed-by: default avatarArthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Commit-Queue: Fergal Daly <fergal@chromium.org>
Auto-Submit: Fergal Daly <fergal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#782194}
parent 341ef456
...@@ -3055,7 +3055,12 @@ void NavigationControllerImpl::HandleRendererDebugURL( ...@@ -3055,7 +3055,12 @@ void NavigationControllerImpl::HandleRendererDebugURL(
DiscardNonCommittedEntries(); DiscardNonCommittedEntries();
return; return;
} }
frame_tree_node->render_manager()->InitializeRenderFrameForImmediateUse(); // The current frame is always a main frame. If IsInitialNavigation() is
// true then there have been no navigations and any frames of this tab must
// be in the same renderer process. If that has crashed then the only frame
// that can be revived is the main frame.
frame_tree_node->render_manager()
->InitializeMainRenderFrameForImmediateUse();
} }
frame_tree_node->current_frame_host()->HandleRendererDebugURL(url); frame_tree_node->current_frame_host()->HandleRendererDebugURL(url);
} }
......
...@@ -1530,11 +1530,12 @@ RenderFrameHostManager::GetSiteInstanceForNavigation( ...@@ -1530,11 +1530,12 @@ RenderFrameHostManager::GetSiteInstanceForNavigation(
return new_instance; return new_instance;
} }
bool RenderFrameHostManager::InitializeRenderFrameForImmediateUse() { bool RenderFrameHostManager::InitializeMainRenderFrameForImmediateUse() {
// TODO(jam): this copies some logic inside GetFrameHostForNavigation, which // TODO(jam): this copies some logic inside GetFrameHostForNavigation, which
// also duplicates logic in Navigate. They should all use this method, but // also duplicates logic in Navigate. They should all use this method, but
// that involves slight reordering. // that involves slight reordering.
// http://crbug.com/794229 // http://crbug.com/794229
DCHECK(frame_tree_node_->IsMainFrame());
if (render_frame_host_->IsRenderFrameLive()) if (render_frame_host_->IsRenderFrameLive())
return true; return true;
...@@ -1555,10 +1556,8 @@ bool RenderFrameHostManager::InitializeRenderFrameForImmediateUse() { ...@@ -1555,10 +1556,8 @@ bool RenderFrameHostManager::InitializeRenderFrameForImmediateUse() {
// RenderFrameHostManager are completely initialized. This should be // RenderFrameHostManager are completely initialized. This should be
// removed once the process manager moves away from NotificationService. // removed once the process manager moves away from NotificationService.
// See https://crbug.com/462682. // See https://crbug.com/462682.
if (frame_tree_node_->IsMainFrame()) { delegate_->NotifyMainFrameSwappedFromRenderManager(nullptr,
delegate_->NotifyMainFrameSwappedFromRenderManager( render_frame_host_.get());
nullptr, render_frame_host_.get());
}
return true; return true;
} }
......
...@@ -488,11 +488,11 @@ class CONTENT_EXPORT RenderFrameHostManager ...@@ -488,11 +488,11 @@ class CONTENT_EXPORT RenderFrameHostManager
scoped_refptr<SiteInstance> GetSiteInstanceForNavigationRequest( scoped_refptr<SiteInstance> GetSiteInstanceForNavigationRequest(
NavigationRequest* navigation_request); NavigationRequest* navigation_request);
// Helper to initialize the current RenderFrame if it's not initialized. // Helper to initialize the main RenderFrame if it's not initialized.
// TODO(https://crbug.com/936696): Remove this. For now debug URLs and // TODO(https://crbug.com/936696): Remove this. For now debug URLs and
// WebView JS execution are an exception to replacing all crashed frames for // WebView JS execution are an exception to replacing all crashed frames for
// RenderDocument. This is a no-op if the frame is already initialized. // RenderDocument. This is a no-op if the frame is already initialized.
bool InitializeRenderFrameForImmediateUse(); bool InitializeMainRenderFrameForImmediateUse();
// Prepares the FrameTreeNode for attaching an inner WebContents. This step // Prepares the FrameTreeNode for attaching an inner WebContents. This step
// may involve replacing |current_frame_host()| with a new RenderFrameHost // may involve replacing |current_frame_host()| with a new RenderFrameHost
......
...@@ -504,7 +504,7 @@ bool WebContentsAndroid::InitializeRenderFrameForJavaScript() { ...@@ -504,7 +504,7 @@ bool WebContentsAndroid::InitializeRenderFrameForJavaScript() {
if (!web_contents_->GetFrameTree() if (!web_contents_->GetFrameTree()
->root() ->root()
->render_manager() ->render_manager()
->InitializeRenderFrameForImmediateUse()) { ->InitializeMainRenderFrameForImmediateUse()) {
LOG(ERROR) << "Failed to initialize RenderFrame to evaluate javascript"; LOG(ERROR) << "Failed to initialize RenderFrame to evaluate javascript";
return false; return false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment