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

Side by Side Diff: content/browser/frame_host/render_frame_host_manager.h

Issue 1426403006: Reland #1 of: Move WebUI ownership from the RenderFrameHostManager to the RenderFrameHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address CR comments. Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
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 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "content/browser/frame_host/render_frame_host_impl.h"
15 #include "content/browser/renderer_host/render_view_host_delegate.h" 16 #include "content/browser/renderer_host/render_view_host_delegate.h"
16 #include "content/browser/site_instance_impl.h" 17 #include "content/browser/site_instance_impl.h"
17 #include "content/common/content_export.h" 18 #include "content/common/content_export.h"
18 #include "content/public/browser/global_request_id.h" 19 #include "content/public/browser/global_request_id.h"
19 #include "content/public/common/referrer.h" 20 #include "content/public/common/referrer.h"
20 #include "ui/base/page_transition_types.h" 21 #include "ui/base/page_transition_types.h"
21 #include "url/origin.h" 22 #include "url/origin.h"
22 23
23 namespace content { 24 namespace content {
24 class BrowserContext; 25 class BrowserContext;
25 class CrossProcessFrameConnector; 26 class CrossProcessFrameConnector;
26 class CrossSiteTransferringRequest; 27 class CrossSiteTransferringRequest;
27 class FrameNavigationEntry; 28 class FrameNavigationEntry;
28 class FrameTreeNode; 29 class FrameTreeNode;
29 class InterstitialPageImpl; 30 class InterstitialPageImpl;
30 class NavigationControllerImpl; 31 class NavigationControllerImpl;
31 class NavigationEntry; 32 class NavigationEntry;
32 class NavigationEntryImpl; 33 class NavigationEntryImpl;
33 class NavigationHandleImpl; 34 class NavigationHandleImpl;
34 class NavigationRequest; 35 class NavigationRequest;
35 class NavigatorTestWithBrowserSideNavigation; 36 class NavigatorTestWithBrowserSideNavigation;
36 class RenderFrameHost;
37 class RenderFrameHostDelegate; 37 class RenderFrameHostDelegate;
38 class RenderFrameHostImpl;
39 class RenderFrameHostManagerTest; 38 class RenderFrameHostManagerTest;
40 class RenderFrameProxyHost; 39 class RenderFrameProxyHost;
41 class RenderViewHost; 40 class RenderViewHost;
42 class RenderViewHostImpl; 41 class RenderViewHostImpl;
43 class RenderWidgetHostDelegate; 42 class RenderWidgetHostDelegate;
44 class RenderWidgetHostView; 43 class RenderWidgetHostView;
45 class TestWebContents; 44 class TestWebContents;
46 class WebUIImpl; 45 class WebUIImpl;
47 struct CommonNavigationParams; 46 struct CommonNavigationParams;
48 struct FrameReplicationState; 47 struct FrameReplicationState;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 RenderFrameHost* new_host, 140 RenderFrameHost* new_host,
142 bool is_main_frame) = 0; 141 bool is_main_frame) = 0;
143 // TODO(nasko): This should be removed once extensions no longer use 142 // TODO(nasko): This should be removed once extensions no longer use
144 // NotificationService. See https://crbug.com/462682. 143 // NotificationService. See https://crbug.com/462682.
145 virtual void NotifyMainFrameSwappedFromRenderManager( 144 virtual void NotifyMainFrameSwappedFromRenderManager(
146 RenderViewHost* old_host, 145 RenderViewHost* old_host,
147 RenderViewHost* new_host) = 0; 146 RenderViewHost* new_host) = 0;
148 virtual NavigationControllerImpl& 147 virtual NavigationControllerImpl&
149 GetControllerForRenderManager() = 0; 148 GetControllerForRenderManager() = 0;
150 149
151 // Creates a WebUI object for the given URL if one applies. Ownership of the
152 // returned pointer will be passed to the caller. If no WebUI applies,
153 // returns NULL.
154 virtual scoped_ptr<WebUIImpl> CreateWebUIForRenderManager(
155 const GURL& url) = 0;
156
157 // Returns the navigation entry of the current navigation, or NULL if there 150 // Returns the navigation entry of the current navigation, or NULL if there
158 // is none. 151 // is none.
159 virtual NavigationEntry* 152 virtual NavigationEntry*
160 GetLastCommittedNavigationEntryForRenderManager() = 0; 153 GetLastCommittedNavigationEntryForRenderManager() = 0;
161 154
162 // Returns true if the location bar should be focused by default rather than 155 // Returns true if the location bar should be focused by default rather than
163 // the page contents. The view calls this function when the tab is focused 156 // the page contents. The view calls this function when the tab is focused
164 // to see what it should do. 157 // to see what it should do.
165 virtual bool FocusLocationBarByDefault() = 0; 158 virtual bool FocusLocationBarByDefault() = 0;
166 159
(...skipping 12 matching lines...) Expand all
179 172
180 protected: 173 protected:
181 virtual ~Delegate() {} 174 virtual ~Delegate() {}
182 }; 175 };
183 176
184 // Used with FrameTree::ForEach to delete RenderFrameHosts pending shutdown 177 // Used with FrameTree::ForEach to delete RenderFrameHosts pending shutdown
185 // from a FrameTreeNode's RenderFrameHostManager. Used during destruction of 178 // from a FrameTreeNode's RenderFrameHostManager. Used during destruction of
186 // WebContentsImpl. 179 // WebContentsImpl.
187 static bool ClearRFHsPendingShutdown(FrameTreeNode* node); 180 static bool ClearRFHsPendingShutdown(FrameTreeNode* node);
188 181
182 // Used with FrameTree::ForEach to destroy all WebUI instances associated with
183 // RenderFrameHosts.
184 static bool ClearWebUIInstances(FrameTreeNode* node);
185
189 // All three delegate pointers must be non-NULL and are not owned by this 186 // All three delegate pointers must be non-NULL and are not owned by this
190 // class. They must outlive this class. The RenderViewHostDelegate and 187 // class. They must outlive this class. The RenderViewHostDelegate and
191 // RenderWidgetHostDelegate are what will be installed into all 188 // RenderWidgetHostDelegate are what will be installed into all
192 // RenderViewHosts that are created. 189 // RenderViewHosts that are created.
193 // 190 //
194 // You must call Init() before using this class. 191 // You must call Init() before using this class.
195 RenderFrameHostManager( 192 RenderFrameHostManager(
196 FrameTreeNode* frame_tree_node, 193 FrameTreeNode* frame_tree_node,
197 RenderFrameHostDelegate* render_frame_delegate, 194 RenderFrameHostDelegate* render_frame_delegate,
198 RenderViewHostDelegate* render_view_delegate, 195 RenderViewHostDelegate* render_view_delegate,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // SiteInstance. Returns nullptr if this WebContents isn't part of inner/outer 239 // SiteInstance. Returns nullptr if this WebContents isn't part of inner/outer
243 // relationship. 240 // relationship.
244 RenderFrameProxyHost* GetProxyToOuterDelegate(); 241 RenderFrameProxyHost* GetProxyToOuterDelegate();
245 242
246 // Removes the FrameTreeNode in the outer WebContents that represents this 243 // Removes the FrameTreeNode in the outer WebContents that represents this
247 // FrameTreeNode. 244 // FrameTreeNode.
248 // TODO(lazyboy): This does not belong to RenderFrameHostManager, move it to 245 // TODO(lazyboy): This does not belong to RenderFrameHostManager, move it to
249 // somehwere else. 246 // somehwere else.
250 void RemoveOuterDelegateFrame(); 247 void RemoveOuterDelegateFrame();
251 248
252 // Returns the pending RenderFrameHost, or NULL if there is no pending one. 249 // Returns the pending RenderFrameHost, or null if there is no pending one.
253 RenderFrameHostImpl* pending_frame_host() const { 250 RenderFrameHostImpl* pending_frame_host() const {
254 return pending_render_frame_host_.get(); 251 return pending_render_frame_host_.get();
255 } 252 }
256 253
257 // Returns the speculative RenderFrameHost, or null if there is no speculative 254 // Returns the speculative RenderFrameHost, or null if there is no speculative
258 // one. 255 // one.
259 RenderFrameHostImpl* speculative_frame_host() const { 256 RenderFrameHostImpl* speculative_frame_host() const {
260 return speculative_render_frame_host_.get(); 257 return speculative_render_frame_host_.get();
261 } 258 }
262 259
263 // TODO(creis): Remove this when we no longer use RVH for navigation. 260 // TODO(creis): Remove this when we no longer use RVH for navigation.
264 RenderViewHostImpl* pending_render_view_host() const; 261 RenderViewHostImpl* pending_render_view_host() const;
265 262
266 // Returns the current committed Web UI or NULL if none applies. 263 // Returns the WebUI associated with the ongoing navigation, it being either
267 WebUIImpl* web_ui() const { return web_ui_.get(); } 264 // the active or the pending one from the navigating RenderFrameHost. Returns
268 265 // null if there's no ongoing navigation or if no WebUI applies.
269 // Returns the Web UI for the pending navigation, or NULL of none applies. 266 WebUIImpl* GetNavigatingWebUI() const;
270 WebUIImpl* pending_web_ui() const {
271 return pending_web_ui_.get() ? pending_web_ui_.get() :
272 pending_and_current_web_ui_.get();
273 }
274
275 // PlzNavigate
276 // Returns the speculative WebUI for the navigation (a newly created one or
277 // the current one if it should be reused). If none is set returns nullptr.
278 WebUIImpl* speculative_web_ui() const {
279 return should_reuse_web_ui_ ? web_ui_.get() : speculative_web_ui_.get();
280 }
281 267
282 // Called when we want to instruct the renderer to navigate to the given 268 // Called when we want to instruct the renderer to navigate to the given
283 // navigation entry. It may create a new RenderFrameHost or re-use an existing 269 // navigation entry. It may create a new RenderFrameHost or re-use an existing
284 // one. The RenderFrameHost to navigate will be returned. Returns NULL if one 270 // one. The RenderFrameHost to navigate will be returned. Returns NULL if one
285 // could not be created. |dest_url| takes precedence over the |frame_entry|'s 271 // could not be created. |dest_url| takes precedence over the |frame_entry|'s
286 // url (this is necessary because ReloadOriginalRequest navigates to a 272 // url (this is necessary because ReloadOriginalRequest navigates to a
287 // different URL than the last committed entry, without modifying it). 273 // different URL than the last committed entry, without modifying it).
288 RenderFrameHostImpl* Navigate(const GURL& dest_url, 274 RenderFrameHostImpl* Navigate(const GURL& dest_url,
289 const FrameNavigationEntry& frame_entry, 275 const FrameNavigationEntry& frame_entry,
290 const NavigationEntryImpl& entry); 276 const NavigationEntryImpl& entry);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 332
347 // Called when this frame's opener is changed to the frame specified by 333 // Called when this frame's opener is changed to the frame specified by
348 // |opener_routing_id| in |source_site_instance|'s process. This change 334 // |opener_routing_id| in |source_site_instance|'s process. This change
349 // could come from either the current RenderFrameHost or one of the 335 // could come from either the current RenderFrameHost or one of the
350 // proxies (e.g., window.open that targets a RemoteFrame by name). The 336 // proxies (e.g., window.open that targets a RemoteFrame by name). The
351 // updated opener will be forwarded to any other RenderFrameProxies and 337 // updated opener will be forwarded to any other RenderFrameProxies and
352 // RenderFrames for this FrameTreeNode. 338 // RenderFrames for this FrameTreeNode.
353 void DidChangeOpener(int opener_routing_id, 339 void DidChangeOpener(int opener_routing_id,
354 SiteInstance* source_site_instance); 340 SiteInstance* source_site_instance);
355 341
356 // Sets the pending Web UI for the pending navigation, ensuring that the 342 // Creates and initializes a RenderFrameHost. If |flags| has the
357 // bindings are appropriate compared to |bindings|.
358 void SetPendingWebUI(const GURL& url, int bindings);
359
360 // Creates and initializes a RenderFrameHost. The |web_ui| is an optional
361 // input parameter used to double check bindings when swapping back in a
362 // previously existing RenderFrameHost. If |flags| has the
363 // CREATE_RF_SWAPPED_OUT bit set from the CreateRenderFrameFlags enum, it will 343 // CREATE_RF_SWAPPED_OUT bit set from the CreateRenderFrameFlags enum, it will
364 // initially be placed on the swapped out hosts list. If |view_routing_id_ptr| 344 // initially be placed on the swapped out hosts list. If |view_routing_id_ptr|
365 // is not nullptr it will be set to the routing id of the view associated with 345 // is not nullptr it will be set to the routing id of the view associated with
366 // the frame. 346 // the frame.
367 scoped_ptr<RenderFrameHostImpl> CreateRenderFrame(SiteInstance* instance, 347 scoped_ptr<RenderFrameHostImpl> CreateRenderFrame(SiteInstance* instance,
368 WebUIImpl* web_ui,
369 int flags, 348 int flags,
370 int* view_routing_id_ptr); 349 int* view_routing_id_ptr);
371 350
372 // Helper method to create and initialize a RenderFrameProxyHost and return 351 // Helper method to create and initialize a RenderFrameProxyHost and return
373 // its routing id. 352 // its routing id.
374 int CreateRenderFrameProxy(SiteInstance* instance); 353 int CreateRenderFrameProxy(SiteInstance* instance);
375 354
376 // Creates proxies for a new child frame at FrameTreeNode |child| in all 355 // Creates proxies for a new child frame at FrameTreeNode |child| in all
377 // SiteInstances for which the current frame has proxies. This method is 356 // SiteInstances for which the current frame has proxies. This method is
378 // called on the parent of a new child frame before the child leaves the 357 // called on the parent of a new child frame before the child leaves the
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 // SiteInstance's site and when we later call IsSameWebSite. If there is no 540 // SiteInstance's site and when we later call IsSameWebSite. If there is no
562 // current NavigationEntry, check the current SiteInstance's site, which might 541 // current NavigationEntry, check the current SiteInstance's site, which might
563 // already be committed to a Web UI URL (such as the NTP). 542 // already be committed to a Web UI URL (such as the NTP).
564 bool ShouldSwapBrowsingInstancesForNavigation( 543 bool ShouldSwapBrowsingInstancesForNavigation(
565 const GURL& current_effective_url, 544 const GURL& current_effective_url,
566 bool current_is_view_source_mode, 545 bool current_is_view_source_mode,
567 SiteInstance* new_site_instance, 546 SiteInstance* new_site_instance,
568 const GURL& new_effective_url, 547 const GURL& new_effective_url,
569 bool new_is_view_source_mode) const; 548 bool new_is_view_source_mode) const;
570 549
571 // Creates a new Web UI, ensuring that the bindings are appropriate compared
572 // to |bindings|.
573 scoped_ptr<WebUIImpl> CreateWebUI(const GURL& url, int bindings);
574
575 // Returns true if it is safe to reuse the current WebUI when navigating from
576 // |current_entry| to |new_url|.
577 bool ShouldReuseWebUI(
578 const NavigationEntry* current_entry,
579 const GURL& new_url) const;
580
581 // Returns the SiteInstance to use for the navigation. 550 // Returns the SiteInstance to use for the navigation.
582 SiteInstance* GetSiteInstanceForNavigation(const GURL& dest_url, 551 SiteInstance* GetSiteInstanceForNavigation(const GURL& dest_url,
583 SiteInstance* source_instance, 552 SiteInstance* source_instance,
584 SiteInstance* dest_instance, 553 SiteInstance* dest_instance,
585 SiteInstance* candidate_instance, 554 SiteInstance* candidate_instance,
586 ui::PageTransition transition, 555 ui::PageTransition transition,
587 bool dest_is_restore, 556 bool dest_is_restore,
588 bool dest_is_view_source_mode); 557 bool dest_is_view_source_mode);
589 558
590 // Returns a descriptor of the appropriate SiteInstance object for the given 559 // Returns a descriptor of the appropriate SiteInstance object for the given
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 FrameTreeNode* skip_this_node); 626 FrameTreeNode* skip_this_node);
658 627
659 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary. 628 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary.
660 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost(SiteInstance* instance, 629 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost(SiteInstance* instance,
661 int32 view_routing_id, 630 int32 view_routing_id,
662 int32 frame_routing_id, 631 int32 frame_routing_id,
663 int32 widget_routing_id, 632 int32 widget_routing_id,
664 int flags); 633 int flags);
665 634
666 // PlzNavigate 635 // PlzNavigate
667 // Creates and initializes a speculative RenderFrameHost and/or WebUI for an 636 // Create and initialize a speculative RenderFrameHost for an ongoing
668 // ongoing navigation. They might be destroyed and re-created later if the 637 // navigation. It might be destroyed and re-created later if the navigation
669 // navigation is redirected to a different SiteInstance. 638 // is redirected to a different SiteInstance.
670 bool CreateSpeculativeRenderFrameHost(const GURL& url, 639 bool CreateSpeculativeRenderFrameHost(SiteInstance* old_instance,
671 SiteInstance* old_instance, 640 SiteInstance* new_instance);
672 SiteInstance* new_instance,
673 int bindings);
674 641
675 // Sets up the necessary state for a new RenderViewHost. If |proxy| is not 642 // Sets up the necessary state for a new RenderViewHost. If |proxy| is not
676 // null, it creates a RenderFrameProxy in the target renderer process which is 643 // null, it creates a RenderFrameProxy in the target renderer process which is
677 // used to route IPC messages when in swapped out state. Returns early if the 644 // used to route IPC messages when in swapped out state. Returns early if the
678 // RenderViewHost has already been initialized for another RenderFrameHost. 645 // RenderViewHost has already been initialized for another RenderFrameHost.
679 bool InitRenderView(RenderViewHostImpl* render_view_host, 646 bool InitRenderView(RenderViewHostImpl* render_view_host,
680 RenderFrameProxyHost* proxy); 647 RenderFrameProxyHost* proxy);
681 648
682 // Initialization for RenderFrameHost uses the same sequence as InitRenderView 649 // Initialization for RenderFrameHost uses the same sequence as InitRenderView
683 // above. 650 // above.
684 bool InitRenderFrame(RenderFrameHostImpl* render_frame_host); 651 bool InitRenderFrame(RenderFrameHostImpl* render_frame_host);
685 652
686 // Sets the pending RenderFrameHost/WebUI to be the active one. Note that this 653 // Sets the pending RenderFrameHost to be the active one. If the current one
687 // doesn't require the pending render_frame_host_ pointer to be non-NULL, 654 // is being reused this method might update its active WebUI. Call this for
688 // since there could be Web UI switching as well. Call this for every commit. 655 // every commit.
689 // If PlzNavigate is enabled the method will set the speculative (not pending) 656 // If PlzNavigate is enabled the method will set the speculative (not pending)
690 // RenderFrameHost to be the active one. 657 // RenderFrameHost to be the active one.
691 void CommitPending(); 658 void CommitPending();
692 659
693 // Helper to call CommitPending() in all necessary cases. 660 // Helper to call CommitPending() in all necessary cases.
694 void CommitPendingIfNecessary(RenderFrameHostImpl* render_frame_host, 661 void CommitPendingIfNecessary(RenderFrameHostImpl* render_frame_host,
695 bool was_caused_by_user_gesture); 662 bool was_caused_by_user_gesture);
696 663
697 // Commits any pending sandbox flag updates when the renderer's frame 664 // Commits any pending sandbox flag updates when the renderer's frame
698 // navigates. 665 // navigates.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 RenderFrameHostImpl* UpdateStateForNavigate( 701 RenderFrameHostImpl* UpdateStateForNavigate(
735 const GURL& dest_url, 702 const GURL& dest_url,
736 SiteInstance* source_instance, 703 SiteInstance* source_instance,
737 SiteInstance* dest_instance, 704 SiteInstance* dest_instance,
738 ui::PageTransition transition, 705 ui::PageTransition transition,
739 bool dest_is_restore, 706 bool dest_is_restore,
740 bool dest_is_view_source_mode, 707 bool dest_is_view_source_mode,
741 const GlobalRequestID& transferred_request_id, 708 const GlobalRequestID& transferred_request_id,
742 int bindings); 709 int bindings);
743 710
711 // Updates the pending WebUI of the current RenderFrameHost for a same-site
712 // navigation.
713 void UpdatePendingWebUIOnCurrentFrameHost(const GURL& dest_url,
714 int entry_bindings);
715
744 // Called when a renderer process is starting to close. We should not 716 // Called when a renderer process is starting to close. We should not
745 // schedule new navigations in its swapped out RenderFrameHosts after this. 717 // schedule new navigations in its swapped out RenderFrameHosts after this.
746 void RendererProcessClosing(RenderProcessHost* render_process_host); 718 void RendererProcessClosing(RenderProcessHost* render_process_host);
747 719
748 // For use in creating RenderFrameHosts. 720 // For use in creating RenderFrameHosts.
749 FrameTreeNode* frame_tree_node_; 721 FrameTreeNode* frame_tree_node_;
750 722
751 // Our delegate, not owned by us. Guaranteed non-NULL. 723 // Our delegate, not owned by us. Guaranteed non-NULL.
752 Delegate* delegate_; 724 Delegate* delegate_;
753 725
754 // Implemented by the owner of this class. These delegates are installed into 726 // Implemented by the owner of this class. These delegates are installed into
755 // all the RenderFrameHosts that we create. 727 // all the RenderFrameHosts that we create.
756 RenderFrameHostDelegate* render_frame_delegate_; 728 RenderFrameHostDelegate* render_frame_delegate_;
757 RenderViewHostDelegate* render_view_delegate_; 729 RenderViewHostDelegate* render_view_delegate_;
758 RenderWidgetHostDelegate* render_widget_delegate_; 730 RenderWidgetHostDelegate* render_widget_delegate_;
759 731
760 // Our RenderFrameHost and its associated Web UI (if any, will be NULL for 732 // Our RenderFrameHost which is responsible for all communication with a child
761 // non-WebUI pages). This object is responsible for all communication with 733 // RenderFrame instance.
762 // a child RenderFrame instance.
763 // For now, RenderFrameHost keeps a RenderViewHost in its SiteInstance alive. 734 // For now, RenderFrameHost keeps a RenderViewHost in its SiteInstance alive.
764 // Eventually, RenderViewHost will be replaced with a page context. 735 // Eventually, RenderViewHost will be replaced with a page context.
765 scoped_ptr<RenderFrameHostImpl> render_frame_host_; 736 scoped_ptr<RenderFrameHostImpl> render_frame_host_;
766 scoped_ptr<WebUIImpl> web_ui_;
767 737
768 // A RenderFrameHost used to load a cross-site page. This remains hidden 738 // A RenderFrameHost used to load a cross-site page. This remains hidden
769 // while a cross-site request is pending until it calls DidNavigate. It may 739 // while a cross-site request is pending until it calls DidNavigate.
770 // have an associated Web UI, in which case the Web UI pointer will be non- 740 // Note: This member is not used in PlzNavigate.
771 // NULL.
772 //
773 // The |pending_web_ui_| may be non-NULL even when the
774 // |pending_render_frame_host_| is NULL. This will happen when we're
775 // transitioning between two Web UI pages: the RFH won't be swapped, so the
776 // pending pointer will be unused, but there will be a pending Web UI
777 // associated with the navigation.
778 // Note: This is not used in PlzNavigate.
779 scoped_ptr<RenderFrameHostImpl> pending_render_frame_host_; 741 scoped_ptr<RenderFrameHostImpl> pending_render_frame_host_;
780 742
781 // If a pending request needs to be transferred to another process, this 743 // If a pending request needs to be transferred to another process, this
782 // owns the request until it's transferred to the new process, so it will be 744 // owns the request until it's transferred to the new process, so it will be
783 // cleaned up if the navigation is cancelled. Otherwise, this is NULL. 745 // cleaned up if the navigation is cancelled. Otherwise, this is NULL.
784 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request_; 746 scoped_ptr<CrossSiteTransferringRequest> cross_site_transferring_request_;
785 747
786 // This is used to temporarily store the NavigationHandle during 748 // This is used to temporarily store the NavigationHandle during
787 // transferring navigations. The handle needs to be stored because the old 749 // transferring navigations. The handle needs to be stored because the old
788 // RenderFrameHost may be discarded before a new RenderFrameHost is created 750 // RenderFrameHost may be discarded before a new RenderFrameHost is created
789 // for the navigation. 751 // for the navigation.
790 // PlzNavigate: this will never be set since there are no transferring 752 // PlzNavigate: this will never be set since there are no transferring
791 // navigations in PlzNavigate. 753 // navigations in PlzNavigate.
792 scoped_ptr<NavigationHandleImpl> transfer_navigation_handle_; 754 scoped_ptr<NavigationHandleImpl> transfer_navigation_handle_;
793 755
794 // If either of these is non-NULL, the pending navigation is to a chrome:
795 // page. The scoped_ptr is used if pending_web_ui_ != web_ui_, the WeakPtr is
796 // used for when they reference the same object. If either is non-NULL, the
797 // other should be NULL.
798 // Note: These are not used in PlzNavigate.
799 scoped_ptr<WebUIImpl> pending_web_ui_;
800 base::WeakPtr<WebUIImpl> pending_and_current_web_ui_;
801
802 class RenderFrameProxyHostMap; 756 class RenderFrameProxyHostMap;
803 scoped_ptr<RenderFrameProxyHostMap> proxy_hosts_; 757 scoped_ptr<RenderFrameProxyHostMap> proxy_hosts_;
804 758
805 // A list of RenderFrameHosts waiting to shut down after swapping out. We use 759 // A list of RenderFrameHosts waiting to shut down after swapping out. We use
806 // a linked list since we expect frequent deletes and no indexed access, and 760 // a linked list since we expect frequent deletes and no indexed access, and
807 // because sets don't appear to support linked_ptrs. 761 // because sets don't appear to support linked_ptrs.
808 typedef std::list<linked_ptr<RenderFrameHostImpl> > RFHPendingDeleteList; 762 typedef std::list<linked_ptr<RenderFrameHostImpl> > RFHPendingDeleteList;
809 RFHPendingDeleteList pending_delete_hosts_; 763 RFHPendingDeleteList pending_delete_hosts_;
810 764
811 // The intersitial page currently shown if any, not own by this class 765 // The intersitial page currently shown if any, not own by this class
812 // (the InterstitialPage is self-owned, it deletes itself when hidden). 766 // (the InterstitialPage is self-owned, it deletes itself when hidden).
813 InterstitialPageImpl* interstitial_page_; 767 InterstitialPageImpl* interstitial_page_;
814 768
815 // PlzNavigate 769 // PlzNavigate
816 // These members store a speculative RenderFrameHost and WebUI. They are 770 // Stores a speculative RenderFrameHost which is created early in a navigation
817 // created early in a navigation so a renderer process can be started in 771 // so a renderer process can be started in parallel, if needed.
818 // parallel, if needed. This is purely a performance optimization and is not 772 // This is purely a performance optimization and is not required for correct
819 // required for correct behavior. The created RenderFrameHost might be 773 // behavior. The speculative RenderFrameHost might be discarded later on if
820 // discarded later on if the final URL's SiteInstance isn't compatible with 774 // the final URL's SiteInstance isn't compatible with the one used to create
821 // what was used to create it. 775 // it.
822 // Note: PlzNavigate only uses speculative RenderFrameHost and WebUI, not 776 // Note: PlzNavigate only uses the speculative RenderFrameHost, not the
823 // the pending ones. 777 // pending one.
824 scoped_ptr<RenderFrameHostImpl> speculative_render_frame_host_; 778 scoped_ptr<RenderFrameHostImpl> speculative_render_frame_host_;
825 scoped_ptr<WebUIImpl> speculative_web_ui_;
826
827 // PlzNavigate
828 // If true at navigation commit time the current WebUI will be kept instead of
829 // creating a new one.
830 bool should_reuse_web_ui_;
831 779
832 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; 780 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_;
833 781
834 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); 782 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager);
835 }; 783 };
836 784
837 } // namespace content 785 } // namespace content
838 786
839 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ 787 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698