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

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 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
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/notification_observer.h" 10 #include "content/public/browser/notification_observer.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // discarded to save memory. 60 // discarded to save memory.
61 size_t active_view_count() { return active_view_count_; } 61 size_t active_view_count() { return active_view_count_; }
62 62
63 // Sets the global factory used to create new RenderProcessHosts. It may be 63 // Sets the global factory used to create new RenderProcessHosts. It may be
64 // NULL, in which case the default BrowserRenderProcessHost will be created 64 // NULL, in which case the default BrowserRenderProcessHost will be created
65 // (this is the behavior if you don't call this function). The factory must 65 // (this is the behavior if you don't call this function). The factory must
66 // be set back to NULL before it's destroyed; ownership is not transferred. 66 // be set back to NULL before it's destroyed; ownership is not transferred.
67 static void set_render_process_host_factory( 67 static void set_render_process_host_factory(
68 const RenderProcessHostFactory* rph_factory); 68 const RenderProcessHostFactory* rph_factory);
69 69
70 // Get the effective URL for the given actual URL. Public so that we can make
nasko 2013/11/05 18:41:00 If this becomes external to SiteInstanceImpl, it i
Charlie Reis 2013/11/05 19:13:15 Yeah, I wasn't thrilled about making it public, bu
71 // a consistent process swap decision in RenderViewHostManager.
72 static GURL GetEffectiveURL(BrowserContext* browser_context,
73 const GURL& url);
74
70 protected: 75 protected:
71 friend class BrowsingInstance; 76 friend class BrowsingInstance;
72 friend class SiteInstance; 77 friend class SiteInstance;
73 78
74 // Virtual to allow tests to extend it. 79 // Virtual to allow tests to extend it.
75 virtual ~SiteInstanceImpl(); 80 virtual ~SiteInstanceImpl();
76 81
77 // Create a new SiteInstance. Protected to give access to BrowsingInstance 82 // Create a new SiteInstance. Protected to give access to BrowsingInstance
78 // and tests; most callers should use Create or GetRelatedSiteInstance 83 // and tests; most callers should use Create or GetRelatedSiteInstance
79 // instead. 84 // instead.
80 explicit SiteInstanceImpl(BrowsingInstance* browsing_instance); 85 explicit SiteInstanceImpl(BrowsingInstance* browsing_instance);
81 86
82 private: 87 private:
83 // Get the effective URL for the given actual URL.
84 static GURL GetEffectiveURL(BrowserContext* browser_context,
85 const GURL& url);
86
87 // NotificationObserver implementation. 88 // NotificationObserver implementation.
88 virtual void Observe(int type, 89 virtual void Observe(int type,
89 const NotificationSource& source, 90 const NotificationSource& source,
90 const NotificationDetails& details) OVERRIDE; 91 const NotificationDetails& details) OVERRIDE;
91 92
92 // Used to restrict a process' origin access rights. 93 // Used to restrict a process' origin access rights.
93 void LockToOrigin(); 94 void LockToOrigin();
94 95
95 // An object used to construct RenderProcessHosts. 96 // An object used to construct RenderProcessHosts.
96 static const RenderProcessHostFactory* g_render_process_host_factory_; 97 static const RenderProcessHostFactory* g_render_process_host_factory_;
(...skipping 27 matching lines...) Expand all
124 125
125 // Whether SetSite has been called. 126 // Whether SetSite has been called.
126 bool has_site_; 127 bool has_site_;
127 128
128 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl); 129 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl);
129 }; 130 };
130 131
131 } // namespace content 132 } // namespace content
132 133
133 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ 134 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698