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