| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 | 499 |
| 500 // SiteInstanceImpl::Observer | 500 // SiteInstanceImpl::Observer |
| 501 void ActiveFrameCountIsZero(SiteInstanceImpl* site_instance) override; | 501 void ActiveFrameCountIsZero(SiteInstanceImpl* site_instance) override; |
| 502 void RenderProcessGone(SiteInstanceImpl* site_instance) override; | 502 void RenderProcessGone(SiteInstanceImpl* site_instance) override; |
| 503 | 503 |
| 504 private: | 504 private: |
| 505 friend class NavigatorTestWithBrowserSideNavigation; | 505 friend class NavigatorTestWithBrowserSideNavigation; |
| 506 friend class RenderFrameHostManagerTest; | 506 friend class RenderFrameHostManagerTest; |
| 507 friend class TestWebContents; | 507 friend class TestWebContents; |
| 508 | 508 |
| 509 enum class SiteInstanceRelation { |
| 510 // A SiteInstance in a different browsing instance from the current. |
| 511 UNRELATED, |
| 512 // A SiteInstance in the same browsing instance as the current. |
| 513 RELATED, |
| 514 // The default subframe SiteInstance for the current browsing instance. |
| 515 RELATED_DEFAULT_SUBFRAME, |
| 516 }; |
| 517 |
| 509 // Stores information regarding a SiteInstance targeted at a specific URL to | 518 // Stores information regarding a SiteInstance targeted at a specific URL to |
| 510 // allow for comparisons without having to actually create new instances. It | 519 // allow for comparisons without having to actually create new instances. It |
| 511 // can point to an existing one or store the details needed to create a new | 520 // can point to an existing one or store the details needed to create a new |
| 512 // one. | 521 // one. |
| 513 struct CONTENT_EXPORT SiteInstanceDescriptor { | 522 struct CONTENT_EXPORT SiteInstanceDescriptor { |
| 514 explicit SiteInstanceDescriptor(content::SiteInstance* site_instance) | 523 explicit SiteInstanceDescriptor(content::SiteInstance* site_instance) |
| 515 : existing_site_instance(site_instance), | 524 : existing_site_instance(site_instance), |
| 516 new_is_related_to_current(false) {} | 525 relation(SiteInstanceRelation::UNRELATED) {} |
| 517 | 526 |
| 518 SiteInstanceDescriptor(BrowserContext* browser_context, | 527 SiteInstanceDescriptor(BrowserContext* browser_context, |
| 519 GURL dest_url, | 528 GURL dest_url, |
| 520 bool related_to_current); | 529 SiteInstanceRelation relation_to_current); |
| 521 | 530 |
| 522 // Set with an existing SiteInstance to be reused. | 531 // Set with an existing SiteInstance to be reused. |
| 523 content::SiteInstance* existing_site_instance; | 532 content::SiteInstance* existing_site_instance; |
| 524 | 533 |
| 525 // In case |existing_site_instance| is null, specify a new site URL. | 534 // In case |existing_site_instance| is null, specify a new site URL. |
| 526 GURL new_site_url; | 535 GURL new_site_url; |
| 527 | 536 |
| 528 // In case |existing_site_instance| is null, specify if the new site should | 537 // In case |existing_site_instance| is null, specify how the new site is |
| 529 // be created in a new BrowsingInstance or not. | 538 // related to the current BrowsingInstance. |
| 530 bool new_is_related_to_current; | 539 SiteInstanceRelation relation; |
| 531 }; | 540 }; |
| 532 | 541 |
| 533 // Create a RenderFrameProxyHost owned by this object. | 542 // Create a RenderFrameProxyHost owned by this object. |
| 534 RenderFrameProxyHost* CreateRenderFrameProxyHost(SiteInstance* site_instance, | 543 RenderFrameProxyHost* CreateRenderFrameProxyHost(SiteInstance* site_instance, |
| 535 RenderViewHostImpl* rvh); | 544 RenderViewHostImpl* rvh); |
| 536 // Delete a RenderFrameProxyHost owned by this object. | 545 // Delete a RenderFrameProxyHost owned by this object. |
| 537 void DeleteRenderFrameProxyHost(SiteInstance* site_instance); | 546 void DeleteRenderFrameProxyHost(SiteInstance* site_instance); |
| 538 | 547 |
| 539 // Returns whether this tab should transition to a new renderer for | 548 // Returns whether this tab should transition to a new renderer for |
| 540 // cross-site URLs. Enabled unless we see the --process-per-tab command line | 549 // cross-site URLs. Enabled unless we see the --process-per-tab command line |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 bool dest_is_restore, | 602 bool dest_is_restore, |
| 594 bool dest_is_view_source_mode, | 603 bool dest_is_view_source_mode, |
| 595 bool force_browsing_instance_swap); | 604 bool force_browsing_instance_swap); |
| 596 | 605 |
| 597 // Converts a SiteInstanceDescriptor to the actual SiteInstance it describes. | 606 // Converts a SiteInstanceDescriptor to the actual SiteInstance it describes. |
| 598 // If a |candidate_instance| is provided (is not nullptr) and it matches the | 607 // If a |candidate_instance| is provided (is not nullptr) and it matches the |
| 599 // description, it is returned as is. | 608 // description, it is returned as is. |
| 600 SiteInstance* ConvertToSiteInstance(const SiteInstanceDescriptor& descriptor, | 609 SiteInstance* ConvertToSiteInstance(const SiteInstanceDescriptor& descriptor, |
| 601 SiteInstance* candidate_instance); | 610 SiteInstance* candidate_instance); |
| 602 | 611 |
| 603 // Determines the appropriate url to use as the current url for SiteInstance | 612 // Returns true if |candidate| is currently on the same web site as dest_url. |
| 604 // selection. | 613 bool IsCurrentlySameSite(RenderFrameHostImpl* candidate, |
| 605 const GURL& GetCurrentURLForSiteInstance(SiteInstance* current_instance); | 614 const GURL& dest_url); |
| 606 | 615 |
| 607 // Creates a new RenderFrameHostImpl for the |new_instance| and assign it to | 616 // Creates a new RenderFrameHostImpl for the |new_instance| and assign it to |
| 608 // |pending_render_frame_host_| while respecting the opener route if needed | 617 // |pending_render_frame_host_| while respecting the opener route if needed |
| 609 // and stores it in pending_render_frame_host_. | 618 // and stores it in pending_render_frame_host_. |
| 610 void CreatePendingRenderFrameHost(SiteInstance* old_instance, | 619 void CreatePendingRenderFrameHost(SiteInstance* old_instance, |
| 611 SiteInstance* new_instance); | 620 SiteInstance* new_instance); |
| 612 | 621 |
| 613 // Ensure that we have created all needed proxies for a new RFH with | 622 // Ensure that we have created all needed proxies for a new RFH with |
| 614 // SiteInstance |new_instance|: (1) create swapped-out RVHs and proxies for | 623 // SiteInstance |new_instance|: (1) create swapped-out RVHs and proxies for |
| 615 // the new RFH's opener chain if we are staying in the same BrowsingInstance; | 624 // the new RFH's opener chain if we are staying in the same BrowsingInstance; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 scoped_ptr<RenderFrameHostImpl> speculative_render_frame_host_; | 790 scoped_ptr<RenderFrameHostImpl> speculative_render_frame_host_; |
| 782 | 791 |
| 783 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; | 792 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; |
| 784 | 793 |
| 785 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); | 794 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); |
| 786 }; | 795 }; |
| 787 | 796 |
| 788 } // namespace content | 797 } // namespace content |
| 789 | 798 |
| 790 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 799 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
| OLD | NEW |