[email protected] | 1d4dbde | 2011-04-01 20:40:35 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 4 | |
[email protected] | 1d97d2e | 2008-12-18 23:39:02 | [diff] [blame] | 5 | #ifndef CHROME_RENDERER_RENDER_THREAD_H_ |
| 6 | #define CHROME_RENDERER_RENDER_THREAD_H_ |
[email protected] | 32b76ef | 2010-07-26 23:08:24 | [diff] [blame] | 7 | #pragma once |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 8 | |
[email protected] | 6779aa1 | 2011-03-29 17:32:24 | [diff] [blame] | 9 | #include <set> |
[email protected] | b68d5ed | 2009-04-16 02:41:28 | [diff] [blame] | 10 | #include <string> |
[email protected] | 1bc8306 | 2009-02-06 00:16:37 | [diff] [blame] | 11 | #include <vector> |
| 12 | |
[email protected] | 1223d6ef | 2011-03-28 16:47:50 | [diff] [blame] | 13 | #include "base/observer_list.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 14 | #include "base/shared_memory.h" |
[email protected] | 71d6d85 | 2009-12-07 22:12:36 | [diff] [blame] | 15 | #include "base/time.h" |
| 16 | #include "base/timer.h" |
[email protected] | 037fce0 | 2009-01-22 01:42:15 | [diff] [blame] | 17 | #include "build/build_config.h" |
[email protected] | 53c607c | 2011-03-21 23:19:04 | [diff] [blame] | 18 | #include "chrome/renderer/chrome_content_renderer_client.h" |
[email protected] | 3e90d4a | 2009-07-03 17:38:39 | [diff] [blame] | 19 | #include "chrome/renderer/visitedlink_slave.h" |
[email protected] | 7ef40ffe1 | 2011-03-08 05:05:28 | [diff] [blame] | 20 | #include "content/common/child_thread.h" |
[email protected] | 778574e | 2011-03-21 22:03:50 | [diff] [blame] | 21 | #include "content/common/css_colors.h" |
[email protected] | 7f3a2cf | 2011-04-06 00:10:50 | [diff] [blame^] | 22 | #include "content/common/gpu_process_launch_causes.h" |
[email protected] | a83d4229 | 2010-08-17 22:51:10 | [diff] [blame] | 23 | #include "ipc/ipc_channel_proxy.h" |
[email protected] | cb6037d | 2009-11-16 22:55:17 | [diff] [blame] | 24 | #include "ipc/ipc_platform_file.h" |
[email protected] | 08397d5 | 2011-02-05 01:53:38 | [diff] [blame] | 25 | #include "ui/gfx/native_widget_types.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 26 | |
[email protected] | 1edc16b8 | 2009-04-07 17:45:54 | [diff] [blame] | 27 | class AppCacheDispatcher; |
[email protected] | dd924193 | 2010-02-24 19:23:13 | [diff] [blame] | 28 | class CookieMessageFilter; |
[email protected] | 017022b | 2009-07-27 23:06:34 | [diff] [blame] | 29 | class DBMessageFilter; |
[email protected] | a862471 | 2009-04-17 00:51:35 | [diff] [blame] | 30 | class DevToolsAgentFilter; |
[email protected] | 39008c0 | 2009-02-11 23:59:25 | [diff] [blame] | 31 | class FilePath; |
[email protected] | e13ad79b | 2010-07-22 21:36:50 | [diff] [blame] | 32 | class GpuChannelHost; |
[email protected] | 70c19a93 | 2010-05-14 12:59:11 | [diff] [blame] | 33 | class IndexedDBDispatcher; |
[email protected] | 55e57d4 | 2009-02-25 06:10:17 | [diff] [blame] | 34 | class RendererHistogram; |
[email protected] | e13ad79b | 2010-07-22 21:36:50 | [diff] [blame] | 35 | class RendererHistogramSnapshots; |
[email protected] | 1223d6ef | 2011-03-28 16:47:50 | [diff] [blame] | 36 | class RenderProcessObserver; |
[email protected] | 74be069e8 | 2010-06-25 00:12:49 | [diff] [blame] | 37 | class RendererNetPredictor; |
[email protected] | 8d86fce | 2009-02-26 23:37:55 | [diff] [blame] | 38 | class RendererWebKitClientImpl; |
[email protected] | 85c55dc | 2009-11-06 03:05:46 | [diff] [blame] | 39 | class SpellCheck; |
[email protected] | 39008c0 | 2009-02-11 23:59:25 | [diff] [blame] | 40 | class SkBitmap; |
[email protected] | 2b437e23 | 2010-04-02 01:30:08 | [diff] [blame] | 41 | class WebDatabaseObserverImpl; |
[email protected] | cccf9093 | 2009-08-23 17:56:25 | [diff] [blame] | 42 | |
[email protected] | f85f070 | 2010-01-30 09:31:01 | [diff] [blame] | 43 | struct ContentSettings; |
[email protected] | 9b6f40e | 2009-06-11 15:54:26 | [diff] [blame] | 44 | struct RendererPreferences; |
[email protected] | 56879f93 | 2010-12-13 21:05:37 | [diff] [blame] | 45 | struct DOMStorageMsg_Event_Params; |
[email protected] | d6d8f71 | 2011-03-10 22:54:43 | [diff] [blame] | 46 | struct GPUInfo; |
[email protected] | 4e6419c | 2010-01-15 04:50:34 | [diff] [blame] | 47 | struct ViewMsg_New_Params; |
[email protected] | 39008c0 | 2009-02-11 23:59:25 | [diff] [blame] | 48 | struct WebPreferences; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 49 | |
[email protected] | c6a7b86 | 2010-08-20 22:19:38 | [diff] [blame] | 50 | namespace base { |
| 51 | class MessageLoopProxy; |
| 52 | class Thread; |
| 53 | } |
| 54 | |
[email protected] | 46f36a49 | 2010-07-28 19:36:41 | [diff] [blame] | 55 | namespace IPC { |
| 56 | struct ChannelHandle; |
| 57 | } |
| 58 | |
[email protected] | b7c7bcf | 2009-10-03 07:07:34 | [diff] [blame] | 59 | namespace WebKit { |
| 60 | class WebStorageEventDispatcher; |
| 61 | } |
| 62 | |
[email protected] | af7eb3fb | 2010-09-23 21:31:06 | [diff] [blame] | 63 | namespace v8 { |
| 64 | class Extension; |
| 65 | } |
| 66 | |
[email protected] | 81a3441 | 2009-01-05 19:17:24 | [diff] [blame] | 67 | // The RenderThreadBase is the minimal interface that a RenderView/Widget |
| 68 | // expects from a render thread. The interface basically abstracts a way to send |
| 69 | // and receive messages. |
[email protected] | 00c3961 | 2010-03-06 02:53:28 | [diff] [blame] | 70 | // |
[email protected] | f3ede41 | 2010-06-21 22:52:16 | [diff] [blame] | 71 | // TODO(brettw): This has two different and opposing usage patterns which |
| 72 | // make it confusing. |
| 73 | // |
| 74 | // In the first mode, callers call RenderThread::current() to get the one and |
| 75 | // only global RenderThread (bug 10837: this should be renamed get()). Then |
| 76 | // they access it. Since RenderThread is a concrete class, this can be NULL |
| 77 | // during unit tests. Callers need to NULL check this every time. Some callers |
| 78 | // don't happen to get called during unit tests and don't do the NULL checks, |
| 79 | // which is also confusing since it's not clear if you need to or not. |
| 80 | // |
| 81 | // In the second mode, the abstract base class RenderThreadBase is passed to |
| 82 | // RenderView and RenderWidget. Normally, this points to |
| 83 | // RenderThread::current() so it's quite confusing which accessing mode should |
| 84 | // be used. However, during unit testing, this class is replaced with a mock |
| 85 | // to support testing functions, and is guaranteed non-NULL. |
| 86 | // |
| 87 | // It might be nice not to have the ::current() call and put all of the |
| 88 | // functions on the abstract class so they can be mocked. However, there are |
| 89 | // some standalone functions like in ChromiumBridge that are not associated |
| 90 | // with a view that need to access the current thread to send messages to the |
| 91 | // browser process. These need the ::current() paradigm. So instead, we should |
| 92 | // probably remove the render_thread_ parameter to RenderView/Widget in |
| 93 | // preference to just getting the global singleton. We can make it easier to |
| 94 | // understand by moving everything to the abstract interface and saying that |
| 95 | // there should never be a NULL RenderThread::current(). Tests would be |
| 96 | // responsible for setting up the mock one. |
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 97 | class RenderThreadBase { |
[email protected] | 8085dbc8 | 2008-09-26 22:53:44 | [diff] [blame] | 98 | public: |
| 99 | virtual ~RenderThreadBase() {} |
| 100 | |
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 101 | virtual bool Send(IPC::Message* msg) = 0; |
| 102 | |
[email protected] | 8085dbc8 | 2008-09-26 22:53:44 | [diff] [blame] | 103 | // Called to add or remove a listener for a particular message routing ID. |
| 104 | // These methods normally get delegated to a MessageRouter. |
| 105 | virtual void AddRoute(int32 routing_id, IPC::Channel::Listener* listener) = 0; |
| 106 | virtual void RemoveRoute(int32 routing_id) = 0; |
[email protected] | 81a3441 | 2009-01-05 19:17:24 | [diff] [blame] | 107 | |
| 108 | virtual void AddFilter(IPC::ChannelProxy::MessageFilter* filter) = 0; |
| 109 | virtual void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter) = 0; |
[email protected] | bee16aab | 2009-08-26 15:55:03 | [diff] [blame] | 110 | |
| 111 | // Called by a RenderWidget when it is hidden or restored. |
| 112 | virtual void WidgetHidden() = 0; |
| 113 | virtual void WidgetRestored() = 0; |
[email protected] | b8f41a19 | 2010-04-19 18:25:04 | [diff] [blame] | 114 | |
[email protected] | bc535ee5 | 2010-08-31 18:40:32 | [diff] [blame] | 115 | // True if this process is running in an incognito profile. |
| 116 | virtual bool IsIncognitoProcess() const = 0; |
[email protected] | 8085dbc8 | 2008-09-26 22:53:44 | [diff] [blame] | 117 | }; |
| 118 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 119 | // The RenderThread class represents a background thread where RenderView |
| 120 | // instances live. The RenderThread supports an API that is used by its |
| 121 | // consumer to talk indirectly to the RenderViews and supporting objects. |
| 122 | // Likewise, it provides an API for the RenderViews to talk back to the main |
[email protected] | 57c6a65 | 2009-05-04 07:58:34 | [diff] [blame] | 123 | // process (i.e., their corresponding TabContents). |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 124 | // |
| 125 | // Most of the communication occurs in the form of IPC messages. They are |
| 126 | // routed to the RenderThread according to the routing IDs of the messages. |
| 127 | // The routing IDs correspond to RenderView instances. |
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 128 | class RenderThread : public RenderThreadBase, |
| 129 | public ChildThread { |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 130 | public: |
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 131 | // Grabs the IPC channel name from the command line. |
| 132 | RenderThread(); |
| 133 | // Constructor that's used when running in single process mode. |
[email protected] | 11f485728 | 2009-11-13 19:56:17 | [diff] [blame] | 134 | explicit RenderThread(const std::string& channel_name); |
[email protected] | 8085dbc8 | 2008-09-26 22:53:44 | [diff] [blame] | 135 | virtual ~RenderThread(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 136 | |
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 137 | // Returns the one render thread for this process. Note that this should only |
| 138 | // be accessed when running on the render thread itself |
[email protected] | 00c3961 | 2010-03-06 02:53:28 | [diff] [blame] | 139 | // |
| 140 | // TODO(brettw) this should be on the abstract base class instead of here, |
| 141 | // and return the base class' interface instead. Currently this causes |
| 142 | // problems with testing. See the comment above RenderThreadBase above. |
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 143 | static RenderThread* current(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 144 | |
[email protected] | c1f50aa | 2010-02-18 03:46:57 | [diff] [blame] | 145 | // Returns the routing ID of the RenderWidget containing the current script |
| 146 | // execution context (corresponding to WebFrame::frameForCurrentContext). |
| 147 | static int32 RoutingIDForCurrentContext(); |
| 148 | |
[email protected] | 4577622 | 2009-07-15 20:21:58 | [diff] [blame] | 149 | // Overridden from RenderThreadBase. |
[email protected] | c1f50aa | 2010-02-18 03:46:57 | [diff] [blame] | 150 | virtual bool Send(IPC::Message* msg); |
| 151 | virtual void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); |
| 152 | virtual void RemoveRoute(int32 routing_id); |
[email protected] | 81a3441 | 2009-01-05 19:17:24 | [diff] [blame] | 153 | virtual void AddFilter(IPC::ChannelProxy::MessageFilter* filter); |
| 154 | virtual void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter); |
[email protected] | bee16aab | 2009-08-26 15:55:03 | [diff] [blame] | 155 | virtual void WidgetHidden(); |
| 156 | virtual void WidgetRestored(); |
[email protected] | e4be2dd | 2010-12-14 00:44:39 | [diff] [blame] | 157 | virtual bool IsIncognitoProcess() const; |
[email protected] | bee16aab | 2009-08-26 15:55:03 | [diff] [blame] | 158 | |
[email protected] | 1223d6ef | 2011-03-28 16:47:50 | [diff] [blame] | 159 | void AddObserver(RenderProcessObserver* observer); |
| 160 | void RemoveObserver(RenderProcessObserver* observer); |
| 161 | |
[email protected] | c1f50aa | 2010-02-18 03:46:57 | [diff] [blame] | 162 | // These methods modify how the next message is sent. Normally, when sending |
| 163 | // a synchronous message that runs a nested message loop, we need to suspend |
| 164 | // callbacks into WebKit. This involves disabling timers and deferring |
| 165 | // resource loads. However, there are exceptions when we need to customize |
| 166 | // the behavior. |
| 167 | void DoNotSuspendWebKitSharedTimer(); |
| 168 | void DoNotNotifyWebKitOfModalLoop(); |
| 169 | |
[email protected] | 8d86fce | 2009-02-26 23:37:55 | [diff] [blame] | 170 | VisitedLinkSlave* visited_link_slave() const { |
| 171 | return visited_link_slave_.get(); |
| 172 | } |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 173 | |
[email protected] | f430b571 | 2009-08-21 21:46:31 | [diff] [blame] | 174 | AppCacheDispatcher* appcache_dispatcher() const { |
| 175 | return appcache_dispatcher_.get(); |
| 176 | } |
| 177 | |
[email protected] | 70c19a93 | 2010-05-14 12:59:11 | [diff] [blame] | 178 | IndexedDBDispatcher* indexed_db_dispatcher() const { |
| 179 | return indexed_db_dispatcher_.get(); |
| 180 | } |
| 181 | |
[email protected] | 85c55dc | 2009-11-06 03:05:46 | [diff] [blame] | 182 | SpellCheck* spellchecker() const { |
| 183 | return spellchecker_.get(); |
| 184 | } |
[email protected] | 85c55dc | 2009-11-06 03:05:46 | [diff] [blame] | 185 | |
[email protected] | b547fd4 | 2009-04-23 23:16:27 | [diff] [blame] | 186 | bool plugin_refresh_allowed() const { return plugin_refresh_allowed_; } |
| 187 | |
[email protected] | 6779aa1 | 2011-03-29 17:32:24 | [diff] [blame] | 188 | double idle_notification_delay_in_s() const { |
| 189 | return idle_notification_delay_in_s_; |
| 190 | } |
| 191 | void set_idle_notification_delay_in_s(double idle_notification_delay_in_s) { |
[email protected] | d07495f | 2011-03-29 17:41:28 | [diff] [blame] | 192 | idle_notification_delay_in_s_ = idle_notification_delay_in_s; |
[email protected] | 6779aa1 | 2011-03-29 17:32:24 | [diff] [blame] | 193 | } |
| 194 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 195 | // Do DNS prefetch resolution of a hostname. |
| 196 | void Resolve(const char* name, size_t length); |
| 197 | |
[email protected] | 55e57d4 | 2009-02-25 06:10:17 | [diff] [blame] | 198 | // Send all the Histogram data to browser. |
[email protected] | c9a3ef8 | 2009-05-28 22:02:46 | [diff] [blame] | 199 | void SendHistograms(int sequence_number); |
[email protected] | 55e57d4 | 2009-02-25 06:10:17 | [diff] [blame] | 200 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 201 | // Invokes InformHostOfCacheStats after a short delay. Used to move this |
| 202 | // bookkeeping operation off the critical latency path. |
| 203 | void InformHostOfCacheStatsLater(); |
| 204 | |
[email protected] | c40acc3 | 2010-01-14 01:02:53 | [diff] [blame] | 205 | // Sends a message to the browser to close all connections. |
| 206 | void CloseCurrentConnections(); |
[email protected] | b07f2909 | 2009-06-05 07:33:21 | [diff] [blame] | 207 | |
| 208 | // Sends a message to the browser to enable or disable the disk cache. |
| 209 | void SetCacheMode(bool enabled); |
| 210 | |
[email protected] | c5d7934 | 2010-06-05 01:27:34 | [diff] [blame] | 211 | // Sends a message to the browser to clear the disk cache. |
[email protected] | 0e34852a | 2011-02-15 23:14:44 | [diff] [blame] | 212 | // |preserve_ssl_host_info| is a flag indicating if the cache should purge |
| 213 | // entries related to cached SSL information. |
| 214 | void ClearCache(bool preserve_ssl_host_info); |
[email protected] | c5d7934 | 2010-06-05 01:27:34 | [diff] [blame] | 215 | |
[email protected] | 8990e471 | 2011-03-28 20:50:55 | [diff] [blame] | 216 | // Sends a message to the browser to clear thed host cache. |
| 217 | void ClearHostResolverCache(); |
| 218 | |
| 219 | // Sends a message to the browser to clear the predictor cache. |
| 220 | void ClearPredictorCache(); |
| 221 | |
[email protected] | 12893c3 | 2010-08-19 17:30:54 | [diff] [blame] | 222 | // Sends a message to the browser to enable/disable spdy. |
| 223 | void EnableSpdy(bool enable); |
| 224 | |
[email protected] | 6217d39 | 2010-03-25 22:08:35 | [diff] [blame] | 225 | // Asynchronously establish a channel to the GPU plugin if not previously |
| 226 | // established or if it has been lost (for example if the GPU plugin crashed). |
| 227 | // Use GetGpuChannel() to determine when the channel is ready for use. |
[email protected] | 7f3a2cf | 2011-04-06 00:10:50 | [diff] [blame^] | 228 | void EstablishGpuChannel(content::CauseForGpuLaunch); |
[email protected] | 6217d39 | 2010-03-25 22:08:35 | [diff] [blame] | 229 | |
[email protected] | 3bf4d53 | 2010-03-27 00:23:34 | [diff] [blame] | 230 | // Synchronously establish a channel to the GPU plugin if not previously |
| 231 | // established or if it has been lost (for example if the GPU plugin crashed). |
| 232 | // If there is a pending asynchronous request, it will be completed by the |
| 233 | // time this routine returns. |
[email protected] | 7f3a2cf | 2011-04-06 00:10:50 | [diff] [blame^] | 234 | GpuChannelHost* EstablishGpuChannelSync(content::CauseForGpuLaunch); |
[email protected] | 3bf4d53 | 2010-03-27 00:23:34 | [diff] [blame] | 235 | |
[email protected] | 6217d39 | 2010-03-25 22:08:35 | [diff] [blame] | 236 | // Get the GPU channel. Returns NULL if the channel is not established or |
| 237 | // has been lost. |
| 238 | GpuChannelHost* GetGpuChannel(); |
| 239 | |
[email protected] | c6a7b86 | 2010-08-20 22:19:38 | [diff] [blame] | 240 | // Returns a MessageLoopProxy instance corresponding to the message loop |
| 241 | // of the thread on which file operations should be run. Must be called |
| 242 | // on the renderer's main thread. |
| 243 | scoped_refptr<base::MessageLoopProxy> GetFileThreadMessageLoopProxy(); |
| 244 | |
[email protected] | af7eb3fb | 2010-09-23 21:31:06 | [diff] [blame] | 245 | // This function is called for every registered V8 extension each time a new |
| 246 | // script context is created. Returns true if the given V8 extension is |
| 247 | // allowed to run on the given URL and extension group. |
| 248 | bool AllowScriptExtension(const std::string& v8_extension_name, |
| 249 | const GURL& url, |
| 250 | int extension_group); |
| 251 | |
[email protected] | 08f42e7 | 2011-02-16 07:34:40 | [diff] [blame] | 252 | // Hack for http://crbug.com/71735. |
| 253 | // TODO(jamesr): remove once http://crbug.com/72007 is fixed. |
| 254 | RendererWebKitClientImpl* GetWebKitClientImpl() const { |
| 255 | return webkit_client_.get(); |
| 256 | } |
| 257 | |
[email protected] | 6779aa1 | 2011-03-29 17:32:24 | [diff] [blame] | 258 | // Schedule a call to IdleHandler with the given initial delay. |
| 259 | void ScheduleIdleHandler(double initial_delay_s); |
| 260 | |
| 261 | // A task we invoke periodically to assist with idle cleanup. |
| 262 | void IdleHandler(); |
| 263 | |
| 264 | // Registers the given V8 extension with WebKit. |
| 265 | void RegisterExtension(v8::Extension* extension); |
| 266 | |
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 267 | private: |
[email protected] | a95986a8 | 2010-12-24 06:19:28 | [diff] [blame] | 268 | virtual bool OnControlMessageReceived(const IPC::Message& msg); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 269 | |
[email protected] | 42f1d782 | 2009-07-23 18:17:55 | [diff] [blame] | 270 | void Init(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 271 | |
[email protected] | 176aa48 | 2008-11-14 03:25:15 | [diff] [blame] | 272 | void OnUpdateVisitedLinks(base::SharedMemoryHandle table); |
[email protected] | 3e90d4a | 2009-07-03 17:38:39 | [diff] [blame] | 273 | void OnAddVisitedLinks(const VisitedLinkSlave::Fingerprints& fingerprints); |
| 274 | void OnResetVisitedLinks(); |
[email protected] | b75b829 | 2010-10-01 07:28:25 | [diff] [blame] | 275 | void OnSetZoomLevelForCurrentURL(const GURL& url, double zoom_level); |
[email protected] | 0314ae0 | 2010-04-08 09:18:29 | [diff] [blame] | 276 | void OnSetContentSettingsForCurrentURL( |
| 277 | const GURL& url, const ContentSettings& content_settings); |
[email protected] | 56879f93 | 2010-12-13 21:05:37 | [diff] [blame] | 278 | void OnDOMStorageEvent(const DOMStorageMsg_Event_Params& params); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 279 | void OnSetNextPageID(int32 next_page_id); |
[email protected] | b2a74ca | 2010-03-12 17:57:09 | [diff] [blame] | 280 | void OnSetIsIncognitoProcess(bool is_incognito_process); |
[email protected] | b9ab10c | 2009-08-07 18:09:55 | [diff] [blame] | 281 | void OnSetCSSColors(const std::vector<CSSColors::CSSColorMapping>& colors); |
[email protected] | 4e6419c | 2010-01-15 04:50:34 | [diff] [blame] | 282 | void OnCreateNewView(const ViewMsg_New_Params& params); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 283 | void OnTransferBitmap(const SkBitmap& bitmap, int resource_id); |
| 284 | void OnSetCacheCapacities(size_t min_dead_capacity, |
| 285 | size_t max_dead_capacity, |
| 286 | size_t capacity); |
[email protected] | 163753f | 2010-10-01 20:59:03 | [diff] [blame] | 287 | void OnClearCache(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 288 | void OnGetCacheResourceStats(); |
| 289 | |
[email protected] | 55e57d4 | 2009-02-25 06:10:17 | [diff] [blame] | 290 | // Send all histograms to browser. |
[email protected] | c9a3ef8 | 2009-05-28 22:02:46 | [diff] [blame] | 291 | void OnGetRendererHistograms(int sequence_number); |
[email protected] | 55e57d4 | 2009-02-25 06:10:17 | [diff] [blame] | 292 | |
[email protected] | d4104109 | 2009-10-08 06:56:57 | [diff] [blame] | 293 | // Send tcmalloc info to browser. |
| 294 | void OnGetRendererTcmalloc(); |
[email protected] | 38b48a8 | 2009-11-11 01:51:32 | [diff] [blame] | 295 | void OnGetV8HeapStats(); |
[email protected] | d4104109 | 2009-10-08 06:56:57 | [diff] [blame] | 296 | |
[email protected] | fede6ca1 | 2009-10-08 18:24:26 | [diff] [blame] | 297 | void OnPurgeMemory(); |
[email protected] | b78e168b | 2009-09-21 22:05:45 | [diff] [blame] | 298 | void OnPurgePluginListCache(bool reload_pages); |
[email protected] | 75e5a87 | 2009-04-02 23:56:11 | [diff] [blame] | 299 | |
[email protected] | cb6037d | 2009-11-16 22:55:17 | [diff] [blame] | 300 | void OnInitSpellChecker(IPC::PlatformFileForTransit bdict_file, |
[email protected] | 85c55dc | 2009-11-06 03:05:46 | [diff] [blame] | 301 | const std::vector<std::string>& custom_words, |
| 302 | const std::string& language, |
| 303 | bool auto_spell_correct); |
| 304 | void OnSpellCheckWordAdded(const std::string& word); |
| 305 | void OnSpellCheckEnableAutoSpellCorrect(bool enable); |
[email protected] | 85c55dc | 2009-11-06 03:05:46 | [diff] [blame] | 306 | |
[email protected] | 4bce24e | 2010-09-07 20:45:01 | [diff] [blame] | 307 | void OnGpuChannelEstablished(const IPC::ChannelHandle& channel_handle, |
[email protected] | 0100b7a | 2011-02-24 22:54:50 | [diff] [blame] | 308 | base::ProcessHandle renderer_process_for_gpu, |
[email protected] | 4bce24e | 2010-09-07 20:45:01 | [diff] [blame] | 309 | const GPUInfo& gpu_info); |
[email protected] | 6217d39 | 2010-03-25 22:08:35 | [diff] [blame] | 310 | |
[email protected] | 31c90db | 2010-09-23 00:59:18 | [diff] [blame] | 311 | void OnSetPhishingModel(IPC::PlatformFileForTransit model_file); |
| 312 | |
[email protected] | b3df5a4 | 2010-05-11 14:31:09 | [diff] [blame] | 313 | void OnGetAccessibilityTree(); |
| 314 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 315 | // Gather usage statistics from the in-memory cache and inform our host. |
| 316 | // These functions should be call periodically so that the host can make |
| 317 | // decisions about how to allocation resources using current information. |
| 318 | void InformHostOfCacheStats(); |
| 319 | |
[email protected] | 90a3fbb1 | 2009-02-28 01:13:47 | [diff] [blame] | 320 | // We initialize WebKit as late as possible. |
| 321 | void EnsureWebKitInitialized(); |
| 322 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 323 | // These objects live solely on the render thread. |
[email protected] | bee16aab | 2009-08-26 15:55:03 | [diff] [blame] | 324 | scoped_ptr<ScopedRunnableMethodFactory<RenderThread> > task_factory_; |
[email protected] | 42f1d782 | 2009-07-23 18:17:55 | [diff] [blame] | 325 | scoped_ptr<VisitedLinkSlave> visited_link_slave_; |
[email protected] | 74be069e8 | 2010-06-25 00:12:49 | [diff] [blame] | 326 | scoped_ptr<RendererNetPredictor> renderer_net_predictor_; |
[email protected] | f430b571 | 2009-08-21 21:46:31 | [diff] [blame] | 327 | scoped_ptr<AppCacheDispatcher> appcache_dispatcher_; |
[email protected] | 70c19a93 | 2010-05-14 12:59:11 | [diff] [blame] | 328 | scoped_ptr<IndexedDBDispatcher> indexed_db_dispatcher_; |
[email protected] | 9291ed1 | 2009-07-23 17:33:22 | [diff] [blame] | 329 | scoped_refptr<DevToolsAgentFilter> devtools_agent_filter_; |
[email protected] | 42f1d782 | 2009-07-23 18:17:55 | [diff] [blame] | 330 | scoped_ptr<RendererHistogramSnapshots> histogram_snapshots_; |
| 331 | scoped_ptr<RendererWebKitClientImpl> webkit_client_; |
[email protected] | b7c7bcf | 2009-10-03 07:07:34 | [diff] [blame] | 332 | scoped_ptr<WebKit::WebStorageEventDispatcher> dom_storage_event_dispatcher_; |
[email protected] | 85c55dc | 2009-11-06 03:05:46 | [diff] [blame] | 333 | scoped_ptr<SpellCheck> spellchecker_; |
[email protected] | 9291ed1 | 2009-07-23 17:33:22 | [diff] [blame] | 334 | |
[email protected] | e2b2d4a | 2009-10-24 03:32:59 | [diff] [blame] | 335 | // Used on the renderer and IPC threads. |
[email protected] | 017022b | 2009-07-27 23:06:34 | [diff] [blame] | 336 | scoped_refptr<DBMessageFilter> db_message_filter_; |
[email protected] | dd924193 | 2010-02-24 19:23:13 | [diff] [blame] | 337 | scoped_refptr<CookieMessageFilter> cookie_message_filter_; |
[email protected] | 017022b | 2009-07-27 23:06:34 | [diff] [blame] | 338 | |
[email protected] | 1d4dbde | 2011-04-01 20:40:35 | [diff] [blame] | 339 | // Used on multiple script execution context threads. |
| 340 | scoped_ptr<WebDatabaseObserverImpl> web_database_observer_impl_; |
| 341 | |
[email protected] | 5fa1c54 | 2009-05-05 20:36:07 | [diff] [blame] | 342 | #if defined(OS_POSIX) |
| 343 | scoped_refptr<IPC::ChannelProxy::MessageFilter> |
| 344 | suicide_on_channel_error_filter_; |
| 345 | #endif |
| 346 | |
[email protected] | b547fd4 | 2009-04-23 23:16:27 | [diff] [blame] | 347 | // If true, then a GetPlugins call is allowed to rescan the disk. |
| 348 | bool plugin_refresh_allowed_; |
| 349 | |
[email protected] | bee16aab | 2009-08-26 15:55:03 | [diff] [blame] | 350 | // Is there a pending task for doing CacheStats. |
| 351 | bool cache_stats_task_pending_; |
| 352 | |
| 353 | // The count of RenderWidgets running through this thread. |
| 354 | int widget_count_; |
| 355 | |
| 356 | // The count of hidden RenderWidgets running through this thread. |
| 357 | int hidden_widget_count_; |
| 358 | |
| 359 | // The current value of the idle notification timer delay. |
| 360 | double idle_notification_delay_in_s_; |
| 361 | |
[email protected] | b2a74ca | 2010-03-12 17:57:09 | [diff] [blame] | 362 | // True if this renderer is incognito. |
| 363 | bool is_incognito_process_; |
| 364 | |
[email protected] | 80fc08c5 | 2010-03-09 07:43:50 | [diff] [blame] | 365 | bool suspend_webkit_shared_timer_; |
| 366 | bool notify_webkit_of_modal_loop_; |
[email protected] | c1f50aa | 2010-02-18 03:46:57 | [diff] [blame] | 367 | |
[email protected] | 71d6d85 | 2009-12-07 22:12:36 | [diff] [blame] | 368 | // Timer that periodically calls IdleHandler. |
| 369 | base::RepeatingTimer<RenderThread> idle_timer_; |
| 370 | |
[email protected] | 6217d39 | 2010-03-25 22:08:35 | [diff] [blame] | 371 | // The channel from the renderer process to the GPU process. |
| 372 | scoped_refptr<GpuChannelHost> gpu_channel_; |
| 373 | |
[email protected] | c6a7b86 | 2010-08-20 22:19:38 | [diff] [blame] | 374 | // A lazily initiated thread on which file operations are run. |
| 375 | scoped_ptr<base::Thread> file_thread_; |
| 376 | |
[email protected] | 6779aa1 | 2011-03-29 17:32:24 | [diff] [blame] | 377 | // Map of registered v8 extensions. The key is the extension name. |
| 378 | std::set<std::string> v8_extensions_; |
[email protected] | 2a521c5 | 2011-01-26 18:45:21 | [diff] [blame] | 379 | |
[email protected] | 53c607c | 2011-03-21 23:19:04 | [diff] [blame] | 380 | chrome::ChromeContentRendererClient renderer_client_; |
| 381 | |
[email protected] | 1223d6ef | 2011-03-28 16:47:50 | [diff] [blame] | 382 | ObserverList<RenderProcessObserver> observers_; |
| 383 | |
[email protected] | 1bc8306 | 2009-02-06 00:16:37 | [diff] [blame] | 384 | DISALLOW_COPY_AND_ASSIGN(RenderThread); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 385 | }; |
| 386 | |
[email protected] | 1d97d2e | 2008-12-18 23:39:02 | [diff] [blame] | 387 | #endif // CHROME_RENDERER_RENDER_THREAD_H_ |