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

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

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

Powered by Google App Engine
This is Rietveld 408576698