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

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

Issue 606113005: Move RenderViewHost swap out state to RenderFrameHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix review suggestions Created 6 years, 2 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 "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 27 matching lines...) Expand all
38 // Returns whether there is currently a related SiteInstance (registered with 38 // Returns whether there is currently a related SiteInstance (registered with
39 // 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
40 // avoid dedicating an unused SiteInstance to it (e.g., in a new tab). 40 // avoid dedicating an unused SiteInstance to it (e.g., in a new tab).
41 bool HasRelatedSiteInstance(const GURL& url); 41 bool HasRelatedSiteInstance(const GURL& url);
42 42
43 // Returns whether this SiteInstance has a process that is the wrong type for 43 // Returns whether this SiteInstance has a process that is the wrong type for
44 // the given URL. If so, the browser should force a process swap when 44 // the given URL. If so, the browser should force a process swap when
45 // navigating to the URL. 45 // navigating to the URL.
46 bool HasWrongProcessForURL(const GURL& url); 46 bool HasWrongProcessForURL(const GURL& url);
47 47
48 // Increase the number of active views in this SiteInstance. This is 48 // Increase the number of active frames in this SiteInstance. This is
49 // increased when a view is created, or a currently swapped out view 49 // increased when a frame is created, or a currently swapped out frame
50 // is swapped in. 50 // is swapped in.
51 void increment_active_view_count() { active_view_count_++; } 51 void increment_active_frame_count() { active_frame_count_++; }
52 52
53 // Decrease the number of active views in this SiteInstance. This is 53 // Decrease the number of active frames in this SiteInstance. This is
54 // decreased when a view is destroyed, or a currently active view is 54 // decreased when a frame is destroyed, or a currently active frame is
55 // swapped out. 55 // swapped out.
56 void decrement_active_view_count() { active_view_count_--; } 56 void decrement_active_frame_count() { active_frame_count_--; }
57 57
58 // Get the number of active views which belong to this 58 // Get the number of active frames which belong to this SiteInstance. If
59 // SiteInstance. If there is no active view left in this 59 // there are no active frames left, all frames in this SiteInstance can be
60 // SiteInstance, all view in this SiteInstance can be safely 60 // safely discarded.
61 // discarded to save memory. 61 size_t active_frame_count() { return active_frame_count_; }
62 size_t active_view_count() { return active_view_count_; }
63 62
64 // Increase the number of active WebContentses using this SiteInstance. Note 63 // Increase the number of active WebContentses using this SiteInstance. Note
65 // that, unlike active_view_count, this does not count pending RVHs. 64 // that, unlike active_frame_count, this does not count pending RFHs.
66 void IncrementRelatedActiveContentsCount(); 65 void IncrementRelatedActiveContentsCount();
67 66
68 // Decrease the number of active WebContentses using this SiteInstance. Note 67 // Decrease the number of active WebContentses using this SiteInstance. Note
69 // that, unlike active_view_count, this does not count pending RVHs. 68 // that, unlike active_frame_count, this does not count pending RFHs.
70 void DecrementRelatedActiveContentsCount(); 69 void DecrementRelatedActiveContentsCount();
71 70
72 // Sets the global factory used to create new RenderProcessHosts. It may be 71 // Sets the global factory used to create new RenderProcessHosts. It may be
73 // NULL, in which case the default BrowserRenderProcessHost will be created 72 // NULL, in which case the default BrowserRenderProcessHost will be created
74 // (this is the behavior if you don't call this function). The factory must 73 // (this is the behavior if you don't call this function). The factory must
75 // be set back to NULL before it's destroyed; ownership is not transferred. 74 // be set back to NULL before it's destroyed; ownership is not transferred.
76 static void set_render_process_host_factory( 75 static void set_render_process_host_factory(
77 const RenderProcessHostFactory* rph_factory); 76 const RenderProcessHostFactory* rph_factory);
78 77
79 // Get the effective URL for the given actual URL. This allows the 78 // Get the effective URL for the given actual URL. This allows the
(...skipping 26 matching lines...) Expand all
106 105
107 // An object used to construct RenderProcessHosts. 106 // An object used to construct RenderProcessHosts.
108 static const RenderProcessHostFactory* g_render_process_host_factory_; 107 static const RenderProcessHostFactory* g_render_process_host_factory_;
109 108
110 // The next available SiteInstance ID. 109 // The next available SiteInstance ID.
111 static int32 next_site_instance_id_; 110 static int32 next_site_instance_id_;
112 111
113 // A unique ID for this SiteInstance. 112 // A unique ID for this SiteInstance.
114 int32 id_; 113 int32 id_;
115 114
116 // The number of active views under this SiteInstance. 115 // The number of active frames in this SiteInstance.
117 size_t active_view_count_; 116 size_t active_frame_count_;
118 117
119 // BrowsingInstance to which this SiteInstance belongs. 118 // BrowsingInstance to which this SiteInstance belongs.
120 scoped_refptr<BrowsingInstance> browsing_instance_; 119 scoped_refptr<BrowsingInstance> browsing_instance_;
121 120
122 // Current RenderProcessHost that is rendering pages for this SiteInstance. 121 // Current RenderProcessHost that is rendering pages for this SiteInstance.
123 // This pointer will only change once the RenderProcessHost is destructed. It 122 // This pointer will only change once the RenderProcessHost is destructed. It
124 // will still remain the same even if the process crashes, since in that 123 // will still remain the same even if the process crashes, since in that
125 // scenario the RenderProcessHost remains the same. 124 // scenario the RenderProcessHost remains the same.
126 RenderProcessHost* process_; 125 RenderProcessHost* process_;
127 126
128 // The web site that this SiteInstance is rendering pages for. 127 // The web site that this SiteInstance is rendering pages for.
129 GURL site_; 128 GURL site_;
130 129
131 // Whether SetSite has been called. 130 // Whether SetSite has been called.
132 bool has_site_; 131 bool has_site_;
133 132
134 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl); 133 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl);
135 }; 134 };
136 135
137 } // namespace content 136 } // namespace content
138 137
139 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ 138 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.cc ('k') | content/browser/site_instance_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698