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

Side by Side 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: Suppress tests under --site-per-process Created 4 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_SITE_INSTANCE_IMPL_H_ 5 #ifndef CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_
6 #define CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ 6 #define CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 int32_t GetId() override; 43 int32_t GetId() override;
44 bool HasProcess() const override; 44 bool HasProcess() const override;
45 RenderProcessHost* GetProcess() override; 45 RenderProcessHost* GetProcess() override;
46 BrowserContext* GetBrowserContext() const override; 46 BrowserContext* GetBrowserContext() const override;
47 const GURL& GetSiteURL() const override; 47 const GURL& GetSiteURL() const override;
48 scoped_refptr<SiteInstance> GetRelatedSiteInstance(const GURL& url) override; 48 scoped_refptr<SiteInstance> GetRelatedSiteInstance(const GURL& url) override;
49 bool IsRelatedSiteInstance(const SiteInstance* instance) override; 49 bool IsRelatedSiteInstance(const SiteInstance* instance) override;
50 size_t GetRelatedActiveContentsCount() override; 50 size_t GetRelatedActiveContentsCount() override;
51 bool RequiresDedicatedProcess() override; 51 bool RequiresDedicatedProcess() override;
52 52
53 // Returns the SiteInstance, related to this one, that should be used
54 // for subframes when an oopif is required, but a dedicated process is not.
55 // This SiteInstance will be created if it doesn't already exist. There is
56 // at most one of these per BrowsingInstance.
57 scoped_refptr<SiteInstanceImpl> GetDefaultSubframeSiteInstance();
58
53 // Set the web site that this SiteInstance is rendering pages for. 59 // Set the web site that this SiteInstance is rendering pages for.
54 // This includes the scheme and registered domain, but not the port. If the 60 // This includes the scheme and registered domain, but not the port. If the
55 // URL does not have a valid registered domain, then the full hostname is 61 // URL does not have a valid registered domain, then the full hostname is
56 // stored. 62 // stored.
57 void SetSite(const GURL& url); 63 void SetSite(const GURL& url);
58 bool HasSite() const; 64 bool HasSite() const;
59 65
60 // Returns whether there is currently a related SiteInstance (registered with 66 // Returns whether there is currently a related SiteInstance (registered with
61 // BrowsingInstance) for the site of the given url. If so, we should try to 67 // BrowsingInstance) for the site of the given url. If so, we should try to
62 // avoid dedicating an unused SiteInstance to it (e.g., in a new tab). 68 // avoid dedicating an unused SiteInstance to it (e.g., in a new tab).
(...skipping 24 matching lines...) Expand all
87 // that, unlike active_frame_count, this does not count pending RFHs. 93 // that, unlike active_frame_count, this does not count pending RFHs.
88 void IncrementRelatedActiveContentsCount(); 94 void IncrementRelatedActiveContentsCount();
89 95
90 // Decrease the number of active WebContentses using this SiteInstance. Note 96 // Decrease the number of active WebContentses using this SiteInstance. Note
91 // that, unlike active_frame_count, this does not count pending RFHs. 97 // that, unlike active_frame_count, this does not count pending RFHs.
92 void DecrementRelatedActiveContentsCount(); 98 void DecrementRelatedActiveContentsCount();
93 99
94 void AddObserver(Observer* observer); 100 void AddObserver(Observer* observer);
95 void RemoveObserver(Observer* observer); 101 void RemoveObserver(Observer* observer);
96 102
103 bool is_default_subframe_site_instance() {
104 return is_default_subframe_site_instance_;
105 }
106
97 // Sets the global factory used to create new RenderProcessHosts. It may be 107 // Sets the global factory used to create new RenderProcessHosts. It may be
98 // NULL, in which case the default RenderProcessHost will be created (this is 108 // NULL, in which case the default RenderProcessHost will be created (this is
99 // the behavior if you don't call this function). The factory must be set 109 // the behavior if you don't call this function). The factory must be set
100 // back to NULL before it's destroyed; ownership is not transferred. 110 // back to NULL before it's destroyed; ownership is not transferred.
101 static void set_render_process_host_factory( 111 static void set_render_process_host_factory(
102 const RenderProcessHostFactory* rph_factory); 112 const RenderProcessHostFactory* rph_factory);
103 113
104 // Get the effective URL for the given actual URL. This allows the 114 // Get the effective URL for the given actual URL. This allows the
105 // ContentBrowserClient to override the SiteInstance's site for certain URLs. 115 // ContentBrowserClient to override the SiteInstance's site for certain URLs.
106 // For example, Chrome uses this to replace hosted app URLs with extension 116 // For example, Chrome uses this to replace hosted app URLs with extension
(...skipping 16 matching lines...) Expand all
123 friend class BrowsingInstance; 133 friend class BrowsingInstance;
124 134
125 // Virtual to allow tests to extend it. 135 // Virtual to allow tests to extend it.
126 ~SiteInstanceImpl() override; 136 ~SiteInstanceImpl() override;
127 137
128 // Create a new SiteInstance. Protected to give access to BrowsingInstance 138 // Create a new SiteInstance. Protected to give access to BrowsingInstance
129 // and tests; most callers should use Create or GetRelatedSiteInstance 139 // and tests; most callers should use Create or GetRelatedSiteInstance
130 // instead. 140 // instead.
131 explicit SiteInstanceImpl(BrowsingInstance* browsing_instance); 141 explicit SiteInstanceImpl(BrowsingInstance* browsing_instance);
132 142
143 // Only BrowsingInstance should call this.
144 void set_is_default_subframe_site_instance() {
145 is_default_subframe_site_instance_ = true;
146 }
147
133 private: 148 private:
134 // RenderProcessHostObserver implementation. 149 // RenderProcessHostObserver implementation.
135 void RenderProcessHostDestroyed(RenderProcessHost* host) override; 150 void RenderProcessHostDestroyed(RenderProcessHost* host) override;
136 void RenderProcessWillExit(RenderProcessHost* host) override; 151 void RenderProcessWillExit(RenderProcessHost* host) override;
137 void RenderProcessExited(RenderProcessHost* host, 152 void RenderProcessExited(RenderProcessHost* host,
138 base::TerminationStatus status, 153 base::TerminationStatus status,
139 int exit_code) override; 154 int exit_code) override;
140 155
141 // Used to restrict a process' origin access rights. 156 // Used to restrict a process' origin access rights.
142 void LockToOrigin(); 157 void LockToOrigin();
(...skipping 18 matching lines...) Expand all
161 // will still remain the same even if the process crashes, since in that 176 // will still remain the same even if the process crashes, since in that
162 // scenario the RenderProcessHost remains the same. 177 // scenario the RenderProcessHost remains the same.
163 RenderProcessHost* process_; 178 RenderProcessHost* process_;
164 179
165 // The web site that this SiteInstance is rendering pages for. 180 // The web site that this SiteInstance is rendering pages for.
166 GURL site_; 181 GURL site_;
167 182
168 // Whether SetSite has been called. 183 // Whether SetSite has been called.
169 bool has_site_; 184 bool has_site_;
170 185
186 // Whether this SiteInstance is the default subframe SiteInstance for its
187 // BrowsingInstance. Only one SiteInstance per BrowsingInstance can have this
188 // be true.
189 bool is_default_subframe_site_instance_;
190
171 base::ObserverList<Observer, true> observers_; 191 base::ObserverList<Observer, true> observers_;
172 192
173 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl); 193 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl);
174 }; 194 };
175 195
176 } // namespace content 196 } // namespace content
177 197
178 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ 198 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | content/browser/site_instance_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698