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

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: More diagnosis. 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. This allows the
71 // ContentBrowserClient to override the SiteInstance's site for certain URLs.
72 // For example, Chrome uses this to replace hosted app URLs with extension
73 // hosts.
74 // Only public so that we can make a consistent process swap decision in
75 // RenderViewHostManager.
76 static GURL GetEffectiveURL(BrowserContext* browser_context,
77 const GURL& url);
78
70 protected: 79 protected:
71 friend class BrowsingInstance; 80 friend class BrowsingInstance;
72 friend class SiteInstance; 81 friend class SiteInstance;
73 82
74 // Virtual to allow tests to extend it. 83 // Virtual to allow tests to extend it.
75 virtual ~SiteInstanceImpl(); 84 virtual ~SiteInstanceImpl();
76 85
77 // Create a new SiteInstance. Protected to give access to BrowsingInstance 86 // Create a new SiteInstance. Protected to give access to BrowsingInstance
78 // and tests; most callers should use Create or GetRelatedSiteInstance 87 // and tests; most callers should use Create or GetRelatedSiteInstance
79 // instead. 88 // instead.
80 explicit SiteInstanceImpl(BrowsingInstance* browsing_instance); 89 explicit SiteInstanceImpl(BrowsingInstance* browsing_instance);
81 90
82 private: 91 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. 92 // NotificationObserver implementation.
88 virtual void Observe(int type, 93 virtual void Observe(int type,
89 const NotificationSource& source, 94 const NotificationSource& source,
90 const NotificationDetails& details) OVERRIDE; 95 const NotificationDetails& details) OVERRIDE;
91 96
92 // Used to restrict a process' origin access rights. 97 // Used to restrict a process' origin access rights.
93 void LockToOrigin(); 98 void LockToOrigin();
94 99
95 // An object used to construct RenderProcessHosts. 100 // An object used to construct RenderProcessHosts.
96 static const RenderProcessHostFactory* g_render_process_host_factory_; 101 static const RenderProcessHostFactory* g_render_process_host_factory_;
(...skipping 27 matching lines...) Expand all
124 129
125 // Whether SetSite has been called. 130 // Whether SetSite has been called.
126 bool has_site_; 131 bool has_site_;
127 132
128 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl); 133 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl);
129 }; 134 };
130 135
131 } // namespace content 136 } // namespace content
132 137
133 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ 138 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698