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

Side by Side Diff: chrome/renderer/render_thread.h

Issue 174303: Modify the RenderThread to track the number of widgets... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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
« no previous file with comments | « chrome/renderer/mock_render_thread.h ('k') | chrome/renderer/render_thread.cc » ('j') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 CHROME_RENDERER_RENDER_THREAD_H_ 5 #ifndef CHROME_RENDERER_RENDER_THREAD_H_
6 #define CHROME_RENDERER_RENDER_THREAD_H_ 6 #define CHROME_RENDERER_RENDER_THREAD_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 virtual bool Send(IPC::Message* msg) = 0; 43 virtual bool Send(IPC::Message* msg) = 0;
44 44
45 // Called to add or remove a listener for a particular message routing ID. 45 // Called to add or remove a listener for a particular message routing ID.
46 // These methods normally get delegated to a MessageRouter. 46 // These methods normally get delegated to a MessageRouter.
47 virtual void AddRoute(int32 routing_id, IPC::Channel::Listener* listener) = 0; 47 virtual void AddRoute(int32 routing_id, IPC::Channel::Listener* listener) = 0;
48 virtual void RemoveRoute(int32 routing_id) = 0; 48 virtual void RemoveRoute(int32 routing_id) = 0;
49 49
50 virtual void AddFilter(IPC::ChannelProxy::MessageFilter* filter) = 0; 50 virtual void AddFilter(IPC::ChannelProxy::MessageFilter* filter) = 0;
51 virtual void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter) = 0; 51 virtual void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter) = 0;
52
53 // Called by a RenderWidget when it is hidden or restored.
54 virtual void WidgetHidden() = 0;
55 virtual void WidgetRestored() = 0;
52 }; 56 };
53 57
54 // The RenderThread class represents a background thread where RenderView 58 // The RenderThread class represents a background thread where RenderView
55 // instances live. The RenderThread supports an API that is used by its 59 // instances live. The RenderThread supports an API that is used by its
56 // consumer to talk indirectly to the RenderViews and supporting objects. 60 // consumer to talk indirectly to the RenderViews and supporting objects.
57 // Likewise, it provides an API for the RenderViews to talk back to the main 61 // Likewise, it provides an API for the RenderViews to talk back to the main
58 // process (i.e., their corresponding TabContents). 62 // process (i.e., their corresponding TabContents).
59 // 63 //
60 // Most of the communication occurs in the form of IPC messages. They are 64 // Most of the communication occurs in the form of IPC messages. They are
61 // routed to the RenderThread according to the routing IDs of the messages. 65 // routed to the RenderThread according to the routing IDs of the messages.
(...skipping 10 matching lines...) Expand all
72 // Returns the one render thread for this process. Note that this should only 76 // Returns the one render thread for this process. Note that this should only
73 // be accessed when running on the render thread itself 77 // be accessed when running on the render thread itself
74 static RenderThread* current(); 78 static RenderThread* current();
75 79
76 // Overridden from RenderThreadBase. 80 // Overridden from RenderThreadBase.
77 virtual bool Send(IPC::Message* msg) { 81 virtual bool Send(IPC::Message* msg) {
78 return ChildThread::Send(msg); 82 return ChildThread::Send(msg);
79 } 83 }
80 84
81 virtual void AddRoute(int32 routing_id, IPC::Channel::Listener* listener) { 85 virtual void AddRoute(int32 routing_id, IPC::Channel::Listener* listener) {
86 widget_count_++;
82 return ChildThread::AddRoute(routing_id, listener); 87 return ChildThread::AddRoute(routing_id, listener);
83 } 88 }
84 virtual void RemoveRoute(int32 routing_id) { 89 virtual void RemoveRoute(int32 routing_id) {
90 widget_count_--;
85 return ChildThread::RemoveRoute(routing_id); 91 return ChildThread::RemoveRoute(routing_id);
86 } 92 }
87 93
88 virtual void AddFilter(IPC::ChannelProxy::MessageFilter* filter); 94 virtual void AddFilter(IPC::ChannelProxy::MessageFilter* filter);
89 virtual void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter); 95 virtual void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter);
90 96
97 virtual void WidgetHidden();
98 virtual void WidgetRestored();
99
91 VisitedLinkSlave* visited_link_slave() const { 100 VisitedLinkSlave* visited_link_slave() const {
92 return visited_link_slave_.get(); 101 return visited_link_slave_.get();
93 } 102 }
94 103
95 UserScriptSlave* user_script_slave() const { 104 UserScriptSlave* user_script_slave() const {
96 return user_script_slave_.get(); 105 return user_script_slave_.get();
97 } 106 }
98 107
99 AppCacheDispatcher* appcache_dispatcher() const { 108 AppCacheDispatcher* appcache_dispatcher() const {
100 return appcache_dispatcher_.get(); 109 return appcache_dispatcher_.get();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 void OnPurgePluginListCache(); 165 void OnPurgePluginListCache();
157 166
158 // Gather usage statistics from the in-memory cache and inform our host. 167 // Gather usage statistics from the in-memory cache and inform our host.
159 // These functions should be call periodically so that the host can make 168 // These functions should be call periodically so that the host can make
160 // decisions about how to allocation resources using current information. 169 // decisions about how to allocation resources using current information.
161 void InformHostOfCacheStats(); 170 void InformHostOfCacheStats();
162 171
163 // We initialize WebKit as late as possible. 172 // We initialize WebKit as late as possible.
164 void EnsureWebKitInitialized(); 173 void EnsureWebKitInitialized();
165 174
175 // A task we invoke periodically to assist with idle cleanup.
176 void IdleHandler();
177
166 // These objects live solely on the render thread. 178 // These objects live solely on the render thread.
167 scoped_ptr<ScopedRunnableMethodFactory<RenderThread> > cache_stats_factory_; 179 scoped_ptr<ScopedRunnableMethodFactory<RenderThread> > task_factory_;
168 scoped_ptr<VisitedLinkSlave> visited_link_slave_; 180 scoped_ptr<VisitedLinkSlave> visited_link_slave_;
169 scoped_ptr<UserScriptSlave> user_script_slave_; 181 scoped_ptr<UserScriptSlave> user_script_slave_;
170 scoped_ptr<RenderDnsMaster> dns_master_; 182 scoped_ptr<RenderDnsMaster> dns_master_;
171 scoped_ptr<AppCacheDispatcher> appcache_dispatcher_; 183 scoped_ptr<AppCacheDispatcher> appcache_dispatcher_;
172 scoped_refptr<DevToolsAgentFilter> devtools_agent_filter_; 184 scoped_refptr<DevToolsAgentFilter> devtools_agent_filter_;
173 scoped_ptr<RendererHistogramSnapshots> histogram_snapshots_; 185 scoped_ptr<RendererHistogramSnapshots> histogram_snapshots_;
174 scoped_ptr<RendererWebKitClientImpl> webkit_client_; 186 scoped_ptr<RendererWebKitClientImpl> webkit_client_;
175 187
176 scoped_refptr<DBMessageFilter> db_message_filter_; 188 scoped_refptr<DBMessageFilter> db_message_filter_;
177 189
178 #if defined(OS_POSIX) 190 #if defined(OS_POSIX)
179 scoped_refptr<IPC::ChannelProxy::MessageFilter> 191 scoped_refptr<IPC::ChannelProxy::MessageFilter>
180 suicide_on_channel_error_filter_; 192 suicide_on_channel_error_filter_;
181 #endif 193 #endif
182 194
183 // If true, then a GetPlugins call is allowed to rescan the disk. 195 // If true, then a GetPlugins call is allowed to rescan the disk.
184 bool plugin_refresh_allowed_; 196 bool plugin_refresh_allowed_;
185 197
198 // Is there a pending task for doing CacheStats.
199 bool cache_stats_task_pending_;
200
201 // The count of RenderWidgets running through this thread.
202 int widget_count_;
203
204 // The count of hidden RenderWidgets running through this thread.
205 int hidden_widget_count_;
206
207 // The current value of the idle notification timer delay.
208 double idle_notification_delay_in_s_;
209
186 DISALLOW_COPY_AND_ASSIGN(RenderThread); 210 DISALLOW_COPY_AND_ASSIGN(RenderThread);
187 }; 211 };
188 212
189 #endif // CHROME_RENDERER_RENDER_THREAD_H_ 213 #endif // CHROME_RENDERER_RENDER_THREAD_H_
OLDNEW
« no previous file with comments | « chrome/renderer/mock_render_thread.h ('k') | chrome/renderer/render_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698