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