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

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

Issue 257083002: Check BrowsingInstance before swapping prerenders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: creis comments Created 6 years, 7 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 | 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/render_process_host_observer.h" 10 #include "content/public/browser/render_process_host_observer.h"
11 #include "content/public/browser/site_instance.h" 11 #include "content/public/browser/site_instance.h"
12 #include "url/gurl.h" 12 #include "url/gurl.h"
13 13
14 namespace content { 14 namespace content {
15 class BrowsingInstance;
15 class RenderProcessHostFactory; 16 class RenderProcessHostFactory;
16 17
17 class CONTENT_EXPORT SiteInstanceImpl : public SiteInstance, 18 class CONTENT_EXPORT SiteInstanceImpl : public SiteInstance,
18 public RenderProcessHostObserver { 19 public RenderProcessHostObserver {
19 public: 20 public:
20 // SiteInstance interface overrides. 21 // SiteInstance interface overrides.
21 virtual int32 GetId() OVERRIDE; 22 virtual int32 GetId() OVERRIDE;
22 virtual bool HasProcess() const OVERRIDE; 23 virtual bool HasProcess() const OVERRIDE;
23 virtual RenderProcessHost* GetProcess() OVERRIDE; 24 virtual RenderProcessHost* GetProcess() OVERRIDE;
25 virtual BrowserContext* GetBrowserContext() const OVERRIDE;
24 virtual const GURL& GetSiteURL() const OVERRIDE; 26 virtual const GURL& GetSiteURL() const OVERRIDE;
25 virtual SiteInstance* GetRelatedSiteInstance(const GURL& url) OVERRIDE; 27 virtual SiteInstance* GetRelatedSiteInstance(const GURL& url) OVERRIDE;
26 virtual bool IsRelatedSiteInstance(const SiteInstance* instance) OVERRIDE; 28 virtual bool IsRelatedSiteInstance(const SiteInstance* instance) OVERRIDE;
27 virtual BrowserContext* GetBrowserContext() const OVERRIDE; 29 virtual size_t GetRelatedActiveContentsCount() const OVERRIDE;
28 30
29 // Set the web site that this SiteInstance is rendering pages for. 31 // Set the web site that this SiteInstance is rendering pages for.
30 // This includes the scheme and registered domain, but not the port. If the 32 // This includes the scheme and registered domain, but not the port. If the
31 // URL does not have a valid registered domain, then the full hostname is 33 // URL does not have a valid registered domain, then the full hostname is
32 // stored. 34 // stored.
33 void SetSite(const GURL& url); 35 void SetSite(const GURL& url);
34 bool HasSite() const; 36 bool HasSite() const;
35 37
36 // Returns whether there is currently a related SiteInstance (registered with 38 // Returns whether there is currently a related SiteInstance (registered with
37 // BrowsingInstance) for the site of the given url. If so, we should try to 39 // BrowsingInstance) for the site of the given url. If so, we should try to
(...skipping 14 matching lines...) Expand all
52 // decreased when a view is destroyed, or a currently active view is 54 // decreased when a view is destroyed, or a currently active view is
53 // swapped out. 55 // swapped out.
54 void decrement_active_view_count() { active_view_count_--; } 56 void decrement_active_view_count() { active_view_count_--; }
55 57
56 // Get the number of active views which belong to this 58 // Get the number of active views which belong to this
57 // SiteInstance. If there is no active view left in this 59 // SiteInstance. If there is no active view left in this
58 // SiteInstance, all view in this SiteInstance can be safely 60 // SiteInstance, all view in this SiteInstance can be safely
59 // discarded to save memory. 61 // discarded to save memory.
60 size_t active_view_count() { return active_view_count_; } 62 size_t active_view_count() { return active_view_count_; }
61 63
64 // Increase the number of active WebContentses on this SiteInstance. Note
Charlie Reis 2014/04/29 22:13:51 nit: on -> using (here, below, and in browsing_ins
davidben 2014/04/29 23:02:26 Done.
65 // that, unlike active_view_count, this does not count pending RVHs.
66 void IncrementRelatedActiveContentsCount();
67
68 // Decrease the number of active WebContentses on this SiteInstance. Note
69 // that, unlike active_view_count, this does not count pending RVHs.
70 void DecrementRelatedActiveContentsCount();
71
62 // Sets the global factory used to create new RenderProcessHosts. It may be 72 // Sets the global factory used to create new RenderProcessHosts. It may be
63 // NULL, in which case the default BrowserRenderProcessHost will be created 73 // 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 74 // (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. 75 // be set back to NULL before it's destroyed; ownership is not transferred.
66 static void set_render_process_host_factory( 76 static void set_render_process_host_factory(
67 const RenderProcessHostFactory* rph_factory); 77 const RenderProcessHostFactory* rph_factory);
68 78
69 // Get the effective URL for the given actual URL. This allows the 79 // Get the effective URL for the given actual URL. This allows the
70 // ContentBrowserClient to override the SiteInstance's site for certain URLs. 80 // ContentBrowserClient to override the SiteInstance's site for certain URLs.
71 // For example, Chrome uses this to replace hosted app URLs with extension 81 // For example, Chrome uses this to replace hosted app URLs with extension
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 130
121 // Whether SetSite has been called. 131 // Whether SetSite has been called.
122 bool has_site_; 132 bool has_site_;
123 133
124 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl); 134 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl);
125 }; 135 };
126 136
127 } // namespace content 137 } // namespace content
128 138
129 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ 139 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698