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