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

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

Issue 217163007: Introduce RenderFrameProxyHost object and use it in RFHM. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another round of fixes. Created 6 years, 8 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
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 12 matching lines...) Expand all
23 class CrossProcessFrameConnector; 23 class CrossProcessFrameConnector;
24 class CrossSiteTransferringRequest; 24 class CrossSiteTransferringRequest;
25 class InterstitialPageImpl; 25 class InterstitialPageImpl;
26 class FrameTreeNode; 26 class FrameTreeNode;
27 class NavigationControllerImpl; 27 class NavigationControllerImpl;
28 class NavigationEntry; 28 class NavigationEntry;
29 class NavigationEntryImpl; 29 class NavigationEntryImpl;
30 class RenderFrameHostDelegate; 30 class RenderFrameHostDelegate;
31 class RenderFrameHostImpl; 31 class RenderFrameHostImpl;
32 class RenderFrameHostManagerTest; 32 class RenderFrameHostManagerTest;
33 class RenderFrameProxyHost;
33 class RenderViewHost; 34 class RenderViewHost;
34 class RenderViewHostImpl; 35 class RenderViewHostImpl;
35 class RenderWidgetHostDelegate; 36 class RenderWidgetHostDelegate;
36 class RenderWidgetHostView; 37 class RenderWidgetHostView;
37 class TestWebContents; 38 class TestWebContents;
38 class WebUIImpl; 39 class WebUIImpl;
39 40
40 // Manages RenderFrameHosts for a FrameTreeNode. This class acts as a state 41 // Manages RenderFrameHosts for a FrameTreeNode. This class acts as a state
41 // machine to make cross-process navigations in a frame possible. 42 // machine to make cross-process navigations in a frame possible.
42 class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver { 43 class CONTENT_EXPORT RenderFrameHostManager : public NotificationObserver {
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 262
262 // Called when a RenderViewHost is about to be deleted. 263 // Called when a RenderViewHost is about to be deleted.
263 void RenderViewDeleted(RenderViewHost* rvh); 264 void RenderViewDeleted(RenderViewHost* rvh);
264 265
265 // Returns whether the given RenderFrameHost (or its associated 266 // Returns whether the given RenderFrameHost (or its associated
266 // RenderViewHost) is on the list of swapped out RenderFrameHosts. 267 // RenderViewHost) is on the list of swapped out RenderFrameHosts.
267 bool IsRVHOnSwappedOutList(RenderViewHostImpl* rvh) const; 268 bool IsRVHOnSwappedOutList(RenderViewHostImpl* rvh) const;
268 bool IsOnSwappedOutList(RenderFrameHostImpl* rfh) const; 269 bool IsOnSwappedOutList(RenderFrameHostImpl* rfh) const;
269 270
270 // Returns the swapped out RenderViewHost or RenderFrameHost for the given 271 // Returns the swapped out RenderViewHost or RenderFrameHost for the given
271 // SiteInstance, if any. 272 // SiteInstance, if any. This method is *deprecated* and
273 // GetRenderFrameProxyHost should be used.
272 RenderViewHostImpl* GetSwappedOutRenderViewHost(SiteInstance* instance) const; 274 RenderViewHostImpl* GetSwappedOutRenderViewHost(SiteInstance* instance) const;
273 RenderFrameHostImpl* GetSwappedOutRenderFrameHost( 275 RenderFrameProxyHost* GetRenderFrameProxyHost(
274 SiteInstance* instance) const; 276 SiteInstance* instance) const;
275 277
276 // Runs the unload handler in the current page, when we know that a pending 278 // Runs the unload handler in the current page, when we know that a pending
277 // cross-process navigation is going to commit. We may initiate a transfer 279 // cross-process navigation is going to commit. We may initiate a transfer
278 // to a new process after this completes or times out. 280 // to a new process after this completes or times out.
279 void SwapOutOldPage(); 281 void SwapOutOldPage();
280 282
281 // Deletes a RenderFrameHost that was pending shutdown. 283 // Deletes a RenderFrameHost that was pending shutdown.
282 void ClearPendingShutdownRFHForSiteInstance(int32 site_instance_id, 284 void ClearPendingShutdownRFHForSiteInstance(int32 site_instance_id,
283 RenderFrameHostImpl* rfh); 285 RenderFrameHostImpl* rfh);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 // This is the transition type for the original navigation. 326 // This is the transition type for the original navigation.
325 PageTransition page_transition; 327 PageTransition page_transition;
326 328
327 // This is the frame routing ID to use in RequestTransferURL. 329 // This is the frame routing ID to use in RequestTransferURL.
328 int render_frame_id; 330 int render_frame_id;
329 331
330 // This is whether the navigation should replace the current history entry. 332 // This is whether the navigation should replace the current history entry.
331 bool should_replace_current_entry; 333 bool should_replace_current_entry;
332 }; 334 };
333 335
334 // Used with FrameTree::ForEach to erase inactive RenderFrameHosts from a 336 // Used with FrameTree::ForEach to erase RenderFrameProxyHosts from a
335 // FrameTreeNode's RenderFrameHostManager. 337 // FrameTreeNode's RenderFrameHostManager.
336 static bool ClearSwappedOutRFHsInSiteInstance(int32 site_instance_id, 338 static bool ClearProxiesInSiteInstance(int32 site_instance_id,
337 FrameTreeNode* node); 339 FrameTreeNode* node);
338 340
339 // Returns whether this tab should transition to a new renderer for 341 // Returns whether this tab should transition to a new renderer for
340 // cross-site URLs. Enabled unless we see the --process-per-tab command line 342 // cross-site URLs. Enabled unless we see the --process-per-tab command line
341 // switch. Can be overridden in unit tests. 343 // switch. Can be overridden in unit tests.
342 bool ShouldTransitionCrossSite(); 344 bool ShouldTransitionCrossSite();
343 345
344 // Returns true if for the navigation from |current_entry| to |new_entry|, 346 // Returns true if for the navigation from |current_entry| to |new_entry|,
345 // a new SiteInstance and BrowsingInstance should be created (even if we are 347 // a new SiteInstance and BrowsingInstance should be created (even if we are
346 // in a process model that doesn't usually swap). This forces a process swap 348 // in a process model that doesn't usually swap). This forces a process swap
347 // and severs script connections with existing tabs. Cases where this can 349 // and severs script connections with existing tabs. Cases where this can
(...skipping 12 matching lines...) Expand all
360 // Returns an appropriate SiteInstance object for the given NavigationEntry, 362 // Returns an appropriate SiteInstance object for the given NavigationEntry,
361 // possibly reusing the current SiteInstance. If --process-per-tab is used, 363 // possibly reusing the current SiteInstance. If --process-per-tab is used,
362 // this is only called when ShouldSwapBrowsingInstancesForNavigation returns 364 // this is only called when ShouldSwapBrowsingInstancesForNavigation returns
363 // true. 365 // true.
364 SiteInstance* GetSiteInstanceForEntry( 366 SiteInstance* GetSiteInstanceForEntry(
365 const NavigationEntryImpl& entry, 367 const NavigationEntryImpl& entry,
366 SiteInstance* current_instance, 368 SiteInstance* current_instance,
367 bool force_browsing_instance_swap); 369 bool force_browsing_instance_swap);
368 370
369 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary. 371 // Creates a RenderFrameHost and corresponding RenderViewHost if necessary.
370 RenderFrameHostImpl* CreateRenderFrameHost(SiteInstance* instance, 372 scoped_ptr<RenderFrameHostImpl> CreateRenderFrameHost(SiteInstance* instance,
371 int view_routing_id, 373 int view_routing_id,
372 int frame_routing_id, 374 int frame_routing_id,
373 bool swapped_out, 375 bool swapped_out,
374 bool hidden); 376 bool hidden);
375 377
376 // Sets up the necessary state for a new RenderViewHost with the given opener, 378 // Sets up the necessary state for a new RenderViewHost with the given opener,
377 // if necessary. Returns early if the RenderViewHost has already been 379 // if necessary. Returns early if the RenderViewHost has already been
378 // initialized for another RenderFrameHost. 380 // initialized for another RenderFrameHost.
379 // TODO(creis): opener_route_id is currently for the RenderViewHost but should 381 // TODO(creis): opener_route_id is currently for the RenderViewHost but should
380 // be for the RenderFrame, since frames can have openers. 382 // be for the RenderFrame, since frames can have openers.
381 bool InitRenderView(RenderViewHost* render_view_host, int opener_route_id); 383 bool InitRenderView(RenderViewHost* render_view_host, int opener_route_id);
382 384
383 // Sets the pending RenderFrameHost/WebUI to be the active one. Note that this 385 // Sets the pending RenderFrameHost/WebUI to be the active one. Note that this
384 // doesn't require the pending render_frame_host_ pointer to be non-NULL, 386 // doesn't require the pending render_frame_host_ pointer to be non-NULL,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 // Tracks information about any current pending cross-process navigation. 442 // Tracks information about any current pending cross-process navigation.
441 scoped_ptr<PendingNavigationParams> pending_nav_params_; 443 scoped_ptr<PendingNavigationParams> pending_nav_params_;
442 444
443 // If either of these is non-NULL, the pending navigation is to a chrome: 445 // If either of these is non-NULL, the pending navigation is to a chrome:
444 // page. The scoped_ptr is used if pending_web_ui_ != web_ui_, the WeakPtr is 446 // page. The scoped_ptr is used if pending_web_ui_ != web_ui_, the WeakPtr is
445 // used for when they reference the same object. If either is non-NULL, the 447 // used for when they reference the same object. If either is non-NULL, the
446 // other should be NULL. 448 // other should be NULL.
447 scoped_ptr<WebUIImpl> pending_web_ui_; 449 scoped_ptr<WebUIImpl> pending_web_ui_;
448 base::WeakPtr<WebUIImpl> pending_and_current_web_ui_; 450 base::WeakPtr<WebUIImpl> pending_and_current_web_ui_;
449 451
450 // A map of site instance ID to swapped out RenderFrameHosts. This may 452 // A map of site instance ID to RenderFrameProxyHosts.
451 // include pending_render_frame_host_ for navigations to existing entries. 453 typedef base::hash_map<int32, RenderFrameProxyHost*> RenderFrameProxyHostMap;
452 typedef base::hash_map<int32, RenderFrameHostImpl*> RenderFrameHostMap; 454 RenderFrameProxyHostMap proxy_hosts_;
453 RenderFrameHostMap swapped_out_hosts_;
454 455
455 // A map of RenderFrameHosts pending shutdown. 456 // A map of RenderFrameHosts pending shutdown.
456 typedef base::hash_map<int32, linked_ptr<RenderFrameHostImpl> > 457 typedef base::hash_map<int32, linked_ptr<RenderFrameHostImpl> >
457 RFHPendingDeleteMap; 458 RFHPendingDeleteMap;
458 RFHPendingDeleteMap pending_delete_hosts_; 459 RFHPendingDeleteMap pending_delete_hosts_;
459 460
460 // The intersitial page currently shown if any, not own by this class 461 // The intersitial page currently shown if any, not own by this class
461 // (the InterstitialPage is self-owned, it deletes itself when hidden). 462 // (the InterstitialPage is self-owned, it deletes itself when hidden).
462 InterstitialPageImpl* interstitial_page_; 463 InterstitialPageImpl* interstitial_page_;
463 464
464 NotificationRegistrar registrar_; 465 NotificationRegistrar registrar_;
465 466
466 // When |render_frame_host_| is in a different process from its parent in 467 // When |render_frame_host_| is in a different process from its parent in
467 // the frame tree, this class connects its associated RenderWidgetHostView 468 // the frame tree, this class connects its associated RenderWidgetHostView
468 // to the proxy RenderFrameHost for the parent's renderer process. NULL 469 // to the proxy RenderFrameHost for the parent's renderer process. NULL
469 // when |render_frame_host_| is the frame tree root or is in the same 470 // when |render_frame_host_| is the frame tree root or is in the same
470 // process as its parent. 471 // process as its parent.
471 CrossProcessFrameConnector* cross_process_frame_connector_; 472 CrossProcessFrameConnector* cross_process_frame_connector_;
472 473
473 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; 474 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_;
474 475
475 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); 476 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager);
476 }; 477 };
477 478
478 } // namespace content 479 } // namespace content
479 480
480 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ 481 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698