Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: content/browser/frame_host/render_frame_host_manager.h

Issue 967383002: PlzNavigate: Avoid duplicate SiteInstance creation during navigation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Consolidated methods into a simpler change; addressed other CR comments. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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. It
435 // can point to an existing one or store the details needed to create a new
436 // one.
Charlie Reis 2015/03/31 06:18:19 Sounds good. Can you also mention that the purpos
carlosk 2015/03/31 16:38:19 Done.
437 struct SiteInstanceDescriptor {
438 explicit SiteInstanceDescriptor(content::SiteInstance* site_instance)
439 : existing_site_instance(site_instance),
440 new_is_related_to_current(false) {}
441
442 SiteInstanceDescriptor(GURL site_url,
443 bool related_to_current,
444 BrowserContext* browser_context);
445
446 // Set with an existing SiteInstance to be reused.
447 content::SiteInstance* existing_site_instance;
448 // In case |existing_site_instance| is null, specify a new site URL.
Charlie Reis 2015/03/31 06:18:19 nit: Blank lines between these members.
carlosk 2015/03/31 16:38:19 Done.
449 GURL new_site_url;
450 // In case |existing_site_instance| is null, specify if the new site should
451 // be created in new BrowsingInstance or not.
452 bool new_is_related_to_current;
453 };
454
426 // Used with FrameTree::ForEach to erase RenderFrameProxyHosts from a 455 // Used with FrameTree::ForEach to erase RenderFrameProxyHosts from a
427 // FrameTreeNode's RenderFrameHostManager. 456 // FrameTreeNode's RenderFrameHostManager.
428 static bool ClearProxiesInSiteInstance(int32 site_instance_id, 457 static bool ClearProxiesInSiteInstance(int32 site_instance_id,
429 FrameTreeNode* node); 458 FrameTreeNode* node);
430 // Used with FrameTree::ForEach to reset initialized state of 459 // Used with FrameTree::ForEach to reset initialized state of
431 // RenderFrameProxyHosts from a FrameTreeNode's RenderFrameHostManager. 460 // RenderFrameProxyHosts from a FrameTreeNode's RenderFrameHostManager.
432 static bool ResetProxiesInSiteInstance(int32 site_instance_id, 461 static bool ResetProxiesInSiteInstance(int32 site_instance_id,
433 FrameTreeNode* node); 462 FrameTreeNode* node);
434 463
435 // Returns whether this tab should transition to a new renderer for 464 // Returns whether this tab should transition to a new renderer for
(...skipping 28 matching lines...) Expand all
464 // Returns true if it is safe to reuse the current WebUI when navigating from 493 // Returns true if it is safe to reuse the current WebUI when navigating from
465 // |current_entry| to |new_url|. 494 // |current_entry| to |new_url|.
466 bool ShouldReuseWebUI( 495 bool ShouldReuseWebUI(
467 const NavigationEntry* current_entry, 496 const NavigationEntry* current_entry,
468 const GURL& new_url) const; 497 const GURL& new_url) const;
469 498
470 // Returns the SiteInstance to use for the navigation. 499 // Returns the SiteInstance to use for the navigation.
471 SiteInstance* GetSiteInstanceForNavigation(const GURL& dest_url, 500 SiteInstance* GetSiteInstanceForNavigation(const GURL& dest_url,
472 SiteInstance* source_instance, 501 SiteInstance* source_instance,
473 SiteInstance* dest_instance, 502 SiteInstance* dest_instance,
503 SiteInstance* candidate_instance,
474 ui::PageTransition transition, 504 ui::PageTransition transition,
475 bool dest_is_restore, 505 bool dest_is_restore,
476 bool dest_is_view_source_mode); 506 bool dest_is_view_source_mode);
477 507
478 // Returns an appropriate SiteInstance object for the given |dest_url|, 508 // Returns a descriptor of the appropriate SiteInstance object for the given
479 // possibly reusing the current SiteInstance. If --process-per-tab is used, 509 // |dest_url|, possibly reusing the current, source or destination
480 // this is only called when ShouldSwapBrowsingInstancesForNavigation returns 510 // SiteInstance.
Charlie Reis 2015/03/31 06:18:19 Also mention that the SiteInstance can be obtained
carlosk 2015/03/31 16:38:20 Done.
481 // true. |source_instance| is the SiteInstance of the frame that initiated the 511 //
482 // navigation. |current_instance| is the SiteInstance of the frame that is 512 // |source_instance| is the SiteInstance of the frame that initiated the
483 // currently navigating. |dest_instance|, is a predetermined SiteInstance 513 // navigation. |dest_instance| is a predetermined SiteInstance that will be
Charlie Reis 2015/03/31 06:18:19 Please do not reorder these sentences, so that the
carlosk 2015/03/31 16:38:20 Reordered them as the original file. It made sen
484 // that'll be used if not null. 514 // used if not null. Internally, |current_instance| is the SiteInstance of the
515 // frame that is currently navigating.
485 // For example, if you have a parent frame A, which has a child frame B, and 516 // 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 517 // 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. 518 // where the source SiteInstance is A and B is the current SiteInstance.
519 //
488 // This is a helper function for GetSiteInstanceForNavigation. 520 // This is a helper function for GetSiteInstanceForNavigation.
489 SiteInstance* GetSiteInstanceForURL(const GURL& dest_url, 521 SiteInstanceDescriptor DetermineSiteInstanceForURL(
490 SiteInstance* source_instance, 522 const GURL& dest_url,
491 SiteInstance* current_instance, 523 SiteInstance* source_instance,
492 SiteInstance* dest_instance, 524 SiteInstance* current_instance,
493 ui::PageTransition transition, 525 SiteInstance* dest_instance,
494 bool dest_is_restore, 526 ui::PageTransition transition,
495 bool dest_is_view_source_mode, 527 bool dest_is_restore,
496 bool force_browsing_instance_swap); 528 bool dest_is_view_source_mode,
529 bool force_browsing_instance_swap);
530
531 // Converts a SiteInstanceDescriptor to the actual SiteInstance it describes.
532 // If a |candidate_instance| is provided (is not nullptr) and it matches the
533 // description, it is returned verbatim.
Charlie Reis 2015/03/31 06:18:19 s/verbatim/as is/
carlosk 2015/03/31 16:38:19 Done.
534 SiteInstance* ConvertToSiteInstance(const SiteInstanceDescriptor& descriptor,
535 SiteInstance* candidate_instance);
497 536
498 // Determines the appropriate url to use as the current url for SiteInstance 537 // Determines the appropriate url to use as the current url for SiteInstance
499 // selection. 538 // selection.
500 const GURL& GetCurrentURLForSiteInstance( 539 const GURL& GetCurrentURLForSiteInstance(
501 SiteInstance* current_instance, 540 SiteInstance* current_instance,
502 NavigationEntry* current_entry); 541 NavigationEntry* current_entry);
503 542
504 // Creates a new RenderFrameHostImpl for the |new_instance| and assign it to 543 // Creates a new RenderFrameHostImpl for the |new_instance| and assign it to
505 // |pending_render_frame_host_| while respecting the opener route if needed 544 // |pending_render_frame_host_| while respecting the opener route if needed
506 // and stores it in pending_render_frame_host_. 545 // and stores it in pending_render_frame_host_.
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 bool should_reuse_web_ui_; 742 bool should_reuse_web_ui_;
704 743
705 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_; 744 base::WeakPtrFactory<RenderFrameHostManager> weak_factory_;
706 745
707 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager); 746 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostManager);
708 }; 747 };
709 748
710 } // namespace content 749 } // namespace content
711 750
712 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_ 751 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698