| 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 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 | 118 |
| 119 AppCacheDispatcher* appcache_dispatcher() const { | 119 AppCacheDispatcher* appcache_dispatcher() const { |
| 120 return appcache_dispatcher_.get(); | 120 return appcache_dispatcher_.get(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 SocketStreamDispatcher* socket_stream_dispatcher() const { | 123 SocketStreamDispatcher* socket_stream_dispatcher() const { |
| 124 return socket_stream_dispatcher_.get(); | 124 return socket_stream_dispatcher_.get(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 #if defined(SPELLCHECKER_IN_RENDERER) | |
| 128 SpellCheck* spellchecker() const { | 127 SpellCheck* spellchecker() const { |
| 129 return spellchecker_.get(); | 128 return spellchecker_.get(); |
| 130 } | 129 } |
| 131 #endif | |
| 132 | 130 |
| 133 bool plugin_refresh_allowed() const { return plugin_refresh_allowed_; } | 131 bool plugin_refresh_allowed() const { return plugin_refresh_allowed_; } |
| 134 | 132 |
| 135 // Do DNS prefetch resolution of a hostname. | 133 // Do DNS prefetch resolution of a hostname. |
| 136 void Resolve(const char* name, size_t length); | 134 void Resolve(const char* name, size_t length); |
| 137 | 135 |
| 138 // Send all the Histogram data to browser. | 136 // Send all the Histogram data to browser. |
| 139 void SendHistograms(int sequence_number); | 137 void SendHistograms(int sequence_number); |
| 140 | 138 |
| 141 // Invokes InformHostOfCacheStats after a short delay. Used to move this | 139 // Invokes InformHostOfCacheStats after a short delay. Used to move this |
| 142 // bookkeeping operation off the critical latency path. | 140 // bookkeeping operation off the critical latency path. |
| 143 void InformHostOfCacheStatsLater(); | 141 void InformHostOfCacheStatsLater(); |
| 144 | 142 |
| 145 // Sends a message to the browser to close all idle connections. | 143 // Sends a message to the browser to close all idle connections. |
| 146 void CloseIdleConnections(); | 144 void CloseIdleConnections(); |
| 147 | 145 |
| 148 // Sends a message to the browser to enable or disable the disk cache. | 146 // Sends a message to the browser to enable or disable the disk cache. |
| 149 void SetCacheMode(bool enabled); | 147 void SetCacheMode(bool enabled); |
| 150 | 148 |
| 151 #if defined(SPELLCHECKER_IN_RENDERER) | |
| 152 // Send a message to the browser to request a spellcheck dictionary. | |
| 153 void RequestSpellCheckDictionary(); | |
| 154 #endif | |
| 155 | |
| 156 private: | 149 private: |
| 157 virtual void OnControlMessageReceived(const IPC::Message& msg); | 150 virtual void OnControlMessageReceived(const IPC::Message& msg); |
| 158 | 151 |
| 159 void Init(); | 152 void Init(); |
| 160 | 153 |
| 161 void OnUpdateVisitedLinks(base::SharedMemoryHandle table); | 154 void OnUpdateVisitedLinks(base::SharedMemoryHandle table); |
| 162 void OnAddVisitedLinks(const VisitedLinkSlave::Fingerprints& fingerprints); | 155 void OnAddVisitedLinks(const VisitedLinkSlave::Fingerprints& fingerprints); |
| 163 void OnResetVisitedLinks(); | 156 void OnResetVisitedLinks(); |
| 164 | 157 |
| 165 void OnUpdateUserScripts(base::SharedMemoryHandle table); | 158 void OnUpdateUserScripts(base::SharedMemoryHandle table); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 193 | 186 |
| 194 // Send tcmalloc info to browser. | 187 // Send tcmalloc info to browser. |
| 195 void OnGetRendererTcmalloc(); | 188 void OnGetRendererTcmalloc(); |
| 196 void OnGetV8HeapStats(); | 189 void OnGetV8HeapStats(); |
| 197 | 190 |
| 198 void OnExtensionMessageInvoke(const std::string& function_name, | 191 void OnExtensionMessageInvoke(const std::string& function_name, |
| 199 const ListValue& args); | 192 const ListValue& args); |
| 200 void OnPurgeMemory(); | 193 void OnPurgeMemory(); |
| 201 void OnPurgePluginListCache(bool reload_pages); | 194 void OnPurgePluginListCache(bool reload_pages); |
| 202 | 195 |
| 203 #if defined(SPELLCHECKER_IN_RENDERER) | |
| 204 void OnInitSpellChecker(IPC::PlatformFileForTransit bdict_file, | 196 void OnInitSpellChecker(IPC::PlatformFileForTransit bdict_file, |
| 205 const std::vector<std::string>& custom_words, | 197 const std::vector<std::string>& custom_words, |
| 206 const std::string& language, | 198 const std::string& language, |
| 207 bool auto_spell_correct); | 199 bool auto_spell_correct); |
| 208 void OnSpellCheckWordAdded(const std::string& word); | 200 void OnSpellCheckWordAdded(const std::string& word); |
| 209 void OnSpellCheckEnableAutoSpellCorrect(bool enable); | 201 void OnSpellCheckEnableAutoSpellCorrect(bool enable); |
| 210 #endif | |
| 211 | 202 |
| 212 // Gather usage statistics from the in-memory cache and inform our host. | 203 // Gather usage statistics from the in-memory cache and inform our host. |
| 213 // These functions should be call periodically so that the host can make | 204 // These functions should be call periodically so that the host can make |
| 214 // decisions about how to allocation resources using current information. | 205 // decisions about how to allocation resources using current information. |
| 215 void InformHostOfCacheStats(); | 206 void InformHostOfCacheStats(); |
| 216 | 207 |
| 217 // We initialize WebKit as late as possible. | 208 // We initialize WebKit as late as possible. |
| 218 void EnsureWebKitInitialized(); | 209 void EnsureWebKitInitialized(); |
| 219 | 210 |
| 220 // A task we invoke periodically to assist with idle cleanup. | 211 // A task we invoke periodically to assist with idle cleanup. |
| 221 void IdleHandler(); | 212 void IdleHandler(); |
| 222 | 213 |
| 223 // These objects live solely on the render thread. | 214 // These objects live solely on the render thread. |
| 224 scoped_ptr<ScopedRunnableMethodFactory<RenderThread> > task_factory_; | 215 scoped_ptr<ScopedRunnableMethodFactory<RenderThread> > task_factory_; |
| 225 scoped_ptr<VisitedLinkSlave> visited_link_slave_; | 216 scoped_ptr<VisitedLinkSlave> visited_link_slave_; |
| 226 scoped_ptr<UserScriptSlave> user_script_slave_; | 217 scoped_ptr<UserScriptSlave> user_script_slave_; |
| 227 scoped_ptr<RenderDnsMaster> dns_master_; | 218 scoped_ptr<RenderDnsMaster> dns_master_; |
| 228 scoped_ptr<AppCacheDispatcher> appcache_dispatcher_; | 219 scoped_ptr<AppCacheDispatcher> appcache_dispatcher_; |
| 229 scoped_refptr<DevToolsAgentFilter> devtools_agent_filter_; | 220 scoped_refptr<DevToolsAgentFilter> devtools_agent_filter_; |
| 230 scoped_ptr<RendererHistogramSnapshots> histogram_snapshots_; | 221 scoped_ptr<RendererHistogramSnapshots> histogram_snapshots_; |
| 231 scoped_ptr<RendererWebKitClientImpl> webkit_client_; | 222 scoped_ptr<RendererWebKitClientImpl> webkit_client_; |
| 232 scoped_ptr<WebKit::WebStorageEventDispatcher> dom_storage_event_dispatcher_; | 223 scoped_ptr<WebKit::WebStorageEventDispatcher> dom_storage_event_dispatcher_; |
| 233 scoped_ptr<SocketStreamDispatcher> socket_stream_dispatcher_; | 224 scoped_ptr<SocketStreamDispatcher> socket_stream_dispatcher_; |
| 234 scoped_ptr<RendererWebDatabaseObserver> renderer_web_database_observer_; | 225 scoped_ptr<RendererWebDatabaseObserver> renderer_web_database_observer_; |
| 235 #if defined(SPELLCHECKER_IN_RENDERER) | |
| 236 scoped_ptr<SpellCheck> spellchecker_; | 226 scoped_ptr<SpellCheck> spellchecker_; |
| 237 #endif | |
| 238 | 227 |
| 239 // Used on the renderer and IPC threads. | 228 // Used on the renderer and IPC threads. |
| 240 scoped_refptr<DBMessageFilter> db_message_filter_; | 229 scoped_refptr<DBMessageFilter> db_message_filter_; |
| 241 | 230 |
| 242 #if defined(OS_POSIX) | 231 #if defined(OS_POSIX) |
| 243 scoped_refptr<IPC::ChannelProxy::MessageFilter> | 232 scoped_refptr<IPC::ChannelProxy::MessageFilter> |
| 244 suicide_on_channel_error_filter_; | 233 suicide_on_channel_error_filter_; |
| 245 #endif | 234 #endif |
| 246 | 235 |
| 247 // If true, then a GetPlugins call is allowed to rescan the disk. | 236 // If true, then a GetPlugins call is allowed to rescan the disk. |
| 248 bool plugin_refresh_allowed_; | 237 bool plugin_refresh_allowed_; |
| 249 | 238 |
| 250 // Is there a pending task for doing CacheStats. | 239 // Is there a pending task for doing CacheStats. |
| 251 bool cache_stats_task_pending_; | 240 bool cache_stats_task_pending_; |
| 252 | 241 |
| 253 // The count of RenderWidgets running through this thread. | 242 // The count of RenderWidgets running through this thread. |
| 254 int widget_count_; | 243 int widget_count_; |
| 255 | 244 |
| 256 // The count of hidden RenderWidgets running through this thread. | 245 // The count of hidden RenderWidgets running through this thread. |
| 257 int hidden_widget_count_; | 246 int hidden_widget_count_; |
| 258 | 247 |
| 259 // The current value of the idle notification timer delay. | 248 // The current value of the idle notification timer delay. |
| 260 double idle_notification_delay_in_s_; | 249 double idle_notification_delay_in_s_; |
| 261 | 250 |
| 262 DISALLOW_COPY_AND_ASSIGN(RenderThread); | 251 DISALLOW_COPY_AND_ASSIGN(RenderThread); |
| 263 }; | 252 }; |
| 264 | 253 |
| 265 #endif // CHROME_RENDERER_RENDER_THREAD_H_ | 254 #endif // CHROME_RENDERER_RENDER_THREAD_H_ |
| OLD | NEW |