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