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

Side by Side Diff: content/browser/site_instance_impl.h

Issue 2921063003: Fix process reuse for dedicated processes when over process limit. (Closed)
Patch Set: Rebase Created 3 years, 5 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 static GURL GetEffectiveURL(BrowserContext* browser_context, 142 static GURL GetEffectiveURL(BrowserContext* browser_context,
143 const GURL& url); 143 const GURL& url);
144 144
145 // Returns true if pages loaded from |url| ought to be handled only by a 145 // Returns true if pages loaded from |url| ought to be handled only by a
146 // renderer process isolated from other sites. If --site-per-process is on the 146 // renderer process isolated from other sites. If --site-per-process is on the
147 // command line, this is true for all sites. In other site isolation modes, 147 // command line, this is true for all sites. In other site isolation modes,
148 // only a subset of sites will require dedicated processes. 148 // only a subset of sites will require dedicated processes.
149 static bool DoesSiteRequireDedicatedProcess(BrowserContext* browser_context, 149 static bool DoesSiteRequireDedicatedProcess(BrowserContext* browser_context,
150 const GURL& url); 150 const GURL& url);
151 151
152 // Returns true if a process for |site_url| should be locked to just that
153 // site. Returning true here also implies that |site_url| requires a
154 // dedicated process. However, the converse does not hold: this might still
155 // return false for certain special cases where an origin lock can't be
156 // applied even when |site_url| requires a dedicated process (e.g., with
157 // --site-per-process). Examples of those cases include <webview> guests,
158 // WebUI, or extensions where a process is currently allowed to be reused for
159 // different extensions. Most of these special cases should eventually be
160 // removed, and this function should become equivalent to
161 // DoesSiteRequireDedicatedProcess().
162 static bool ShouldLockToOrigin(BrowserContext* browser_context,
163 GURL site_url);
164
152 private: 165 private:
153 friend class BrowsingInstance; 166 friend class BrowsingInstance;
154 friend class SiteInstanceTestBrowserClient; 167 friend class SiteInstanceTestBrowserClient;
155 168
156 // Create a new SiteInstance. Only BrowsingInstance should call this 169 // Create a new SiteInstance. Only BrowsingInstance should call this
157 // directly; clients should use Create() or GetRelatedSiteInstance() instead. 170 // directly; clients should use Create() or GetRelatedSiteInstance() instead.
158 explicit SiteInstanceImpl(BrowsingInstance* browsing_instance); 171 explicit SiteInstanceImpl(BrowsingInstance* browsing_instance);
159 172
160 ~SiteInstanceImpl() override; 173 ~SiteInstanceImpl() override;
161 174
162 // RenderProcessHostObserver implementation. 175 // RenderProcessHostObserver implementation.
163 void RenderProcessHostDestroyed(RenderProcessHost* host) override; 176 void RenderProcessHostDestroyed(RenderProcessHost* host) override;
164 void RenderProcessWillExit(RenderProcessHost* host) override; 177 void RenderProcessWillExit(RenderProcessHost* host) override;
165 void RenderProcessExited(RenderProcessHost* host, 178 void RenderProcessExited(RenderProcessHost* host,
166 base::TerminationStatus status, 179 base::TerminationStatus status,
167 int exit_code) override; 180 int exit_code) override;
168 181
169 // Used to restrict a process' origin access rights. 182 // Used to restrict a process' origin access rights.
170 void LockToOrigin(); 183 void LockToOriginIfNeeded();
171 184
172 // This gets the render process to use for default subframe site instances. 185 // This gets the render process to use for default subframe site instances.
173 RenderProcessHost* GetDefaultSubframeProcessHost( 186 RenderProcessHost* GetDefaultSubframeProcessHost(
174 BrowserContext* browser_context, 187 BrowserContext* browser_context,
175 bool is_for_guests_only); 188 bool is_for_guests_only);
176 189
177 // An object used to construct RenderProcessHosts. 190 // An object used to construct RenderProcessHosts.
178 static const RenderProcessHostFactory* g_render_process_host_factory_; 191 static const RenderProcessHostFactory* g_render_process_host_factory_;
179 192
180 // The next available SiteInstance ID. 193 // The next available SiteInstance ID.
(...skipping 25 matching lines...) Expand all
206 ProcessReusePolicy process_reuse_policy_; 219 ProcessReusePolicy process_reuse_policy_;
207 220
208 base::ObserverList<Observer, true> observers_; 221 base::ObserverList<Observer, true> observers_;
209 222
210 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl); 223 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl);
211 }; 224 };
212 225
213 } // namespace content 226 } // namespace content
214 227
215 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ 228 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_unittest.cc ('k') | content/browser/site_instance_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698