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

Unified Diff: content/browser/site_instance_impl.h

Issue 1797363002: "Top Document Isolation" mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix up tests. Necessary rebase to obtain browsertest util behavior change. Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/site_instance_impl.h
diff --git a/content/browser/site_instance_impl.h b/content/browser/site_instance_impl.h
index 81967cfffa12d827d3e8c35687ee63d9c6ac4fed..aa4c6e37224f50a355f13ad1da612d033cea9c3c 100644
--- a/content/browser/site_instance_impl.h
+++ b/content/browser/site_instance_impl.h
@@ -44,6 +44,12 @@ class CONTENT_EXPORT SiteInstanceImpl : public SiteInstance,
size_t GetRelatedActiveContentsCount() override;
bool RequiresDedicatedProcess() override;
+ // Returns the SiteInstance, related to this one, that should be used
+ // for subframes when an oopif is required, but a dedicated process is not.
+ // This SiteInstance will be created if it doesn't already exist. There is
+ // at most one of these per BrowsingInstance.
+ SiteInstance* GetDefaultSubframeSiteInstance();
+
// Set the web site that this SiteInstance is rendering pages for.
// This includes the scheme and registered domain, but not the port. If the
// URL does not have a valid registered domain, then the full hostname is
@@ -88,6 +94,10 @@ class CONTENT_EXPORT SiteInstanceImpl : public SiteInstance,
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
+ bool is_default_subframe_site_instance() {
+ return is_default_subframe_site_instance_;
+ }
+
// Sets the global factory used to create new RenderProcessHosts. It may be
// NULL, in which case the default RenderProcessHost will be created (this is
// the behavior if you don't call this function). The factory must be set
@@ -125,6 +135,11 @@ class CONTENT_EXPORT SiteInstanceImpl : public SiteInstance,
// instead.
explicit SiteInstanceImpl(BrowsingInstance* browsing_instance);
+ // Only BrowsingInstance should call this.
+ void set_is_default_subframe_site_instance() {
+ is_default_subframe_site_instance_ = true;
+ }
+
private:
// RenderProcessHostObserver implementation.
void RenderProcessHostDestroyed(RenderProcessHost* host) override;
@@ -146,7 +161,7 @@ class CONTENT_EXPORT SiteInstanceImpl : public SiteInstance,
int32_t id_;
// The number of active frames in this SiteInstance.
- size_t active_frame_count_;
+ size_t active_frame_count_ = 0;
// BrowsingInstance to which this SiteInstance belongs.
scoped_refptr<BrowsingInstance> browsing_instance_;
@@ -155,13 +170,18 @@ class CONTENT_EXPORT SiteInstanceImpl : public SiteInstance,
// This pointer will only change once the RenderProcessHost is destructed. It
// will still remain the same even if the process crashes, since in that
// scenario the RenderProcessHost remains the same.
- RenderProcessHost* process_;
+ RenderProcessHost* process_ = nullptr;
// The web site that this SiteInstance is rendering pages for.
GURL site_;
// Whether SetSite has been called.
- bool has_site_;
+ bool has_site_ = false;
+
+ // Whether this SiteInstance is the default subframe SiteInstance for its
+ // BrowsingInstance. Only one SiteInstance per BrowsingInstance can have this
+ // be true.
+ bool is_default_subframe_site_instance_ = false;
base::ObserverList<Observer, true> observers_;

Powered by Google App Engine
This is Rietveld 408576698