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> | 8 #include <list> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
416 SiteInstance* instance); | 416 SiteInstance* instance); |
417 | 417 |
418 private: | 418 private: |
419 friend class NavigatorTestWithBrowserSideNavigation; | 419 friend class NavigatorTestWithBrowserSideNavigation; |
420 friend class RenderFrameHostManagerTest; | 420 friend class RenderFrameHostManagerTest; |
421 friend class TestWebContents; | 421 friend class TestWebContents; |
422 | 422 |
423 FRIEND_TEST_ALL_PREFIXES(CrossProcessFrameTreeBrowserTest, | 423 FRIEND_TEST_ALL_PREFIXES(CrossProcessFrameTreeBrowserTest, |
424 CreateCrossProcessSubframeProxies); | 424 CreateCrossProcessSubframeProxies); |
425 | 425 |
426 // PlzNavigate | |
427 enum RenderFrameHostToUse { | |
428 INVALID, | |
429 REUSE_CURRENT, | |
430 NEW_SPECULATIVE, | |
431 REUSE_SPECULATIVE, | |
432 }; | |
433 | |
434 // Stores information regarding a SiteInstance targeted at a specific URL to | |
435 // allow for comparisons without having to actually create new instances. It | |
436 // can point to an existing one or store the details needed to create a new | |
437 // one. | |
438 struct SiteInstanceDescriptor { | |
439 explicit SiteInstanceDescriptor(content::SiteInstance* site_instance) | |
440 : existing_site_instance(site_instance), | |
441 new_is_related_to_current(false) {} | |
442 | |
443 SiteInstanceDescriptor(GURL dest_url, | |
444 bool related_to_current, | |
445 BrowserContext* browser_context); | |
446 | |
447 // Set with an existing SiteInstance to be reused. | |
448 content::SiteInstance* existing_site_instance; | |
449 | |
450 // In case |existing_site_instance| is null, specify a new site URL. | |
451 GURL new_site_url; | |
452 | |
453 // In case |existing_site_instance| is null, specify if the new site should | |
454 // be created in new BrowsingInstance or not. | |
Charlie Reis
2015/03/31 20:19:58
nit: in a
carlosk
2015/04/01 15:25:30
Done.
| |
455 bool new_is_related_to_current; | |
456 }; | |
457 | |
426 // Used with FrameTree::ForEach to erase RenderFrameProxyHosts from a | 458 // Used with FrameTree::ForEach to erase RenderFrameProxyHosts from a |
427 // FrameTreeNode's RenderFrameHostManager. | 459 // FrameTreeNode's RenderFrameHostManager. |
428 static bool ClearProxiesInSiteInstance(int32 site_instance_id, | 460 static bool ClearProxiesInSiteInstance(int32 site_instance_id, |
429 FrameTreeNode* node); | 461 FrameTreeNode* node); |
430 // Used with FrameTree::ForEach to reset initialized state of | 462 // Used with FrameTree::ForEach to reset initialized state of |
431 // RenderFrameProxyHosts from a FrameTreeNode's RenderFrameHostManager. | 463 // RenderFrameProxyHosts from a FrameTreeNode's RenderFrameHostManager. |
432 static bool ResetProxiesInSiteInstance(int32 site_instance_id, | 464 static bool ResetProxiesInSiteInstance(int32 site_instance_id, |
433 FrameTreeNode* node); | 465 FrameTreeNode* node); |
434 | 466 |
435 // Returns whether this tab should transition to a new renderer for | 467 // Returns whether this tab should transition to a new renderer for |
(...skipping 28 matching lines...) Expand all Loading... | |
464 // Returns true if it is safe to reuse the current WebUI when navigating from | 496 // Returns true if it is safe to reuse the current WebUI when navigating from |
465 // |current_entry| to |new_url|. | 497 // |current_entry| to |new_url|. |
466 bool ShouldReuseWebUI( | 498 bool ShouldReuseWebUI( |
467 const NavigationEntry* current_entry, | 499 const NavigationEntry* current_entry, |
468 const GURL& new_url) const; | 500 const GURL& new_url) const; |
469 | 501 |
470 // Returns the SiteInstance to use for the navigation. | 502 // Returns the SiteInstance to use for the navigation. |
471 SiteInstance* GetSiteInstanceForNavigation(const GURL& dest_url, | 503 SiteInstance* GetSiteInstanceForNavigation(const GURL& dest_url, |
472 SiteInstance* source_instance, | 504 SiteInstance* source_instance, |
473 SiteInstance* dest_instance, | 505 SiteInstance* dest_instance, |
506 SiteInstance* candidate_instance, | |
474 ui::PageTransition transition, | 507 ui::PageTransition transition, |
475 bool dest_is_restore, | 508 bool dest_is_restore, |
476 bool dest_is_view_source_mode); | 509 bool dest_is_view_source_mode); |
477 | 510 |
478 // Returns an appropriate SiteInstance object for the given |dest_url|, | 511 // Returns a descriptor of the appropriate SiteInstance object for the given |
479 // possibly reusing the current SiteInstance. If --process-per-tab is used, | 512 // |dest_url|, possibly reusing the current, source or destination |
480 // this is only called when ShouldSwapBrowsingInstancesForNavigation returns | 513 // SiteInstance. The actual SiteInstance can then be obtained calling |
481 // true. |source_instance| is the SiteInstance of the frame that initiated the | 514 // ConvertToSiteInstance with the descriptor. |
515 // | |
516 // |source_instance| is the SiteInstance of the frame that initiated the | |
482 // navigation. |current_instance| is the SiteInstance of the frame that is | 517 // navigation. |current_instance| is the SiteInstance of the frame that is |
483 // currently navigating. |dest_instance|, is a predetermined SiteInstance | 518 // currently navigating. |dest_instance| is a predetermined SiteInstance that |
484 // that'll be used if not null. | 519 // will be used if not null. |
485 // For example, if you have a parent frame A, which has a child frame B, and | 520 // For example, if you have a parent frame A, which has a child frame B, and |
486 // A is trying to change the src attribute of B, this will cause a navigation | 521 // A is trying to change the src attribute of B, this will cause a navigation |
487 // where the source SiteInstance is A and B is the current SiteInstance. | 522 // where the source SiteInstance is A and B is the current SiteInstance. |
523 // | |
488 // This is a helper function for GetSiteInstanceForNavigation. | 524 // This is a helper function for GetSiteInstanceForNavigation. |
489 SiteInstance* GetSiteInstanceForURL(const GURL& dest_url, | 525 SiteInstanceDescriptor DetermineSiteInstanceForURL( |
490 SiteInstance* source_instance, | 526 const GURL& dest_url, |
491 SiteInstance* current_instance, | 527 SiteInstance* source_instance, |
492 SiteInstance* dest_instance, | 528 SiteInstance* current_instance, |
493 ui::PageTransition transition, | 529 SiteInstance* dest_instance, |
494 bool dest_is_restore, | 530 ui::PageTransition transition, |
495 bool dest_is_view_source_mode, | 531 bool dest_is_restore, |
496 bool force_browsing_instance_swap); | 532 bool dest_is_view_source_mode, |
533 bool force_browsing_instance_swap); | |
534 | |
535 // Converts a SiteInstanceDescriptor to the actual SiteInstance it describes. | |
536 // If a |candidate_instance| is provided (is not nullptr) and it matches the | |
537 // description, it is returned as is. | |
538 SiteInstance* ConvertToSiteInstance(const SiteInstanceDescriptor& descriptor, | |
539 SiteInstance* candidate_instance); | |
497 | 540 |
498 // Determines the appropriate url to use as the current url for SiteInstance | 541 // Determines the appropriate url to use as the current url for SiteInstance |
499 // selection. | 542 // selection. |
500 const GURL& GetCurrentURLForSiteInstance( | 543 const GURL& GetCurrentURLForSiteInstance( |
501 SiteInstance* current_instance, | 544 SiteInstance* current_instance, |
502 NavigationEntry* current_entry); | 545 NavigationEntry* current_entry); |
503 | 546 |
504 // Creates a new RenderFrameHostImpl for the |new_instance| and assign it to | 547 // Creates a new RenderFrameHostImpl for the |new_instance| and assign it to |
505 // |pending_render_frame_host_| while respecting the opener route if needed | 548 // |pending_render_frame_host_| while respecting the opener route if needed |
506 // and stores it in pending_render_frame_host_. | 549 // and stores it in pending_render_frame_host_. |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
703 bool should_reuse_web_ui_; | 746 bool should_reuse_web_ui_; |
704 | 747 |
705 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; | 748 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; |
706 | 749 |
707 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); | 750 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); |
708 }; | 751 }; |
709 | 752 |
710 } // namespace content | 753 } // namespace content |
711 | 754 |
712 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 755 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
OLD | NEW |