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

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

Issue 57433010: Prevent creating a swapped out RVH in the same SiteInstance as the current one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/frame_host/render_view_host_manager_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/browser/renderer_host/render_process_host_impl.h" 8 #include "content/browser/renderer_host/render_process_host_impl.h"
9 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
10 #include "content/public/browser/render_process_host_observer.h" 10 #include "content/public/browser/render_process_host_observer.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // discarded to save memory. 59 // discarded to save memory.
60 size_t active_view_count() { return active_view_count_; } 60 size_t active_view_count() { return active_view_count_; }
61 61
62 // Sets the global factory used to create new RenderProcessHosts. It may be 62 // Sets the global factory used to create new RenderProcessHosts. It may be
63 // NULL, in which case the default BrowserRenderProcessHost will be created 63 // NULL, in which case the default BrowserRenderProcessHost will be created
64 // (this is the behavior if you don't call this function). The factory must 64 // (this is the behavior if you don't call this function). The factory must
65 // be set back to NULL before it's destroyed; ownership is not transferred. 65 // be set back to NULL before it's destroyed; ownership is not transferred.
66 static void set_render_process_host_factory( 66 static void set_render_process_host_factory(
67 const RenderProcessHostFactory* rph_factory); 67 const RenderProcessHostFactory* rph_factory);
68 68
69 // Get the effective URL for the given actual URL. This allows the
70 // ContentBrowserClient to override the SiteInstance's site for certain URLs.
71 // For example, Chrome uses this to replace hosted app URLs with extension
72 // hosts.
73 // Only public so that we can make a consistent process swap decision in
74 // RenderViewHostManager.
75 static GURL GetEffectiveURL(BrowserContext* browser_context,
76 const GURL& url);
77
69 protected: 78 protected:
70 friend class BrowsingInstance; 79 friend class BrowsingInstance;
71 friend class SiteInstance; 80 friend class SiteInstance;
72 81
73 // Virtual to allow tests to extend it. 82 // Virtual to allow tests to extend it.
74 virtual ~SiteInstanceImpl(); 83 virtual ~SiteInstanceImpl();
75 84
76 // Create a new SiteInstance. Protected to give access to BrowsingInstance 85 // Create a new SiteInstance. Protected to give access to BrowsingInstance
77 // and tests; most callers should use Create or GetRelatedSiteInstance 86 // and tests; most callers should use Create or GetRelatedSiteInstance
78 // instead. 87 // instead.
79 explicit SiteInstanceImpl(BrowsingInstance* browsing_instance); 88 explicit SiteInstanceImpl(BrowsingInstance* browsing_instance);
80 89
81 private: 90 private:
82 // Get the effective URL for the given actual URL.
83 static GURL GetEffectiveURL(BrowserContext* browser_context,
84 const GURL& url);
85
86 // RenderProcessHostObserver implementation. 91 // RenderProcessHostObserver implementation.
87 virtual void RenderProcessHostDestroyed(RenderProcessHost* host) OVERRIDE; 92 virtual void RenderProcessHostDestroyed(RenderProcessHost* host) OVERRIDE;
88 93
89 // Used to restrict a process' origin access rights. 94 // Used to restrict a process' origin access rights.
90 void LockToOrigin(); 95 void LockToOrigin();
91 96
92 // An object used to construct RenderProcessHosts. 97 // An object used to construct RenderProcessHosts.
93 static const RenderProcessHostFactory* g_render_process_host_factory_; 98 static const RenderProcessHostFactory* g_render_process_host_factory_;
94 99
95 // The next available SiteInstance ID. 100 // The next available SiteInstance ID.
(...skipping 19 matching lines...) Expand all
115 120
116 // Whether SetSite has been called. 121 // Whether SetSite has been called.
117 bool has_site_; 122 bool has_site_;
118 123
119 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl); 124 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl);
120 }; 125 };
121 126
122 } // namespace content 127 } // namespace content
123 128
124 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ 129 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_view_host_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698