Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1008)

Unified Diff: content/browser/frame_host/render_frame_host_manager.h

Issue 379143002: PlzNavigate: implement RequestNavigation in the no live renderer case (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Charlie's comments Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/render_frame_host_manager.h
diff --git a/content/browser/frame_host/render_frame_host_manager.h b/content/browser/frame_host/render_frame_host_manager.h
index 92c31fbb1212f89f1899702fd742fe1f3572eba0..aaf0bcddc24ff24c941b8ca84984bd24821e5023 100644
--- a/content/browser/frame_host/render_frame_host_manager.h
+++ b/content/browser/frame_host/render_frame_host_manager.h
@@ -18,6 +18,7 @@
#include "content/public/common/referrer.h"
struct FrameHostMsg_BeginNavigation_Params;
+struct FrameMsg_Navigate_Params;
namespace content {
class BrowserContext;
@@ -41,6 +42,7 @@ class RenderWidgetHostDelegate;
class RenderWidgetHostView;
class TestWebContents;
class WebUIImpl;
+struct NavigationBeforeCommitInfo;
// Manages RenderFrameHosts for a FrameTreeNode. This class acts as a state
// machine to make cross-process navigations in a frame possible.
@@ -55,6 +57,11 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver {
// There is additional complexity that some of the functions we need in
// WebContentsImpl are inherited and non-virtual. These are named with
// "RenderManager" so that the duplicate implementation of them will be clear.
+ //
+ // Functions and parameters whose description are prefixed by PlzNavigate are
+ // part of a navigation refactoring project, currently behind the
+ // enable-browser-side-navigation flag. The idea is to move the logic behind
+ // driving navigations from the renderer to the browser.
class CONTENT_EXPORT Delegate {
public:
// Initializes the given renderer if necessary and creates the view ID
@@ -191,6 +198,12 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver {
// could not be created.
RenderFrameHostImpl* Navigate(const NavigationEntryImpl& entry);
+ // PlzNavigate: sends a RequestNavigation IPC to the renderer to ask it to
+ // navigate. If no live renderer is present, then the navigation request will
+ // be sent directly to the ResourceDispatcherHost.
+ bool RequestNavigation(const NavigationEntryImpl& entry,
+ const FrameMsg_Navigate_Params& navigate_params);
+
// Instructs the various live views to stop. Called when the user directed the
// page to stop loading.
void Stop();
@@ -250,7 +263,6 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver {
// Helper method to create and initialize a RenderFrameHost. If |swapped_out|
// is true, it will be initially placed on the swapped out hosts list.
- // Otherwise, it will be used for a pending cross-site navigation.
// Returns the routing id of the *view* associated with the frame.
int CreateRenderFrame(SiteInstance* instance,
int opener_route_id,
@@ -311,14 +323,23 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver {
// of WebContentsImpl.
void ResetProxyHosts();
- // Used to start a navigation, part of browser-side navigation project.
- void OnBeginNavigation(const FrameHostMsg_BeginNavigation_Params& params);
+ // PlzNavigate: Used to start a navigation. OnBeginNavigation is called
+ // direclty by RequestNavigation when there is no live-renderer. Otherwise, it
Charlie Reis 2014/08/12 19:04:50 nit: directly nit: no hyphen in live renderer
clamy 2014/08/13 13:27:24 Done.
+ // is called following a BeginNavigation IPC from the renderer (which in
+ // browser-initiated navigation also happens after RequestNavigation has been
+ // called).
+ void OnBeginNavigation(const FrameHostMsg_BeginNavigation_Params& params,
nasko 2014/08/13 00:08:00 nit: it will be nice to put all PlzNavigate method
clamy 2014/08/13 13:27:24 Done.
+ const NavigationEntryImpl& entry);
// Returns the routing id for a RenderFrameHost or RenderFrameHostProxy
// that has the given SiteInstance and is associated with this
// RenderFrameHostManager. Returns MSG_ROUTING_NONE if none is found.
int GetRoutingIdForSiteInstance(SiteInstance* site_instance);
+ // PlzNavigate: Called when a navigation request has received a response, to
+ // select a renderer to use for the navigation.
+ void CommitNavigation(const NavigationBeforeCommitInfo& info);
+
private:
friend class RenderFrameHostManagerTest;
friend class TestWebContents;
@@ -402,15 +423,26 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver {
const NavigationEntry* current_entry,
const NavigationEntryImpl* new_entry) const;
- // Returns an appropriate SiteInstance object for the given NavigationEntry,
- // possibly reusing the current SiteInstance. If --process-per-tab is used,
- // this is only called when ShouldSwapBrowsingInstancesForNavigation returns
- // true.
+ // Returns the SiteInstance to use for the navigation.
+ SiteInstance* GetSiteInstanceForNavigation(const NavigationEntryImpl& entry);
+
+ // Helper function that returns an appropriate SiteInstance object for the
+ // given NavigationEntry, possibly reusing the current SiteInstance. If
+ // --process-per-tab is used, this is only called when
+ // ShouldSwapBrowsingInstancesForNavigation returns true. Caller should use
+ // GetSiteInstanceForNavigation.
SiteInstance* GetSiteInstanceForEntry(
const NavigationEntryImpl& entry,
SiteInstance* current_instance,
bool force_browsing_instance_swap);
+ // Creates a new RenderFrameHostImpl for the |new_instance| while respecting
+ // the opener route if needed and stores it in pending_render_frame_host_.
+ void CreateRenderFrameHostForNewSiteInstance(
+ SiteInstance* old_instance,
+ SiteInstance* new_instance,
+ bool is_main_frame);
+
// Creates a RenderFrameHost and corresponding RenderViewHost if necessary.
scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost(SiteInstance* instance,
int view_routing_id,
@@ -529,7 +561,8 @@ class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver {
NotificationRegistrar registrar_;
- // Owns a navigation request that originated in that frame until it commits.
+ // PlzNavigate: Owns a navigation request that originated in that frame until
+ // it commits.
scoped_ptr<NavigationRequest> navigation_request_;
base::WeakPtrFactory<RenderFrameHostManager> weak_factory_;

Powered by Google App Engine
This is Rietveld 408576698