diff options
Diffstat (limited to 'chromium/content/browser/browsing_instance.h')
-rw-r--r-- | chromium/content/browser/browsing_instance.h | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/chromium/content/browser/browsing_instance.h b/chromium/content/browser/browsing_instance.h index 6b03c07316e..7f588450c44 100644 --- a/chromium/content/browser/browsing_instance.h +++ b/chromium/content/browser/browsing_instance.h @@ -8,7 +8,6 @@ #include <stddef.h> #include <string> -#include <unordered_map> #include "base/check_op.h" #include "base/gtest_prod_util.h" @@ -99,8 +98,8 @@ class CONTENT_EXPORT BrowsingInstance final const IsolationContext& isolation_context() { return isolation_context_; } // Returns whether this BrowsingInstance has registered a SiteInstance for - // the site of the given URL. - bool HasSiteInstance(const GURL& url); + // the site of |site_info|. + bool HasSiteInstance(const SiteInfo& site_info); // Get the SiteInstance responsible for rendering the given URL. Should // create a new one if necessary, but should not create more than one @@ -116,18 +115,14 @@ class CONTENT_EXPORT BrowsingInstance final const GURL& url, bool allow_default_instance); - // Gets site and lock URLs for |url| that are identical with what these - // values would be if we called GetSiteInstanceForURL() with the same - // |url| and |allow_default_instance|. This method is used when we need this - // information, but do not want to create a SiteInstance yet. - // TODO(wjmaclean): Convert the |site_url| parameter to be SiteInfo. See - // https://crbug.com/1085275/#c2. - void GetSiteAndLockForURL(const GURL& url, - bool allow_default_instance, - GURL* site_url, - GURL* lock_url); - - // Helper function used by GetSiteInstanceForURL() and GetSiteAndLockForURL() + // Returns a SiteInfo with site and process-lock URLs for |url| that are + // identical with what these values would be if we called + // GetSiteInstanceForURL() with the same |url| and |allow_default_instance|. + // This method is used when we need this information, but do not want to + // create a SiteInstance yet. + SiteInfo GetSiteInfoForURL(const GURL& url, bool allow_default_instance); + + // Helper function used by GetSiteInstanceForURL() and GetSiteInfoForURL() // that returns an existing SiteInstance from |site_instance_map_| or // returns |default_site_instance_| if |allow_default_instance| is true and // other conditions are met. If there is no existing SiteInstance that is @@ -187,11 +182,10 @@ class CONTENT_EXPORT BrowsingInstance final // Note: This should not be used by code outside this class. SiteInfo GetSiteInfoForURL(const GURL& url) const; - // Map of site to SiteInstance, to ensure we only have one SiteInstance per - // site. - // TODO(wjmaclean): This map will be updated in CL#3 as described in - // https://crbug.com/1085275#c2 to use a SiteInfo hashkey as the key string. - typedef std::unordered_map<std::string, SiteInstanceImpl*> SiteInstanceMap; + // Map of SiteInfo to SiteInstance, to ensure we only have one SiteInstance + // per SiteInfo. See https://crbug.com/1085275#c2 for the rationale behind + // why SiteInfo is the right class to key this on. + typedef std::map<SiteInfo, SiteInstanceImpl*> SiteInstanceMap; // The next available browser-global BrowsingInstance ID. static int next_browsing_instance_id_; @@ -232,7 +226,7 @@ class CONTENT_EXPORT BrowsingInstance final // Keeps track of the site URLs that this object mapped to the // |default_site_instance_|. - // TODO(wjmaclean): convert this to use a SiteInfo hash key instead. + // TODO(wjmaclean): Revise this to store SiteInfos instead of GURLs. std::set<GURL> site_url_set_; DISALLOW_COPY_AND_ASSIGN(BrowsingInstance); |