| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_RENDERER_RENDER_THREAD_H_ | 5 #ifndef CHROME_RENDERER_RENDER_THREAD_H_ |
| 6 #define CHROME_RENDERER_RENDER_THREAD_H_ | 6 #define CHROME_RENDERER_RENDER_THREAD_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "app/gfx/native_widget_types.h" | 11 #include "app/gfx/native_widget_types.h" |
| 12 #include "base/shared_memory.h" | 12 #include "base/shared_memory.h" |
| 13 #include "base/string16.h" |
| 13 #include "base/task.h" | 14 #include "base/task.h" |
| 14 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 15 #include "chrome/common/child_thread.h" | 16 #include "chrome/common/child_thread.h" |
| 16 #include "chrome/common/css_colors.h" | 17 #include "chrome/common/css_colors.h" |
| 17 #include "chrome/common/dom_storage_type.h" | 18 #include "chrome/common/dom_storage_type.h" |
| 18 #include "chrome/renderer/renderer_histogram_snapshots.h" | 19 #include "chrome/renderer/renderer_histogram_snapshots.h" |
| 19 #include "chrome/renderer/visitedlink_slave.h" | 20 #include "chrome/renderer/visitedlink_slave.h" |
| 20 | 21 |
| 21 class AppCacheDispatcher; | 22 class AppCacheDispatcher; |
| 22 class DBMessageFilter; | 23 class DBMessageFilter; |
| 23 class DevToolsAgentFilter; | 24 class DevToolsAgentFilter; |
| 24 class FilePath; | 25 class FilePath; |
| 25 class ListValue; | 26 class ListValue; |
| 26 class NullableString16; | 27 class NullableString16; |
| 27 class RenderDnsMaster; | 28 class RenderDnsMaster; |
| 28 class RendererHistogram; | 29 class RendererHistogram; |
| 29 class RendererWebDatabaseObserver; | 30 class RendererWebDatabaseObserver; |
| 30 class RendererWebKitClientImpl; | 31 class RendererWebKitClientImpl; |
| 32 class SpellCheck; |
| 31 class SkBitmap; | 33 class SkBitmap; |
| 32 class SocketStreamDispatcher; | 34 class SocketStreamDispatcher; |
| 33 class UserScriptSlave; | 35 class UserScriptSlave; |
| 34 class URLPattern; | 36 class URLPattern; |
| 35 | 37 |
| 36 struct RendererPreferences; | 38 struct RendererPreferences; |
| 37 struct ViewMsg_DOMStorageEvent_Params; | 39 struct ViewMsg_DOMStorageEvent_Params; |
| 38 struct WebPreferences; | 40 struct WebPreferences; |
| 39 | 41 |
| 40 namespace WebKit { | 42 namespace WebKit { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 116 } |
| 115 | 117 |
| 116 AppCacheDispatcher* appcache_dispatcher() const { | 118 AppCacheDispatcher* appcache_dispatcher() const { |
| 117 return appcache_dispatcher_.get(); | 119 return appcache_dispatcher_.get(); |
| 118 } | 120 } |
| 119 | 121 |
| 120 SocketStreamDispatcher* socket_stream_dispatcher() const { | 122 SocketStreamDispatcher* socket_stream_dispatcher() const { |
| 121 return socket_stream_dispatcher_.get(); | 123 return socket_stream_dispatcher_.get(); |
| 122 } | 124 } |
| 123 | 125 |
| 126 #if defined(SPELLCHECKER_IN_RENDERER) |
| 127 SpellCheck* spellchecker() const { |
| 128 return spellchecker_.get(); |
| 129 } |
| 130 #endif |
| 131 |
| 124 bool plugin_refresh_allowed() const { return plugin_refresh_allowed_; } | 132 bool plugin_refresh_allowed() const { return plugin_refresh_allowed_; } |
| 125 | 133 |
| 126 // Do DNS prefetch resolution of a hostname. | 134 // Do DNS prefetch resolution of a hostname. |
| 127 void Resolve(const char* name, size_t length); | 135 void Resolve(const char* name, size_t length); |
| 128 | 136 |
| 129 // Send all the Histogram data to browser. | 137 // Send all the Histogram data to browser. |
| 130 void SendHistograms(int sequence_number); | 138 void SendHistograms(int sequence_number); |
| 131 | 139 |
| 132 // Invokes InformHostOfCacheStats after a short delay. Used to move this | 140 // Invokes InformHostOfCacheStats after a short delay. Used to move this |
| 133 // bookkeeping operation off the critical latency path. | 141 // bookkeeping operation off the critical latency path. |
| 134 void InformHostOfCacheStatsLater(); | 142 void InformHostOfCacheStatsLater(); |
| 135 | 143 |
| 136 // Sends a message to the browser to close all idle connections. | 144 // Sends a message to the browser to close all idle connections. |
| 137 void CloseIdleConnections(); | 145 void CloseIdleConnections(); |
| 138 | 146 |
| 139 // Sends a message to the browser to enable or disable the disk cache. | 147 // Sends a message to the browser to enable or disable the disk cache. |
| 140 void SetCacheMode(bool enabled); | 148 void SetCacheMode(bool enabled); |
| 141 | 149 |
| 150 #if defined(SPELLCHECKER_IN_RENDERER) |
| 151 // Send a message to the browser to request a spellcheck dictionary. |
| 152 void RequestSpellCheckDictionary(); |
| 153 #endif |
| 154 |
| 142 private: | 155 private: |
| 143 virtual void OnControlMessageReceived(const IPC::Message& msg); | 156 virtual void OnControlMessageReceived(const IPC::Message& msg); |
| 144 | 157 |
| 145 void Init(); | 158 void Init(); |
| 146 | 159 |
| 147 void OnUpdateVisitedLinks(base::SharedMemoryHandle table); | 160 void OnUpdateVisitedLinks(base::SharedMemoryHandle table); |
| 148 void OnAddVisitedLinks(const VisitedLinkSlave::Fingerprints& fingerprints); | 161 void OnAddVisitedLinks(const VisitedLinkSlave::Fingerprints& fingerprints); |
| 149 void OnResetVisitedLinks(); | 162 void OnResetVisitedLinks(); |
| 150 | 163 |
| 151 void OnUpdateUserScripts(base::SharedMemoryHandle table); | 164 void OnUpdateUserScripts(base::SharedMemoryHandle table); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 178 void OnGetRendererHistograms(int sequence_number); | 191 void OnGetRendererHistograms(int sequence_number); |
| 179 | 192 |
| 180 // Send tcmalloc info to browser. | 193 // Send tcmalloc info to browser. |
| 181 void OnGetRendererTcmalloc(); | 194 void OnGetRendererTcmalloc(); |
| 182 | 195 |
| 183 void OnExtensionMessageInvoke(const std::string& function_name, | 196 void OnExtensionMessageInvoke(const std::string& function_name, |
| 184 const ListValue& args); | 197 const ListValue& args); |
| 185 void OnPurgeMemory(); | 198 void OnPurgeMemory(); |
| 186 void OnPurgePluginListCache(bool reload_pages); | 199 void OnPurgePluginListCache(bool reload_pages); |
| 187 | 200 |
| 201 #if defined(SPELLCHECKER_IN_RENDERER) |
| 202 void OnInitSpellChecker(const base::FileDescriptor& bdict_fd, |
| 203 const std::vector<std::string>& custom_words, |
| 204 const std::string& language, |
| 205 bool auto_spell_correct); |
| 206 void OnSpellCheckWordAdded(const std::string& word); |
| 207 void OnSpellCheckEnableAutoSpellCorrect(bool enable); |
| 208 #endif |
| 209 |
| 188 // Gather usage statistics from the in-memory cache and inform our host. | 210 // Gather usage statistics from the in-memory cache and inform our host. |
| 189 // These functions should be call periodically so that the host can make | 211 // These functions should be call periodically so that the host can make |
| 190 // decisions about how to allocation resources using current information. | 212 // decisions about how to allocation resources using current information. |
| 191 void InformHostOfCacheStats(); | 213 void InformHostOfCacheStats(); |
| 192 | 214 |
| 193 // We initialize WebKit as late as possible. | 215 // We initialize WebKit as late as possible. |
| 194 void EnsureWebKitInitialized(); | 216 void EnsureWebKitInitialized(); |
| 195 | 217 |
| 196 // A task we invoke periodically to assist with idle cleanup. | 218 // A task we invoke periodically to assist with idle cleanup. |
| 197 void IdleHandler(); | 219 void IdleHandler(); |
| 198 | 220 |
| 199 // These objects live solely on the render thread. | 221 // These objects live solely on the render thread. |
| 200 scoped_ptr<ScopedRunnableMethodFactory<RenderThread> > task_factory_; | 222 scoped_ptr<ScopedRunnableMethodFactory<RenderThread> > task_factory_; |
| 201 scoped_ptr<VisitedLinkSlave> visited_link_slave_; | 223 scoped_ptr<VisitedLinkSlave> visited_link_slave_; |
| 202 scoped_ptr<UserScriptSlave> user_script_slave_; | 224 scoped_ptr<UserScriptSlave> user_script_slave_; |
| 203 scoped_ptr<RenderDnsMaster> dns_master_; | 225 scoped_ptr<RenderDnsMaster> dns_master_; |
| 204 scoped_ptr<AppCacheDispatcher> appcache_dispatcher_; | 226 scoped_ptr<AppCacheDispatcher> appcache_dispatcher_; |
| 205 scoped_refptr<DevToolsAgentFilter> devtools_agent_filter_; | 227 scoped_refptr<DevToolsAgentFilter> devtools_agent_filter_; |
| 206 scoped_ptr<RendererHistogramSnapshots> histogram_snapshots_; | 228 scoped_ptr<RendererHistogramSnapshots> histogram_snapshots_; |
| 207 scoped_ptr<RendererWebKitClientImpl> webkit_client_; | 229 scoped_ptr<RendererWebKitClientImpl> webkit_client_; |
| 208 scoped_ptr<WebKit::WebStorageEventDispatcher> dom_storage_event_dispatcher_; | 230 scoped_ptr<WebKit::WebStorageEventDispatcher> dom_storage_event_dispatcher_; |
| 209 scoped_ptr<SocketStreamDispatcher> socket_stream_dispatcher_; | 231 scoped_ptr<SocketStreamDispatcher> socket_stream_dispatcher_; |
| 210 scoped_ptr<RendererWebDatabaseObserver> renderer_web_database_observer_; | 232 scoped_ptr<RendererWebDatabaseObserver> renderer_web_database_observer_; |
| 233 #if defined(SPELLCHECKER_IN_RENDERER) |
| 234 scoped_ptr<SpellCheck> spellchecker_; |
| 235 #endif |
| 211 | 236 |
| 212 // Used on the renderer and IPC threads. | 237 // Used on the renderer and IPC threads. |
| 213 scoped_refptr<DBMessageFilter> db_message_filter_; | 238 scoped_refptr<DBMessageFilter> db_message_filter_; |
| 214 | 239 |
| 215 #if defined(OS_POSIX) | 240 #if defined(OS_POSIX) |
| 216 scoped_refptr<IPC::ChannelProxy::MessageFilter> | 241 scoped_refptr<IPC::ChannelProxy::MessageFilter> |
| 217 suicide_on_channel_error_filter_; | 242 suicide_on_channel_error_filter_; |
| 218 #endif | 243 #endif |
| 219 | 244 |
| 220 // If true, then a GetPlugins call is allowed to rescan the disk. | 245 // If true, then a GetPlugins call is allowed to rescan the disk. |
| 221 bool plugin_refresh_allowed_; | 246 bool plugin_refresh_allowed_; |
| 222 | 247 |
| 223 // Is there a pending task for doing CacheStats. | 248 // Is there a pending task for doing CacheStats. |
| 224 bool cache_stats_task_pending_; | 249 bool cache_stats_task_pending_; |
| 225 | 250 |
| 226 // The count of RenderWidgets running through this thread. | 251 // The count of RenderWidgets running through this thread. |
| 227 int widget_count_; | 252 int widget_count_; |
| 228 | 253 |
| 229 // The count of hidden RenderWidgets running through this thread. | 254 // The count of hidden RenderWidgets running through this thread. |
| 230 int hidden_widget_count_; | 255 int hidden_widget_count_; |
| 231 | 256 |
| 232 // The current value of the idle notification timer delay. | 257 // The current value of the idle notification timer delay. |
| 233 double idle_notification_delay_in_s_; | 258 double idle_notification_delay_in_s_; |
| 234 | 259 |
| 235 DISALLOW_COPY_AND_ASSIGN(RenderThread); | 260 DISALLOW_COPY_AND_ASSIGN(RenderThread); |
| 236 }; | 261 }; |
| 237 | 262 |
| 238 #endif // CHROME_RENDERER_RENDER_THREAD_H_ | 263 #endif // CHROME_RENDERER_RENDER_THREAD_H_ |
| OLD | NEW |