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

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

Issue 404613005: Start using RenderFrameProxyHost objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bug fix + ncarter review comments addressed 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 | Annotate | Revision Log
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"
(...skipping 13 matching lines...) Expand all
24 class CrossProcessFrameConnector; 24 class CrossProcessFrameConnector;
25 class CrossSiteTransferringRequest; 25 class CrossSiteTransferringRequest;
26 class InterstitialPageImpl; 26 class InterstitialPageImpl;
27 class FrameTreeNode; 27 class FrameTreeNode;
28 class NavigationControllerImpl; 28 class NavigationControllerImpl;
29 class NavigationEntry; 29 class NavigationEntry;
30 class NavigationEntryImpl; 30 class NavigationEntryImpl;
31 class NavigationRequest; 31 class NavigationRequest;
32 class RenderFrameHost; 32 class RenderFrameHost;
33 class RenderFrameHostDelegate; 33 class RenderFrameHostDelegate;
34 class RenderFrameHost;
34 class RenderFrameHostImpl; 35 class RenderFrameHostImpl;
35 class RenderFrameHostManagerTest; 36 class RenderFrameHostManagerTest;
36 class RenderFrameProxyHost; 37 class RenderFrameProxyHost;
37 class RenderViewHost; 38 class RenderViewHost;
38 class RenderViewHostImpl; 39 class RenderViewHostImpl;
39 class RenderWidgetHostDelegate; 40 class RenderWidgetHostDelegate;
40 class RenderWidgetHostView; 41 class RenderWidgetHostView;
41 class TestWebContents; 42 class TestWebContents;
42 class WebUIImpl; 43 class WebUIImpl;
43 44
(...skipping 17 matching lines...) Expand all
61 // process is not shared, then the WebContentsImpl will act as though the 62 // process is not shared, then the WebContentsImpl will act as though the
62 // renderer is not running (i.e., it will render "sad tab"). This method is 63 // renderer is not running (i.e., it will render "sad tab"). This method is
63 // automatically called from LoadURL. |for_main_frame| indicates whether 64 // automatically called from LoadURL. |for_main_frame| indicates whether
64 // this RenderViewHost is used to render a top-level frame, so the 65 // this RenderViewHost is used to render a top-level frame, so the
65 // appropriate RenderWidgetHostView type is used. 66 // appropriate RenderWidgetHostView type is used.
66 virtual bool CreateRenderViewForRenderManager( 67 virtual bool CreateRenderViewForRenderManager(
67 RenderViewHost* render_view_host, 68 RenderViewHost* render_view_host,
68 int opener_route_id, 69 int opener_route_id,
69 int proxy_routing_id, 70 int proxy_routing_id,
70 bool for_main_frame) = 0; 71 bool for_main_frame) = 0;
72 virtual bool CreateRenderFrameForRenderManager(
73 RenderFrameHost* render_frame_host,
74 int parent_routing_id) = 0;
71 virtual void BeforeUnloadFiredFromRenderManager( 75 virtual void BeforeUnloadFiredFromRenderManager(
72 bool proceed, const base::TimeTicks& proceed_time, 76 bool proceed, const base::TimeTicks& proceed_time,
73 bool* proceed_to_fire_unload) = 0; 77 bool* proceed_to_fire_unload) = 0;
74 virtual void RenderProcessGoneFromRenderManager( 78 virtual void RenderProcessGoneFromRenderManager(
75 RenderViewHost* render_view_host) = 0; 79 RenderViewHost* render_view_host) = 0;
76 virtual void UpdateRenderViewSizeForRenderManager() = 0; 80 virtual void UpdateRenderViewSizeForRenderManager() = 0;
77 virtual void CancelModalDialogsForRenderManager() = 0; 81 virtual void CancelModalDialogsForRenderManager() = 0;
78 virtual void NotifySwappedFromRenderManager(RenderFrameHost* old_host, 82 virtual void NotifySwappedFromRenderManager(RenderFrameHost* old_host,
79 RenderFrameHost* new_host, 83 RenderFrameHost* new_host,
80 bool is_main_frame) = 0; 84 bool is_main_frame) = 0;
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // Called when a renderer sets its opener to null. 248 // Called when a renderer sets its opener to null.
245 void DidDisownOpener(RenderViewHost* render_view_host); 249 void DidDisownOpener(RenderViewHost* render_view_host);
246 250
247 // Helper method to create and initialize a RenderFrameHost. If |swapped_out| 251 // 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. 252 // is true, it will be initially placed on the swapped out hosts list.
249 // Otherwise, it will be used for a pending cross-site navigation. 253 // Otherwise, it will be used for a pending cross-site navigation.
250 // Returns the routing id of the *view* associated with the frame. 254 // Returns the routing id of the *view* associated with the frame.
251 int CreateRenderFrame(SiteInstance* instance, 255 int CreateRenderFrame(SiteInstance* instance,
252 int opener_route_id, 256 int opener_route_id,
253 bool swapped_out, 257 bool swapped_out,
258 bool for_main_frame,
254 bool hidden); 259 bool hidden);
255 260
261 // Helper method to create and initialize a RenderFrameProxyHost.
Charlie Reis 2014/07/24 22:36:30 Please say what this returns.
kenrb 2014/07/25 23:42:05 Done.
262 int CreateRenderFrameProxy(SiteInstance* instance);
263
256 // Sets the passed passed interstitial as the currently showing interstitial. 264 // Sets the passed passed interstitial as the currently showing interstitial.
257 // |interstitial_page| should be non NULL (use the remove_interstitial_page 265 // |interstitial_page| should be non NULL (use the remove_interstitial_page
258 // method to unset the interstitial) and no interstitial page should be set 266 // method to unset the interstitial) and no interstitial page should be set
259 // when there is already a non NULL interstitial page set. 267 // when there is already a non NULL interstitial page set.
260 void set_interstitial_page(InterstitialPageImpl* interstitial_page) { 268 void set_interstitial_page(InterstitialPageImpl* interstitial_page) {
261 DCHECK(!interstitial_page_ && interstitial_page); 269 DCHECK(!interstitial_page_ && interstitial_page);
262 interstitial_page_ = interstitial_page; 270 interstitial_page_ = interstitial_page;
263 } 271 }
264 272
265 // Unsets the currently showing interstitial. 273 // Unsets the currently showing interstitial.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 void ClearPendingShutdownRFHForSiteInstance(int32 site_instance_id, 306 void ClearPendingShutdownRFHForSiteInstance(int32 site_instance_id,
299 RenderFrameHostImpl* rfh); 307 RenderFrameHostImpl* rfh);
300 308
301 // Deletes any proxy hosts associated with this node. Used during destruction 309 // Deletes any proxy hosts associated with this node. Used during destruction
302 // of WebContentsImpl. 310 // of WebContentsImpl.
303 void ResetProxyHosts(); 311 void ResetProxyHosts();
304 312
305 // Used to start a navigation, part of browser-side navigation project. 313 // Used to start a navigation, part of browser-side navigation project.
306 void OnBeginNavigation(const FrameHostMsg_BeginNavigation_Params& params); 314 void OnBeginNavigation(const FrameHostMsg_BeginNavigation_Params& params);
307 315
316 int GetRoutingIdForSiteInstance(SiteInstance* site_instance);
Charlie Reis 2014/07/24 22:36:30 This name is confusing, since routing IDs are used
nasko 2014/07/25 07:13:20 It is scoped to RFHM and is supposed to return the
kenrb 2014/07/25 23:42:05 I have added a comment but left the name the same.
Charlie Reis 2014/07/28 19:24:28 Acknowledged.
317
308 private: 318 private:
309 friend class RenderFrameHostManagerTest; 319 friend class RenderFrameHostManagerTest;
310 friend class TestWebContents; 320 friend class TestWebContents;
311 321
322 FRIEND_TEST_ALL_PREFIXES(CrossProcessFrameTreeBrowserTest,
323 VerifyProxyCreation);
324
312 // Tracks information about a navigation while a cross-process transition is 325 // Tracks information about a navigation while a cross-process transition is
313 // in progress, in case we need to transfer it to a new RenderFrameHost. 326 // in progress, in case we need to transfer it to a new RenderFrameHost.
314 // When a request is being transferred, deleting the PendingNavigationParams, 327 // When a request is being transferred, deleting the PendingNavigationParams,
315 // and thus |cross_site_transferring_request|, will cancel the request being 328 // and thus |cross_site_transferring_request|, will cancel the request being
316 // transferred, unless its ReleaseRequest method has been called. 329 // transferred, unless its ReleaseRequest method has been called.
317 struct PendingNavigationParams { 330 struct PendingNavigationParams {
318 PendingNavigationParams( 331 PendingNavigationParams(
319 const GlobalRequestID& global_request_id, 332 const GlobalRequestID& global_request_id,
320 scoped_ptr<CrossSiteTransferringRequest> 333 scoped_ptr<CrossSiteTransferringRequest>
321 cross_site_transferring_request, 334 cross_site_transferring_request,
(...skipping 84 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 419 // 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 420 // in swapped out state. Returns early if the RenderViewHost has already been
408 // initialized for another RenderFrameHost. 421 // initialized for another RenderFrameHost.
409 // TODO(creis): opener_route_id is currently for the RenderViewHost but should 422 // TODO(creis): opener_route_id is currently for the RenderViewHost but should
410 // be for the RenderFrame, since frames can have openers. 423 // be for the RenderFrame, since frames can have openers.
411 bool InitRenderView(RenderViewHost* render_view_host, 424 bool InitRenderView(RenderViewHost* render_view_host,
412 int opener_route_id, 425 int opener_route_id,
413 int proxy_routing_id, 426 int proxy_routing_id,
414 bool for_main_frame); 427 bool for_main_frame);
415 428
429 bool InitRenderFrame(RenderFrameHost* render_frame_host);
Charlie Reis 2014/07/24 22:36:30 This needs a comment. Is the behavior similar to
nasko 2014/07/25 07:13:20 Yes, it is. In general, I've made RFH/RFPH creatio
kenrb 2014/07/25 23:42:05 I have added a short comment. Let me know if you w
430
416 // Sets the pending RenderFrameHost/WebUI to be the active one. Note that this 431 // 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, 432 // 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. 433 // since there could be Web UI switching as well. Call this for every commit.
419 void CommitPending(); 434 void CommitPending();
420 435
421 // Shutdown all RenderFrameHosts in a SiteInstance. This is called to shutdown 436 // Shutdown all RenderFrameProxyHosts in a SiteInstance. This is called to
422 // frames when all the frames in a SiteInstance are confirmed to be swapped 437 // shutdown frames when all the frames in a SiteInstance are confirmed to be
423 // out. 438 // swapped out.
Charlie Reis 2014/07/24 22:36:30 Nice! We're getting closer to where we won't have
424 void ShutdownRenderFrameHostsInSiteInstance(int32 site_instance_id); 439 void ShutdownRenderFrameProxyHostsInSiteInstance(int32 site_instance_id);
425 440
426 // Helper method to terminate the pending RenderViewHost. 441 // Helper method to terminate the pending RenderViewHost.
427 void CancelPending(); 442 void CancelPending();
428 443
429 // Helper method to set the active RenderFrameHost. Returns the old 444 // Helper method to set the active RenderFrameHost. Returns the old
430 // RenderFrameHost and updates counts. 445 // RenderFrameHost and updates counts.
431 scoped_ptr<RenderFrameHostImpl> SetRenderFrameHost( 446 scoped_ptr<RenderFrameHostImpl> SetRenderFrameHost(
432 scoped_ptr<RenderFrameHostImpl> render_frame_host); 447 scoped_ptr<RenderFrameHostImpl> render_frame_host);
433 448
434 RenderFrameHostImpl* UpdateStateForNavigate( 449 RenderFrameHostImpl* UpdateStateForNavigate(
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 scoped_ptr<NavigationRequest> navigation_request_; 523 scoped_ptr<NavigationRequest> navigation_request_;
509 524
510 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; 525 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_;
511 526
512 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); 527 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager);
513 }; 528 };
514 529
515 } // namespace content 530 } // namespace content
516 531
517 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ 532 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698