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

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: Fix IsSuitableHost for sites that require a dedicated process but don't set an origin lock Created 3 years, 6 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 unless a process for |site_url| cannot be locked to just that
Charlie Reis 2017/06/17 23:13:53 nit: s/unless/if/, s/cannot/should/ (Otherwise it'
alexmos 2017/06/19 20:03:59 Done.
153 // site. Returning true here implies that |site_url| requires a dedicated
Charlie Reis 2017/06/17 23:13:53 nit: also implies
alexmos 2017/06/19 20:03:59 Done.
154 // process. However, the converse does not hold: if |site_url| requires a
Charlie Reis 2017/06/17 23:13:53 I'm finding this pretty hard to read, since "lock
alexmos 2017/06/19 20:03:59 Done, and also see below.
155 // dedicated process, this might still return false for certain special
156 // cases, most of which are temporary bug workarounds.
Charlie Reis 2017/06/17 23:13:53 "Temporary bug workarounds" is confusing me a bit.
alexmos 2017/06/19 20:03:59 I was mostly thinking about this comment on Conten
Charlie Reis 2017/06/28 00:08:37 Huh. How would we apply origin lock to all URLs?
alexmos 2017/06/28 00:33:26 I assumed this just meant "origin lock can be appl
157 static bool ShouldLockToOrigin(BrowserContext* browser_context,
158 GURL site_url);
159
152 private: 160 private:
153 friend class BrowsingInstance; 161 friend class BrowsingInstance;
154 friend class SiteInstanceTestBrowserClient; 162 friend class SiteInstanceTestBrowserClient;
155 163
156 // Create a new SiteInstance. Only BrowsingInstance should call this 164 // Create a new SiteInstance. Only BrowsingInstance should call this
157 // directly; clients should use Create() or GetRelatedSiteInstance() instead. 165 // directly; clients should use Create() or GetRelatedSiteInstance() instead.
158 explicit SiteInstanceImpl(BrowsingInstance* browsing_instance); 166 explicit SiteInstanceImpl(BrowsingInstance* browsing_instance);
159 167
160 ~SiteInstanceImpl() override; 168 ~SiteInstanceImpl() override;
161 169
162 // RenderProcessHostObserver implementation. 170 // RenderProcessHostObserver implementation.
163 void RenderProcessHostDestroyed(RenderProcessHost* host) override; 171 void RenderProcessHostDestroyed(RenderProcessHost* host) override;
164 void RenderProcessWillExit(RenderProcessHost* host) override; 172 void RenderProcessWillExit(RenderProcessHost* host) override;
165 void RenderProcessExited(RenderProcessHost* host, 173 void RenderProcessExited(RenderProcessHost* host,
166 base::TerminationStatus status, 174 base::TerminationStatus status,
167 int exit_code) override; 175 int exit_code) override;
168 176
169 // Used to restrict a process' origin access rights. 177 // Used to restrict a process' origin access rights.
170 void LockToOrigin(); 178 void LockToOriginIfNeeded();
171 179
172 // This gets the render process to use for default subframe site instances. 180 // This gets the render process to use for default subframe site instances.
173 RenderProcessHost* GetDefaultSubframeProcessHost( 181 RenderProcessHost* GetDefaultSubframeProcessHost(
174 BrowserContext* browser_context, 182 BrowserContext* browser_context,
175 bool is_for_guests_only); 183 bool is_for_guests_only);
176 184
177 // An object used to construct RenderProcessHosts. 185 // An object used to construct RenderProcessHosts.
178 static const RenderProcessHostFactory* g_render_process_host_factory_; 186 static const RenderProcessHostFactory* g_render_process_host_factory_;
179 187
180 // The next available SiteInstance ID. 188 // The next available SiteInstance ID.
(...skipping 25 matching lines...) Expand all
206 ProcessReusePolicy process_reuse_policy_; 214 ProcessReusePolicy process_reuse_policy_;
207 215
208 base::ObserverList<Observer, true> observers_; 216 base::ObserverList<Observer, true> observers_;
209 217
210 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl); 218 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl);
211 }; 219 };
212 220
213 } // namespace content 221 } // namespace content
214 222
215 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ 223 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698