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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
418 SiteInstance* instance); | 418 SiteInstance* instance); |
419 | 419 |
420 private: | 420 private: |
421 friend class NavigatorTestWithBrowserSideNavigation; | 421 friend class NavigatorTestWithBrowserSideNavigation; |
422 friend class RenderFrameHostManagerTest; | 422 friend class RenderFrameHostManagerTest; |
423 friend class TestWebContents; | 423 friend class TestWebContents; |
424 | 424 |
425 FRIEND_TEST_ALL_PREFIXES(CrossProcessFrameTreeBrowserTest, | 425 FRIEND_TEST_ALL_PREFIXES(CrossProcessFrameTreeBrowserTest, |
426 CreateCrossProcessSubframeProxies); | 426 CreateCrossProcessSubframeProxies); |
427 | 427 |
428 // PlzNavigate | |
429 enum RenderFrameHostToUse { | |
430 INVALID, | |
431 REUSE_CURRENT, | |
432 NEW_SPECULATIVE, | |
433 REUSE_SPECULATIVE, | |
434 }; | |
435 | |
436 // Stores information regarding a SiteInstance targeted at a specific URL. It | |
437 // can whether point to an existent one or store the details needed to create | |
Charlie Reis
2015/03/25 00:09:25
nit: can point (drop "whether")
s/existent/existi
carlosk
2015/03/30 14:37:38
Done.
| |
438 // a new one. | |
439 struct SiteInstanceDescriptor { | |
440 explicit SiteInstanceDescriptor(content::SiteInstance* site_instance) | |
441 : existent_site_instance(site_instance), | |
442 new_site_is_related_to_current(false) {} | |
443 | |
444 SiteInstanceDescriptor(GURL site_url, bool related_to_current) | |
445 : existent_site_instance(nullptr), | |
446 new_site_url(site_url), | |
447 new_site_is_related_to_current(related_to_current) {} | |
448 | |
449 // Set with an existent SiteInstance to be reused. | |
450 content::SiteInstance* existent_site_instance; | |
451 // In case |existent_site_instance| is null, specify a new site URL. | |
452 GURL new_site_url; | |
453 // In case |existent_site_instance| is null, specify if the new site should | |
454 // be created in new BrowsingInstance or not. | |
455 bool new_site_is_related_to_current; | |
Charlie Reis
2015/03/25 00:09:26
"site" doesn't fit well in this name. This descri
carlosk
2015/03/30 14:37:38
Done.
| |
456 }; | |
457 | |
428 // Used with FrameTree::ForEach to erase RenderFrameProxyHosts from a | 458 // Used with FrameTree::ForEach to erase RenderFrameProxyHosts from a |
429 // FrameTreeNode's RenderFrameHostManager. | 459 // FrameTreeNode's RenderFrameHostManager. |
430 static bool ClearProxiesInSiteInstance(int32 site_instance_id, | 460 static bool ClearProxiesInSiteInstance(int32 site_instance_id, |
431 FrameTreeNode* node); | 461 FrameTreeNode* node); |
432 // Used with FrameTree::ForEach to reset initialized state of | 462 // Used with FrameTree::ForEach to reset initialized state of |
433 // RenderFrameProxyHosts from a FrameTreeNode's RenderFrameHostManager. | 463 // RenderFrameProxyHosts from a FrameTreeNode's RenderFrameHostManager. |
434 static bool ResetProxiesInSiteInstance(int32 site_instance_id, | 464 static bool ResetProxiesInSiteInstance(int32 site_instance_id, |
435 FrameTreeNode* node); | 465 FrameTreeNode* node); |
436 | 466 |
437 // 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... | |
466 // 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 |
467 // |current_entry| to |new_url|. | 497 // |current_entry| to |new_url|. |
468 bool ShouldReuseWebUI( | 498 bool ShouldReuseWebUI( |
469 const NavigationEntry* current_entry, | 499 const NavigationEntry* current_entry, |
470 const GURL& new_url) const; | 500 const GURL& new_url) const; |
471 | 501 |
472 // Returns the SiteInstance to use for the navigation. | 502 // Returns the SiteInstance to use for the navigation. |
473 SiteInstance* GetSiteInstanceForNavigation(const GURL& dest_url, | 503 SiteInstance* GetSiteInstanceForNavigation(const GURL& dest_url, |
474 SiteInstance* source_instance, | 504 SiteInstance* source_instance, |
475 SiteInstance* dest_instance, | 505 SiteInstance* dest_instance, |
506 SiteInstance* candidate_instance, | |
476 ui::PageTransition transition, | 507 ui::PageTransition transition, |
477 bool dest_is_restore, | 508 bool dest_is_restore, |
478 bool dest_is_view_source_mode); | 509 bool dest_is_view_source_mode); |
479 | 510 |
480 // Returns an appropriate SiteInstance object for the given |dest_url|, | 511 // PlzNavigate |
481 // possibly reusing the current SiteInstance. If --process-per-tab is used, | 512 // Returns true if |candidate_instance| confirms to the SiteInstance specified |
Charlie Reis
2015/03/25 00:09:25
"confirms to" isn't grammatically correct. "match
carlosk
2015/03/30 14:37:38
It was a typo: I meant to write "conforms". But "m
| |
482 // this is only called when ShouldSwapBrowsingInstancesForNavigation returns | 513 // by |descriptor|. |
483 // true. |source_instance| is the SiteInstance of the frame that initiated the | 514 bool SiteInstanceMatchesDescription(SiteInstance* candidate_instance, |
carlosk
2015/03/24 15:30:06
I wanted to move this method into an unnamed names
Charlie Reis
2015/03/25 00:09:25
Please keep SiteInstanceDescriptor private.
carlosk
2015/03/30 14:37:38
Acknowledged.
| |
484 // navigation. |current_instance| is the SiteInstance of the frame that is | 515 const SiteInstanceDescriptor& descriptor); |
485 // currently navigating. |dest_instance|, is a predetermined SiteInstance | 516 |
486 // that'll be used if not null. | 517 // Returns a descriptor of the appropriate SiteInstance object for the given |
518 // |dest_url|, possibly reusing the current, source or destination | |
519 // SiteInstance. It will check ShouldTransitionCrossSite and | |
Charlie Reis
2015/03/25 00:09:25
This second sentence is an implementation detail a
carlosk
2015/03/30 14:37:38
Done.
| |
520 // ShouldSwapBrowsingInstancesForNavigation. | |
521 // |source_instance| is the SiteInstance of the frame that initiated the | |
Charlie Reis
2015/03/25 00:09:25
nit: Add an empty comment line above this.
carlosk
2015/03/30 14:37:38
Done.
| |
522 // navigation. |dest_instance|, is a predetermined SiteInstance | |
Charlie Reis
2015/03/25 00:09:25
Remove comma.
carlosk
2015/03/30 14:37:38
Done.
| |
523 // that'll be used if not null. Internally, |current_instance| is the | |
Charlie Reis
2015/03/25 00:09:25
that'll -> that will
carlosk
2015/03/30 14:37:38
Done.
| |
524 // SiteInstance of the frame that is currently navigating. | |
487 // For example, if you have a parent frame A, which has a child frame B, and | 525 // For example, if you have a parent frame A, which has a child frame B, and |
488 // A is trying to change the src attribute of B, this will cause a navigation | 526 // A is trying to change the src attribute of B, this will cause a navigation |
489 // where the source SiteInstance is A and B is the current SiteInstance. | 527 // where the source SiteInstance is A and B is the current SiteInstance. |
490 // This is a helper function for GetSiteInstanceForNavigation. | 528 // This is a helper function for GetSiteInstanceForNavigation and |
Charlie Reis
2015/03/25 00:09:26
nit: Add an empty comment line above this.
carlosk
2015/03/30 14:37:38
Done.
| |
491 SiteInstance* GetSiteInstanceForURL(const GURL& dest_url, | 529 // IsCorrectSiteInstanceForURL. |
492 SiteInstance* source_instance, | 530 SiteInstanceDescriptor DetermineSiteInstanceForURL( |
493 SiteInstance* current_instance, | 531 const GURL& dest_url, |
494 SiteInstance* dest_instance, | 532 SiteInstance* source_instance, |
495 ui::PageTransition transition, | 533 SiteInstance* dest_instance, |
496 bool dest_is_restore, | 534 ui::PageTransition transition, |
497 bool dest_is_view_source_mode, | 535 bool dest_is_restore, |
498 bool force_browsing_instance_swap); | 536 bool dest_is_view_source_mode); |
537 SiteInstanceDescriptor DetermineSiteInstanceForURLInternal( | |
Charlie Reis
2015/03/25 00:09:25
These functions are already private internal detai
carlosk
2015/03/30 14:37:38
I explained this here: https://codereview.chromium
| |
538 const GURL& dest_url, | |
539 SiteInstance* source_instance, | |
540 SiteInstance* current_instance, | |
541 SiteInstance* dest_instance, | |
542 ui::PageTransition transition, | |
543 bool dest_is_restore, | |
544 bool dest_is_view_source_mode, | |
545 bool force_browsing_instance_swap); | |
499 | 546 |
500 // Determines the appropriate url to use as the current url for SiteInstance | 547 // Determines the appropriate url to use as the current url for SiteInstance |
501 // selection. | 548 // selection. |
502 const GURL& GetCurrentURLForSiteInstance( | 549 const GURL& GetCurrentURLForSiteInstance( |
503 SiteInstance* current_instance, | 550 SiteInstance* current_instance, |
504 NavigationEntry* current_entry); | 551 NavigationEntry* current_entry); |
505 | 552 |
506 // Creates a new RenderFrameHostImpl for the |new_instance| and assign it to | 553 // Creates a new RenderFrameHostImpl for the |new_instance| and assign it to |
507 // |pending_render_frame_host_| while respecting the opener route if needed | 554 // |pending_render_frame_host_| while respecting the opener route if needed |
508 // and stores it in pending_render_frame_host_. | 555 // and stores it in pending_render_frame_host_. |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
705 bool should_reuse_web_ui_; | 752 bool should_reuse_web_ui_; |
706 | 753 |
707 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; | 754 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; |
708 | 755 |
709 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); | 756 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); |
710 }; | 757 }; |
711 | 758 |
712 } // namespace content | 759 } // namespace content |
713 | 760 |
714 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ | 761 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ |
OLD | NEW |