OLD | NEW |
---|---|
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> | |
9 | |
8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
12 #include "content/browser/renderer_host/render_view_host_delegate.h" | 14 #include "content/browser/renderer_host/render_view_host_delegate.h" |
13 #include "content/browser/site_instance_impl.h" | 15 #include "content/browser/site_instance_impl.h" |
14 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
15 #include "content/public/browser/global_request_id.h" | 17 #include "content/public/browser/global_request_id.h" |
16 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
296 bool IsRVHOnSwappedOutList(RenderViewHostImpl* rvh) const; | 298 bool IsRVHOnSwappedOutList(RenderViewHostImpl* rvh) const; |
297 bool IsOnSwappedOutList(RenderFrameHostImpl* rfh) const; | 299 bool IsOnSwappedOutList(RenderFrameHostImpl* rfh) const; |
298 | 300 |
299 // Returns the swapped out RenderViewHost or RenderFrameHost for the given | 301 // Returns the swapped out RenderViewHost or RenderFrameHost for the given |
300 // SiteInstance, if any. This method is *deprecated* and | 302 // SiteInstance, if any. This method is *deprecated* and |
301 // GetRenderFrameProxyHost should be used. | 303 // GetRenderFrameProxyHost should be used. |
302 RenderViewHostImpl* GetSwappedOutRenderViewHost(SiteInstance* instance) const; | 304 RenderViewHostImpl* GetSwappedOutRenderViewHost(SiteInstance* instance) const; |
303 RenderFrameProxyHost* GetRenderFrameProxyHost( | 305 RenderFrameProxyHost* GetRenderFrameProxyHost( |
304 SiteInstance* instance) const; | 306 SiteInstance* instance) const; |
305 | 307 |
306 // Deletes a RenderFrameHost that was pending shutdown. | 308 // Returns whether |render_frame_host| is on the pending deletion list. |
307 void ClearPendingShutdownRFHForSiteInstance(int32 site_instance_id, | 309 bool IsPendingDeletion(RenderFrameHostImpl* render_frame_host); |
308 RenderFrameHostImpl* rfh); | 310 |
311 // If |render_frame_host| is on the pending deletion list, this deletes it. | |
312 // Returns whether it was deleted. | |
313 bool DeleteFromPendingList(RenderFrameHostImpl* render_frame_host); | |
309 | 314 |
310 // Deletes any proxy hosts associated with this node. Used during destruction | 315 // Deletes any proxy hosts associated with this node. Used during destruction |
311 // of WebContentsImpl. | 316 // of WebContentsImpl. |
312 void ResetProxyHosts(); | 317 void ResetProxyHosts(); |
313 | 318 |
314 // Returns the routing id for a RenderFrameHost or RenderFrameHostProxy | 319 // Returns the routing id for a RenderFrameHost or RenderFrameHostProxy |
315 // that has the given SiteInstance and is associated with this | 320 // that has the given SiteInstance and is associated with this |
316 // RenderFrameHostManager. Returns MSG_ROUTING_NONE if none is found. | 321 // RenderFrameHostManager. Returns MSG_ROUTING_NONE if none is found. |
317 int GetRoutingIdForSiteInstance(SiteInstance* site_instance); | 322 int GetRoutingIdForSiteInstance(SiteInstance* site_instance); |
318 | 323 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 | 438 |
434 // Initialization for RenderFrameHost uses the same sequence as InitRenderView | 439 // Initialization for RenderFrameHost uses the same sequence as InitRenderView |
435 // above. | 440 // above. |
436 bool InitRenderFrame(RenderFrameHostImpl* render_frame_host); | 441 bool InitRenderFrame(RenderFrameHostImpl* render_frame_host); |
437 | 442 |
438 // Sets the pending RenderFrameHost/WebUI to be the active one. Note that this | 443 // Sets the pending RenderFrameHost/WebUI to be the active one. Note that this |
439 // doesn't require the pending render_frame_host_ pointer to be non-NULL, | 444 // doesn't require the pending render_frame_host_ pointer to be non-NULL, |
440 // since there could be Web UI switching as well. Call this for every commit. | 445 // since there could be Web UI switching as well. Call this for every commit. |
441 void CommitPending(); | 446 void CommitPending(); |
442 | 447 |
443 // Runs the unload handler in the current page, after the new page has | 448 // Runs the unload handler in the old RenderFrameHost, after the new |
444 // committed. | 449 // RenderFrameHost has committed. |old_render_frame_host| will either be |
445 void SwapOutOldPage(RenderFrameHostImpl* old_render_frame_host); | 450 // deleted or on the pending delete list after this call. |
nasko
2014/10/02 16:04:02
nit: s/deleted or on/deleted or put on/?
Charlie Reis
2014/10/02 19:41:19
Done. Also s/after/during/.
| |
451 void SwapOutOldFrame(scoped_ptr<RenderFrameHostImpl> old_render_frame_host); | |
452 | |
453 // Holds |render_frame_host| until it can be deleted when its swap out ACK | |
454 // arrives. | |
455 void MoveToPendingDeleteHosts( | |
456 scoped_ptr<RenderFrameHostImpl> render_frame_host); | |
446 | 457 |
447 // Shutdown all RenderFrameProxyHosts in a SiteInstance. This is called to | 458 // Shutdown all RenderFrameProxyHosts in a SiteInstance. This is called to |
448 // shutdown frames when all the frames in a SiteInstance are confirmed to be | 459 // shutdown frames when all the frames in a SiteInstance are confirmed to be |
449 // swapped out. | 460 // swapped out. |
450 void ShutdownRenderFrameProxyHostsInSiteInstance(int32 site_instance_id); | 461 void ShutdownRenderFrameProxyHostsInSiteInstance(int32 site_instance_id); |
451 | 462 |
452 // Helper method to terminate the pending RenderViewHost. | 463 // Helper method to terminate the pending RenderViewHost. |
453 void CancelPending(); | 464 void CancelPending(); |
454 | 465 |
455 // Helper method to set the active RenderFrameHost. Returns the old | 466 // Helper method to set the active RenderFrameHost. Returns the old |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
518 // page. The scoped_ptr is used if pending_web_ui_ != web_ui_, the WeakPtr is | 529 // page. The scoped_ptr is used if pending_web_ui_ != web_ui_, the WeakPtr is |
519 // used for when they reference the same object. If either is non-NULL, the | 530 // used for when they reference the same object. If either is non-NULL, the |
520 // other should be NULL. | 531 // other should be NULL. |
521 scoped_ptr<WebUIImpl> pending_web_ui_; | 532 scoped_ptr<WebUIImpl> pending_web_ui_; |
522 base::WeakPtr<WebUIImpl> pending_and_current_web_ui_; | 533 base::WeakPtr<WebUIImpl> pending_and_current_web_ui_; |
523 | 534 |
524 // A map of site instance ID to RenderFrameProxyHosts. | 535 // A map of site instance ID to RenderFrameProxyHosts. |
525 typedef base::hash_map<int32, RenderFrameProxyHost*> RenderFrameProxyHostMap; | 536 typedef base::hash_map<int32, RenderFrameProxyHost*> RenderFrameProxyHostMap; |
526 RenderFrameProxyHostMap proxy_hosts_; | 537 RenderFrameProxyHostMap proxy_hosts_; |
527 | 538 |
528 // A map of RenderFrameHosts pending shutdown. | 539 // A list of RenderFrameHosts waiting to shut down after swapping out. We use |
529 typedef base::hash_map<int32, linked_ptr<RenderFrameHostImpl> > | 540 // a linked list since we expect frequent deletes and no indexed access, and |
530 RFHPendingDeleteMap; | 541 // because sets don't appear to support linked_ptrs. |
531 RFHPendingDeleteMap pending_delete_hosts_; | 542 typedef std::list<linked_ptr<RenderFrameHostImpl> > RFHPendingDeleteList; |
543 RFHPendingDeleteList pending_delete_hosts_; | |
nasko
2014/10/02 16:04:02
Why not use ScopedPtrVector? It supports exactly t
Charlie Reis
2014/10/02 19:41:19
It's a good thought, but I don't think it helps in
| |
532 | 544 |
533 // The intersitial page currently shown if any, not own by this class | 545 // The intersitial page currently shown if any, not own by this class |
534 // (the InterstitialPage is self-owned, it deletes itself when hidden). | 546 // (the InterstitialPage is self-owned, it deletes itself when hidden). |
535 InterstitialPageImpl* interstitial_page_; | 547 InterstitialPageImpl* interstitial_page_; |
536 | 548 |
537 NotificationRegistrar registrar_; | 549 NotificationRegistrar registrar_; |
538 | 550 |
539 // PlzNavigate: Owns a navigation request that originated in that frame until | 551 // PlzNavigate: Owns a navigation request that originated in that frame until |
540 // it commits. | 552 // it commits. |
541 scoped_ptr<NavigationRequest> navigation_request_; | 553 scoped_ptr<NavigationRequest> navigation_request_; |
542 | 554 |
543 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; | 555 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; |
544 | 556 |
545 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); | 557 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); |
546 }; | 558 }; |
547 | 559 |
548 } // namespace content | 560 } // namespace content |
549 | 561 |
550 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 562 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
OLD | NEW |