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

Side by Side 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: Rebase Created 6 years, 5 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 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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "content/browser/renderer_host/render_view_host_delegate.h" 12 #include "content/browser/renderer_host/render_view_host_delegate.h"
13 #include "content/browser/site_instance_impl.h" 13 #include "content/browser/site_instance_impl.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 #include "content/public/browser/global_request_id.h" 15 #include "content/public/browser/global_request_id.h"
16 #include "content/public/browser/notification_observer.h" 16 #include "content/public/browser/notification_observer.h"
17 #include "content/public/browser/notification_registrar.h" 17 #include "content/public/browser/notification_registrar.h"
18 #include "content/public/common/referrer.h" 18 #include "content/public/common/referrer.h"
19 19
20 struct FrameHostMsg_BeginNavigation_Params; 20 struct FrameHostMsg_BeginNavigation_Params;
21 struct FrameMsg_Navigate_Params;
21 22
22 namespace content { 23 namespace content {
23 class BrowserContext; 24 class BrowserContext;
24 class CrossProcessFrameConnector; 25 class CrossProcessFrameConnector;
25 class CrossSiteTransferringRequest; 26 class CrossSiteTransferringRequest;
26 class InterstitialPageImpl; 27 class InterstitialPageImpl;
27 class FrameTreeNode; 28 class FrameTreeNode;
28 class NavigationControllerImpl; 29 class NavigationControllerImpl;
29 class NavigationEntry; 30 class NavigationEntry;
30 class NavigationEntryImpl; 31 class NavigationEntryImpl;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // Sets the pending Web UI for the pending navigation, ensuring that the 181 // Sets the pending Web UI for the pending navigation, ensuring that the
181 // bindings are appropriate for the given NavigationEntry. 182 // bindings are appropriate for the given NavigationEntry.
182 void SetPendingWebUI(const NavigationEntryImpl& entry); 183 void SetPendingWebUI(const NavigationEntryImpl& entry);
183 184
184 // Called when we want to instruct the renderer to navigate to the given 185 // Called when we want to instruct the renderer to navigate to the given
185 // navigation entry. It may create a new RenderFrameHost or re-use an existing 186 // navigation entry. It may create a new RenderFrameHost or re-use an existing
186 // one. The RenderFrameHost to navigate will be returned. Returns NULL if one 187 // one. The RenderFrameHost to navigate will be returned. Returns NULL if one
187 // could not be created. 188 // could not be created.
188 RenderFrameHostImpl* Navigate(const NavigationEntryImpl& entry); 189 RenderFrameHostImpl* Navigate(const NavigationEntryImpl& entry);
189 190
191 // As part of the PlzNavigate refactoring project, sends a RequestNavigation
192 // IPC to the renderer to ask it to navigate. If no live renderer is present,
193 // then the navigation request will be sent directly to the
194 // ResourceDispatcherHost.
195 bool RequestNavigation(const NavigationEntryImpl& entry,
196 const FrameMsg_Navigate_Params& navigate_params);
197
190 // Instructs the various live views to stop. Called when the user directed the 198 // Instructs the various live views to stop. Called when the user directed the
191 // page to stop loading. 199 // page to stop loading.
192 void Stop(); 200 void Stop();
193 201
194 // Notifies the regular and pending RenderViewHosts that a load is or is not 202 // Notifies the regular and pending RenderViewHosts that a load is or is not
195 // happening. Even though the message is only for one of them, we don't know 203 // happening. Even though the message is only for one of them, we don't know
196 // which one so we tell both. 204 // which one so we tell both.
197 void SetIsLoading(bool is_loading); 205 void SetIsLoading(bool is_loading);
198 206
199 // Whether to close the tab or not when there is a hang during an unload 207 // Whether to close the tab or not when there is a hang during an unload
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 void SwappedOut(RenderFrameHostImpl* render_frame_host); 247 void SwappedOut(RenderFrameHostImpl* render_frame_host);
240 248
241 // Called when a renderer's frame navigates. 249 // Called when a renderer's frame navigates.
242 void DidNavigateFrame(RenderFrameHostImpl* render_frame_host); 250 void DidNavigateFrame(RenderFrameHostImpl* render_frame_host);
243 251
244 // Called when a renderer sets its opener to null. 252 // Called when a renderer sets its opener to null.
245 void DidDisownOpener(RenderViewHost* render_view_host); 253 void DidDisownOpener(RenderViewHost* render_view_host);
246 254
247 // Helper method to create and initialize a RenderFrameHost. If |swapped_out| 255 // Helper method to create and initialize a RenderFrameHost. If |swapped_out|
248 // is true, it will be initially placed on the swapped out hosts list. 256 // is true, it will be initially placed on the swapped out hosts list.
257 // Else if |is_speculative| is true, then it will used as a speculatively
258 // spawned renderer in the PlzNavigate navigation refactoring project.
249 // Otherwise, it will be used for a pending cross-site navigation. 259 // Otherwise, it will be used for a pending cross-site navigation.
250 // Returns the routing id of the *view* associated with the frame. 260 // Returns the routing id of the *view* associated with the frame.
251 int CreateRenderFrame(SiteInstance* instance, 261 int CreateRenderFrame(SiteInstance* instance,
252 int opener_route_id, 262 int opener_route_id,
253 bool swapped_out, 263 bool swapped_out,
254 bool hidden); 264 bool hidden,
265 bool is_speculative);
255 266
256 // Sets the passed passed interstitial as the currently showing interstitial. 267 // Sets the passed passed interstitial as the currently showing interstitial.
257 // |interstitial_page| should be non NULL (use the remove_interstitial_page 268 // |interstitial_page| should be non NULL (use the remove_interstitial_page
258 // method to unset the interstitial) and no interstitial page should be set 269 // method to unset the interstitial) and no interstitial page should be set
259 // when there is already a non NULL interstitial page set. 270 // when there is already a non NULL interstitial page set.
260 void set_interstitial_page(InterstitialPageImpl* interstitial_page) { 271 void set_interstitial_page(InterstitialPageImpl* interstitial_page) {
261 DCHECK(!interstitial_page_ && interstitial_page); 272 DCHECK(!interstitial_page_ && interstitial_page);
262 interstitial_page_ = interstitial_page; 273 interstitial_page_ = interstitial_page;
263 } 274 }
264 275
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 // with the given |proxy_routing_id|, which is used to route IPC messages when 417 // with the given |proxy_routing_id|, which is used to route IPC messages when
407 // in swapped out state. Returns early if the RenderViewHost has already been 418 // in swapped out state. Returns early if the RenderViewHost has already been
408 // initialized for another RenderFrameHost. 419 // initialized for another RenderFrameHost.
409 // TODO(creis): opener_route_id is currently for the RenderViewHost but should 420 // TODO(creis): opener_route_id is currently for the RenderViewHost but should
410 // be for the RenderFrame, since frames can have openers. 421 // be for the RenderFrame, since frames can have openers.
411 bool InitRenderView(RenderViewHost* render_view_host, 422 bool InitRenderView(RenderViewHost* render_view_host,
412 int opener_route_id, 423 int opener_route_id,
413 int proxy_routing_id, 424 int proxy_routing_id,
414 bool for_main_frame); 425 bool for_main_frame);
415 426
427 // Initializes |dest_render_frame_host| and |render_frame_host_| if necessary
428 // before navigating.
429 bool InitRFHsBeforeNavigation(RenderFrameHostImpl* dest_render_frame_host);
ppi 2014/07/16 14:28:09 nit: if no other method here is named similarily,
clamy 2014/07/16 15:44:53 Done.
430
431 // Returns the SiteInstance to use for the navigation.
432 SiteInstance* GetSiteInstanceForNavigation(const NavigationEntryImpl& entry);
433
416 // Sets the pending RenderFrameHost/WebUI to be the active one. Note that this 434 // Sets the pending RenderFrameHost/WebUI to be the active one. Note that this
417 // doesn't require the pending render_frame_host_ pointer to be non-NULL, 435 // doesn't require the pending render_frame_host_ pointer to be non-NULL,
418 // since there could be Web UI switching as well. Call this for every commit. 436 // since there could be Web UI switching as well. Call this for every commit.
419 void CommitPending(); 437 void CommitPending();
420 438
421 // Shutdown all RenderFrameHosts in a SiteInstance. This is called to shutdown 439 // Shutdown all RenderFrameHosts in a SiteInstance. This is called to shutdown
422 // frames when all the frames in a SiteInstance are confirmed to be swapped 440 // frames when all the frames in a SiteInstance are confirmed to be swapped
423 // out. 441 // out.
424 void ShutdownRenderFrameHostsInSiteInstance(int32 site_instance_id); 442 void ShutdownRenderFrameHostsInSiteInstance(int32 site_instance_id);
425 443
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 // associated with the navigation. 493 // associated with the navigation.
476 scoped_ptr<RenderFrameHostImpl> pending_render_frame_host_; 494 scoped_ptr<RenderFrameHostImpl> pending_render_frame_host_;
477 495
478 // Tracks information about any current pending cross-process navigation. 496 // Tracks information about any current pending cross-process navigation.
479 scoped_ptr<PendingNavigationParams> pending_nav_params_; 497 scoped_ptr<PendingNavigationParams> pending_nav_params_;
480 498
481 // Tracks information about any navigation paused after receiving response 499 // Tracks information about any navigation paused after receiving response
482 // headers. 500 // headers.
483 scoped_ptr<GlobalRequestID> response_started_id_; 501 scoped_ptr<GlobalRequestID> response_started_id_;
484 502
503 // A RenderFrameHost speculatively created when receiving a navigation
504 // request. It should be used or deleted when the current navigation request
505 // commits. This is part of the PlzNavigate navigation refactoring project.
506 scoped_ptr<RenderFrameHostImpl> speculative_render_frame_host_;
507
485 // If either of these is non-NULL, the pending navigation is to a chrome: 508 // If either of these is non-NULL, the pending navigation is to a chrome:
486 // page. The scoped_ptr is used if pending_web_ui_ != web_ui_, the WeakPtr is 509 // page. The scoped_ptr is used if pending_web_ui_ != web_ui_, the WeakPtr is
487 // used for when they reference the same object. If either is non-NULL, the 510 // used for when they reference the same object. If either is non-NULL, the
488 // other should be NULL. 511 // other should be NULL.
489 scoped_ptr<WebUIImpl> pending_web_ui_; 512 scoped_ptr<WebUIImpl> pending_web_ui_;
490 base::WeakPtr<WebUIImpl> pending_and_current_web_ui_; 513 base::WeakPtr<WebUIImpl> pending_and_current_web_ui_;
491 514
492 // A map of site instance ID to RenderFrameProxyHosts. 515 // A map of site instance ID to RenderFrameProxyHosts.
493 typedef base::hash_map<int32, RenderFrameProxyHost*> RenderFrameProxyHostMap; 516 typedef base::hash_map<int32, RenderFrameProxyHost*> RenderFrameProxyHostMap;
494 RenderFrameProxyHostMap proxy_hosts_; 517 RenderFrameProxyHostMap proxy_hosts_;
(...skipping 13 matching lines...) Expand all
508 scoped_ptr<NavigationRequest> navigation_request_; 531 scoped_ptr<NavigationRequest> navigation_request_;
509 532
510 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; 533 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_;
511 534
512 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); 535 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager);
513 }; 536 };
514 537
515 } // namespace content 538 } // namespace content
516 539
517 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ 540 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698