blob: 1b4cd96e2299c70809f63cdd09d604b375a47ad8 [file] [log] [blame]
[email protected]45776222009-07-15 20:21:581// Copyright (c) 2009 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit09911bf2008-07-26 23:55:294
initial.commit09911bf2008-07-26 23:55:295#include "chrome/renderer/render_thread.h"
6
[email protected]38b48a82009-11-11 01:51:327#include <v8.h>
8
[email protected]da00a2882009-03-09 17:51:199#include <algorithm>
[email protected]75e126b932009-09-28 19:38:4910#include <map>
[email protected]da00a2882009-03-09 17:51:1911#include <vector>
12
[email protected]adf00bc2009-11-02 18:35:0013#if defined(USE_SYSTEM_SQLITE)
14#include <sqlite3.h>
15#else
16#include "third_party/sqlite/preprocessed/sqlite3.h"
17#endif
18
[email protected]06533c0b2009-03-05 21:39:1119#include "base/command_line.h"
[email protected]94f9a0f682009-06-15 18:30:3020#include "base/lazy_instance.h"
[email protected]bee16aab2009-08-26 15:55:0321#include "base/logging.h"
[email protected]b7c7bcf2009-10-03 07:07:3422#include "base/nullable_string16.h"
[email protected]d41041092009-10-08 06:56:5723#include "base/process_util.h"
initial.commit09911bf2008-07-26 23:55:2924#include "base/shared_memory.h"
[email protected]da00a2882009-03-09 17:51:1925#include "base/stats_table.h"
[email protected]b7c7bcf2009-10-03 07:07:3426#include "base/string_util.h"
[email protected]94f9a0f682009-06-15 18:30:3027#include "base/thread_local.h"
[email protected]f430b5712009-08-21 21:46:3128#include "chrome/common/appcache/appcache_dispatcher.h"
[email protected]c8865962009-12-16 07:47:3929#include "chrome/common/child_process_logging.h"
[email protected]06533c0b2009-03-05 21:39:1130#include "chrome/common/chrome_switches.h"
[email protected]017022b2009-07-27 23:06:3431#include "chrome/common/db_message_filter.h"
[email protected]e09ba552009-02-05 03:26:2932#include "chrome/common/render_messages.h"
[email protected]9b6f40e2009-06-11 15:54:2633#include "chrome/common/renderer_preferences.h"
[email protected]90a3fbb12009-02-28 01:13:4734#include "chrome/common/url_constants.h"
[email protected]8930d472009-02-21 08:05:2835#include "chrome/plugin/npobject_util.h"
[email protected]2c62b562009-01-27 19:04:5036// TODO(port)
37#if defined(OS_WIN)
initial.commit09911bf2008-07-26 23:55:2938#include "chrome/plugin/plugin_channel.h"
[email protected]2c62b562009-01-27 19:04:5039#else
[email protected]2c62b562009-01-27 19:04:5040#include "base/scoped_handle.h"
41#include "chrome/plugin/plugin_channel_base.h"
[email protected]2c62b562009-01-27 19:04:5042#endif
[email protected]a8624712009-04-17 00:51:3543#include "chrome/renderer/devtools_agent_filter.h"
[email protected]ad1f9bd2009-07-30 20:23:1544#include "chrome/renderer/extension_groups.h"
[email protected]a40caa972009-04-08 18:35:3445#include "chrome/renderer/extensions/event_bindings.h"
[email protected]309d7a282009-03-24 09:18:2746#include "chrome/renderer/extensions/extension_process_bindings.h"
[email protected]be77f0a2009-08-25 08:31:1747#include "chrome/renderer/extensions/js_only_v8_extensions.h"
[email protected]0aa477bd2009-03-23 22:21:4348#include "chrome/renderer/extensions/renderer_extension_bindings.h"
[email protected]3c8e3702009-05-01 16:27:4249#include "chrome/renderer/external_extension.h"
[email protected]0bc46552009-04-07 21:56:4250#include "chrome/renderer/loadtimes_extension_bindings.h"
initial.commit09911bf2008-07-26 23:55:2951#include "chrome/renderer/net/render_dns_master.h"
52#include "chrome/renderer/render_process.h"
53#include "chrome/renderer/render_view.h"
[email protected]40bd6582009-12-04 23:49:5154#include "chrome/renderer/render_view_visitor.h"
[email protected]8d86fce2009-02-26 23:37:5555#include "chrome/renderer/renderer_webkitclient_impl.h"
[email protected]e2b2d4a2009-10-24 03:32:5956#include "chrome/renderer/renderer_web_database_observer.h"
[email protected]85c55dc2009-11-06 03:05:4657#include "chrome/renderer/spellchecker/spellcheck.h"
[email protected]0938d3c2009-01-09 20:37:3558#include "chrome/renderer/user_script_slave.h"
[email protected]d55aaa132009-09-28 21:08:0459#include "ipc/ipc_message.h"
[email protected]cb6037d2009-11-16 22:55:1760#include "ipc/ipc_platform_file.h"
[email protected]1b1f3eb2009-12-01 13:48:0461#include "third_party/tcmalloc/chromium/src/google/malloc_extension.h"
[email protected]418ed5ab2009-11-12 01:14:4962#include "third_party/WebKit/WebKit/chromium/public/WebCache.h"
63#include "third_party/WebKit/WebKit/chromium/public/WebColor.h"
64#include "third_party/WebKit/WebKit/chromium/public/WebCrossOriginPreflightResultCache.h"
65#include "third_party/WebKit/WebKit/chromium/public/WebDatabase.h"
66#include "third_party/WebKit/WebKit/chromium/public/WebFontCache.h"
[email protected]40bd6582009-12-04 23:49:5167#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
[email protected]418ed5ab2009-11-12 01:14:4968#include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
69#include "third_party/WebKit/WebKit/chromium/public/WebRuntimeFeatures.h"
70#include "third_party/WebKit/WebKit/chromium/public/WebScriptController.h"
71#include "third_party/WebKit/WebKit/chromium/public/WebSecurityPolicy.h"
72#include "third_party/WebKit/WebKit/chromium/public/WebStorageEventDispatcher.h"
73#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
[email protected]b07f29092009-06-05 07:33:2174#include "webkit/extensions/v8/benchmarking_extension.h"
[email protected]06533c0b2009-03-05 21:39:1175#include "webkit/extensions/v8/gears_extension.h"
76#include "webkit/extensions/v8/interval_extension.h"
77#include "webkit/extensions/v8/playback_extension.h"
[email protected]2c62b562009-01-27 19:04:5078
[email protected]da00a2882009-03-09 17:51:1979#if defined(OS_WIN)
80#include <windows.h>
81#include <objbase.h>
82#endif
83
[email protected]fe819f52009-12-15 07:58:1184#if defined(OS_MACOSX)
85#include "chrome/app/breakpad_mac.h"
86#endif
87
[email protected]2c434b32009-03-19 06:27:4788using WebKit::WebCache;
[email protected]fede6ca12009-10-08 18:24:2689using WebKit::WebCrossOriginPreflightResultCache;
90using WebKit::WebFontCache;
[email protected]adf00bc2009-11-02 18:35:0091using WebKit::WebRuntimeFeatures;
[email protected]204758c2009-10-22 03:56:3092using WebKit::WebSecurityPolicy;
[email protected]98d7127b2009-10-23 18:26:5193using WebKit::WebScriptController;
[email protected]2c434b32009-03-19 06:27:4794using WebKit::WebString;
[email protected]b7c7bcf2009-10-03 07:07:3495using WebKit::WebStorageEventDispatcher;
[email protected]50ae00ef2009-10-19 05:11:0396using WebKit::WebView;
initial.commit09911bf2008-07-26 23:55:2997
[email protected]42f1d7822009-07-23 18:17:5598namespace {
[email protected]2c434b32009-03-19 06:27:4799static const unsigned int kCacheStatsDelayMS = 2000 /* milliseconds */;
[email protected]bee16aab2009-08-26 15:55:03100static const double kInitialIdleHandlerDelayS = 1.0 /* seconds */;
[email protected]71d6d852009-12-07 22:12:36101static const double kInitialExtensionIdleHandlerDelayS = 5.0 /* seconds */;
102static const int64 kMaxExtensionIdleHandlerDelayS = 5*60 /* seconds */;
[email protected]bee16aab2009-08-26 15:55:03103
[email protected]94f9a0f682009-06-15 18:30:30104static base::LazyInstance<base::ThreadLocalPointer<RenderThread> > lazy_tls(
105 base::LINKER_INITIALIZED);
[email protected]1edc16b82009-04-07 17:45:54106
[email protected]5fa1c542009-05-05 20:36:07107#if defined(OS_POSIX)
108class SuicideOnChannelErrorFilter : public IPC::ChannelProxy::MessageFilter {
109 void OnChannelError() {
110 // On POSIX, at least, one can install an unload handler which loops
111 // forever and leave behind a renderer process which eats 100% CPU forever.
112 //
113 // This is because the terminate signals (ViewMsg_ShouldClose and the error
114 // from the IPC channel) are routed to the main message loop but never
115 // processed (because that message loop is stuck in V8).
116 //
117 // One could make the browser SIGKILL the renderers, but that leaves open a
118 // large window where a browser failure (or a user, manually terminating
119 // the browser because "it's stuck") will leave behind a process eating all
120 // the CPU.
121 //
122 // So, we install a filter on the channel so that we can process this event
123 // here and kill the process.
[email protected]fe819f52009-12-15 07:58:11124
125#if defined(OS_MACOSX)
126 // TODO(viettrungluu): crbug.com/28547: The following is needed, as a
127 // stopgap, to avoid leaking due to not releasing Breakpad properly.
128 // TODO(viettrungluu): Investigate why this is being called.
129 if (IsCrashReporterEnabled()) {
130 LOG(INFO) << "Cleaning up Breakpad.";
131 DestructCrashReporter();
132 } else {
133 LOG(INFO) << "Breakpad not enabled; no clean-up needed.";
134 }
135#endif // OS_MACOSX
136
[email protected]5fa1c542009-05-05 20:36:07137 _exit(0);
138 }
139};
140#endif
[email protected]40bd6582009-12-04 23:49:51141
142class RenderViewZoomer : public RenderViewVisitor {
143 public:
144 RenderViewZoomer(const std::string& host, int zoom_level)
145 : host_(host),
146 zoom_level_(zoom_level) {
147 }
148
149 virtual bool Visit(RenderView* render_view) {
150 WebView* webview = render_view->webview(); // Guaranteed non-NULL.
151 if (GURL(webview->mainFrame()->url()).host() == host_)
152 webview->setZoomLevel(false, zoom_level_);
153 return true;
154 }
155
156 private:
157 std::string host_;
158 int zoom_level_;
159
160 DISALLOW_COPY_AND_ASSIGN(RenderViewZoomer);
161};
[email protected]42f1d7822009-07-23 18:17:55162} // namespace
163
164// When we run plugins in process, we actually run them on the render thread,
165// which means that we need to make the render thread pump UI events.
166RenderThread::RenderThread() {
167 Init();
168}
169
170RenderThread::RenderThread(const std::string& channel_name)
171 : ChildThread(channel_name) {
172 Init();
173}
[email protected]5fa1c542009-05-05 20:36:07174
initial.commit09911bf2008-07-26 23:55:29175void RenderThread::Init() {
[email protected]94f9a0f682009-06-15 18:30:30176 lazy_tls.Pointer()->Set(this);
[email protected]2c62b562009-01-27 19:04:50177#if defined(OS_WIN)
[email protected]bdef78b52009-04-16 19:31:34178 // If you are running plugins in this thread you need COM active but in
179 // the normal case you don't.
180 if (RenderProcess::InProcessPlugins())
181 CoInitialize(0);
[email protected]2c62b562009-01-27 19:04:50182#endif
initial.commit09911bf2008-07-26 23:55:29183
[email protected]71d6d852009-12-07 22:12:36184 std::string type_str = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
185 switches::kProcessType);
186 is_extension_process_ = type_str == switches::kExtensionProcess;
[email protected]42f1d7822009-07-23 18:17:55187 plugin_refresh_allowed_ = true;
[email protected]bee16aab2009-08-26 15:55:03188 cache_stats_task_pending_ = false;
189 widget_count_ = 0;
190 hidden_widget_count_ = 0;
[email protected]71d6d852009-12-07 22:12:36191 idle_notification_delay_in_s_ = is_extension_process_ ?
192 kInitialExtensionIdleHandlerDelayS : kInitialIdleHandlerDelayS;
[email protected]bee16aab2009-08-26 15:55:03193 task_factory_.reset(new ScopedRunnableMethodFactory<RenderThread>(this));
[email protected]8d86fce2009-02-26 23:37:55194
[email protected]8d86fce2009-02-26 23:37:55195 visited_link_slave_.reset(new VisitedLinkSlave());
196 user_script_slave_.reset(new UserScriptSlave());
197 dns_master_.reset(new RenderDnsMaster());
198 histogram_snapshots_.reset(new RendererHistogramSnapshots());
[email protected]f430b5712009-08-21 21:46:31199 appcache_dispatcher_.reset(new AppCacheDispatcher(this));
[email protected]a8624712009-04-17 00:51:35200 devtools_agent_filter_ = new DevToolsAgentFilter();
201 AddFilter(devtools_agent_filter_.get());
[email protected]017022b2009-07-27 23:06:34202 db_message_filter_ = new DBMessageFilter();
203 AddFilter(db_message_filter_.get());
[email protected]85c55dc2009-11-06 03:05:46204 spellchecker_.reset(new SpellCheck());
[email protected]5fa1c542009-05-05 20:36:07205
206#if defined(OS_POSIX)
207 suicide_on_channel_error_filter_ = new SuicideOnChannelErrorFilter;
208 AddFilter(suicide_on_channel_error_filter_.get());
209#endif
initial.commit09911bf2008-07-26 23:55:29210}
211
[email protected]42f1d7822009-07-23 18:17:55212RenderThread::~RenderThread() {
[email protected]8d86fce2009-02-26 23:37:55213 // Shutdown in reverse of the initialization order.
[email protected]a8624712009-04-17 00:51:35214 RemoveFilter(devtools_agent_filter_.get());
[email protected]017022b2009-07-27 23:06:34215 RemoveFilter(db_message_filter_.get());
216 db_message_filter_ = NULL;
[email protected]42f1d7822009-07-23 18:17:55217 if (webkit_client_.get())
[email protected]9291ed12009-07-23 17:33:22218 WebKit::shutdown();
[email protected]9291ed12009-07-23 17:33:22219
[email protected]94f9a0f682009-06-15 18:30:30220 lazy_tls.Pointer()->Set(NULL);
[email protected]8fd8de92008-08-12 23:50:30221
[email protected]8d86fce2009-02-26 23:37:55222 // TODO(port)
[email protected]2c62b562009-01-27 19:04:50223#if defined(OS_WIN)
initial.commit09911bf2008-07-26 23:55:29224 // Clean up plugin channels before this thread goes away.
225 PluginChannelBase::CleanupChannels();
[email protected]bdef78b52009-04-16 19:31:34226 // Don't call COM if the renderer is in the sandbox.
227 if (RenderProcess::InProcessPlugins())
228 CoUninitialize();
[email protected]2c62b562009-01-27 19:04:50229#endif
initial.commit09911bf2008-07-26 23:55:29230}
231
[email protected]42f1d7822009-07-23 18:17:55232RenderThread* RenderThread::current() {
233 return lazy_tls.Pointer()->Get();
234}
235
236void RenderThread::AddFilter(IPC::ChannelProxy::MessageFilter* filter) {
237 channel()->AddFilter(filter);
238}
239
240void RenderThread::RemoveFilter(IPC::ChannelProxy::MessageFilter* filter) {
241 channel()->RemoveFilter(filter);
242}
243
[email protected]bee16aab2009-08-26 15:55:03244void RenderThread::WidgetHidden() {
245 DCHECK(hidden_widget_count_ < widget_count_);
[email protected]4a3dab22009-11-11 17:36:50246 hidden_widget_count_++;
[email protected]71d6d852009-12-07 22:12:36247 if (!is_extension_process() &&
248 widget_count_ && hidden_widget_count_ == widget_count_)
249 ScheduleIdleHandler(kInitialIdleHandlerDelayS);
[email protected]bee16aab2009-08-26 15:55:03250}
251
252void RenderThread::WidgetRestored() {
253 DCHECK(hidden_widget_count_ > 0);
254 hidden_widget_count_--;
[email protected]71d6d852009-12-07 22:12:36255 if (!is_extension_process())
256 idle_timer_.Stop();
[email protected]bee16aab2009-08-26 15:55:03257}
258
[email protected]42f1d7822009-07-23 18:17:55259void RenderThread::Resolve(const char* name, size_t length) {
260 return dns_master_->Resolve(name, length);
261}
262
263void RenderThread::SendHistograms(int sequence_number) {
264 return histogram_snapshots_->SendHistograms(sequence_number);
265}
266
[email protected]176aa482008-11-14 03:25:15267void RenderThread::OnUpdateVisitedLinks(base::SharedMemoryHandle table) {
[email protected]5fe733de2009-02-11 18:59:20268 DCHECK(base::SharedMemory::IsHandleValid(table)) << "Bad table handle";
initial.commit09911bf2008-07-26 23:55:29269 visited_link_slave_->Init(table);
270}
271
[email protected]3e90d4a2009-07-03 17:38:39272void RenderThread::OnAddVisitedLinks(
273 const VisitedLinkSlave::Fingerprints& fingerprints) {
274 for (size_t i = 0; i < fingerprints.size(); ++i)
[email protected]50ae00ef2009-10-19 05:11:03275 WebView::updateVisitedLinkState(fingerprints[i]);
[email protected]3e90d4a2009-07-03 17:38:39276}
277
278void RenderThread::OnResetVisitedLinks() {
[email protected]50ae00ef2009-10-19 05:11:03279 WebView::resetVisitedLinkState();
[email protected]3e90d4a2009-07-03 17:38:39280}
281
[email protected]40bd6582009-12-04 23:49:51282void RenderThread::OnSetZoomLevelForCurrentHost(const std::string& host,
283 int zoom_level) {
284 RenderViewZoomer zoomer(host, zoom_level);
285 RenderView::ForEach(&zoomer);
286}
287
[email protected]0938d3c2009-01-09 20:37:35288void RenderThread::OnUpdateUserScripts(
[email protected]176aa482008-11-14 03:25:15289 base::SharedMemoryHandle scripts) {
[email protected]5fe733de2009-02-11 18:59:20290 DCHECK(base::SharedMemory::IsHandleValid(scripts)) << "Bad scripts handle";
[email protected]0938d3c2009-01-09 20:37:35291 user_script_slave_->UpdateScripts(scripts);
[email protected]c8865962009-12-16 07:47:39292 UpdateActiveExtensions();
[email protected]1e0f70402008-10-16 23:57:47293}
294
[email protected]703e807a2009-03-28 19:56:51295void RenderThread::OnSetExtensionFunctionNames(
296 const std::vector<std::string>& names) {
[email protected]a1a0df02009-04-09 08:18:04297 ExtensionProcessBindings::SetFunctionNames(names);
[email protected]703e807a2009-03-28 19:56:51298}
299
[email protected]45776222009-07-15 20:21:58300void RenderThread::OnPageActionsUpdated(
301 const std::string& extension_id,
302 const std::vector<std::string>& page_actions) {
303 ExtensionProcessBindings::SetPageActions(extension_id, page_actions);
304}
305
[email protected]cccf90932009-08-23 17:56:25306void RenderThread::OnExtensionSetAPIPermissions(
[email protected]35506352009-08-07 18:58:19307 const std::string& extension_id,
308 const std::vector<std::string>& permissions) {
[email protected]cccf90932009-08-23 17:56:25309 ExtensionProcessBindings::SetAPIPermissions(extension_id, permissions);
[email protected]71d6d852009-12-07 22:12:36310
311 // This is called when starting a new extension page, so start the idle
312 // handler ticking.
[email protected]71d6d852009-12-07 22:12:36313 ScheduleIdleHandler(kInitialExtensionIdleHandlerDelayS);
[email protected]c8865962009-12-16 07:47:39314
315 UpdateActiveExtensions();
[email protected]cccf90932009-08-23 17:56:25316}
317
318void RenderThread::OnExtensionSetHostPermissions(
319 const GURL& extension_url, const std::vector<URLPattern>& permissions) {
320 ExtensionProcessBindings::SetHostPermissions(extension_url, permissions);
[email protected]35506352009-08-07 18:58:19321}
322
[email protected]c61cc652009-11-04 05:44:40323void RenderThread::OnDOMStorageEvent(
324 const ViewMsg_DOMStorageEvent_Params& params) {
325 if (!dom_storage_event_dispatcher_.get())
[email protected]b7c7bcf2009-10-03 07:07:34326 dom_storage_event_dispatcher_.reset(WebStorageEventDispatcher::create());
[email protected]c61cc652009-11-04 05:44:40327 dom_storage_event_dispatcher_->dispatchStorageEvent(params.key_,
[email protected]ee2be5b32009-11-05 09:13:12328 params.old_value_, params.new_value_, params.origin_, params.url_,
[email protected]c61cc652009-11-04 05:44:40329 params.storage_type_ == DOM_STORAGE_LOCAL);
[email protected]b7c7bcf2009-10-03 07:07:34330}
331
[email protected]8930d472009-02-21 08:05:28332void RenderThread::OnControlMessageReceived(const IPC::Message& msg) {
[email protected]1edc16b82009-04-07 17:45:54333 // App cache messages are handled by a delegate.
[email protected]f430b5712009-08-21 21:46:31334 if (appcache_dispatcher_->OnMessageReceived(msg))
[email protected]1edc16b82009-04-07 17:45:54335 return;
336
[email protected]8930d472009-02-21 08:05:28337 IPC_BEGIN_MESSAGE_MAP(RenderThread, msg)
338 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_NewTable, OnUpdateVisitedLinks)
[email protected]3e90d4a2009-07-03 17:38:39339 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_Add, OnAddVisitedLinks)
340 IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_Reset, OnResetVisitedLinks)
[email protected]40bd6582009-12-04 23:49:51341 IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForCurrentHost,
342 OnSetZoomLevelForCurrentHost)
[email protected]8930d472009-02-21 08:05:28343 IPC_MESSAGE_HANDLER(ViewMsg_SetNextPageID, OnSetNextPageID)
[email protected]b9ab10c2009-08-07 18:09:55344 IPC_MESSAGE_HANDLER(ViewMsg_SetCSSColors, OnSetCSSColors)
[email protected]8930d472009-02-21 08:05:28345 // TODO(port): removed from render_messages_internal.h;
346 // is there a new non-windows message I should add here?
347 IPC_MESSAGE_HANDLER(ViewMsg_New, OnCreateNewView)
348 IPC_MESSAGE_HANDLER(ViewMsg_SetCacheCapacities, OnSetCacheCapacities)
[email protected]55e57d42009-02-25 06:10:17349 IPC_MESSAGE_HANDLER(ViewMsg_GetRendererHistograms,
[email protected]c9a3ef82009-05-28 22:02:46350 OnGetRendererHistograms)
[email protected]d41041092009-10-08 06:56:57351#if defined(USE_TCMALLOC)
352 IPC_MESSAGE_HANDLER(ViewMsg_GetRendererTcmalloc,
353 OnGetRendererTcmalloc)
354#endif
[email protected]38b48a82009-11-11 01:51:32355 IPC_MESSAGE_HANDLER(ViewMsg_GetV8HeapStats, OnGetV8HeapStats)
[email protected]8930d472009-02-21 08:05:28356 IPC_MESSAGE_HANDLER(ViewMsg_GetCacheResourceStats,
357 OnGetCacheResourceStats)
[email protected]2f2243e2009-05-26 02:27:02358 IPC_MESSAGE_HANDLER(ViewMsg_UserScripts_UpdatedScripts,
[email protected]8930d472009-02-21 08:05:28359 OnUpdateUserScripts)
[email protected]b68d5ed2009-04-16 02:41:28360 // TODO(rafaelw): create an ExtensionDispatcher that handles extension
361 // messages seperates their handling from the RenderThread.
[email protected]dfcb62a2009-06-17 19:32:43362 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionMessageInvoke,
363 OnExtensionMessageInvoke)
[email protected]703e807a2009-03-28 19:56:51364 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetFunctionNames,
365 OnSetExtensionFunctionNames)
[email protected]fede6ca12009-10-08 18:24:26366 IPC_MESSAGE_HANDLER(ViewMsg_PurgeMemory, OnPurgeMemory)
[email protected]b547fd42009-04-23 23:16:27367 IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache,
368 OnPurgePluginListCache)
[email protected]45776222009-07-15 20:21:58369 IPC_MESSAGE_HANDLER(ViewMsg_Extension_UpdatePageActions,
370 OnPageActionsUpdated)
[email protected]cccf90932009-08-23 17:56:25371 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetAPIPermissions,
372 OnExtensionSetAPIPermissions)
373 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetHostPermissions,
374 OnExtensionSetHostPermissions)
[email protected]b7c7bcf2009-10-03 07:07:34375 IPC_MESSAGE_HANDLER(ViewMsg_DOMStorageEvent,
376 OnDOMStorageEvent)
[email protected]d55aaa132009-09-28 21:08:04377#if defined(IPC_MESSAGE_LOG_ENABLED)
[email protected]12636df2009-09-28 22:32:21378 IPC_MESSAGE_HANDLER(ViewMsg_SetIPCLoggingEnabled,
[email protected]d55aaa132009-09-28 21:08:04379 OnSetIPCLoggingEnabled)
380#endif
[email protected]85c55dc2009-11-06 03:05:46381 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_Init,
382 OnInitSpellChecker)
383 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_WordAdded,
384 OnSpellCheckWordAdded)
385 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_EnableAutoSpellCorrect,
386 OnSpellCheckEnableAutoSpellCorrect)
[email protected]8930d472009-02-21 08:05:28387 IPC_END_MESSAGE_MAP()
initial.commit09911bf2008-07-26 23:55:29388}
389
390void RenderThread::OnSetNextPageID(int32 next_page_id) {
391 // This should only be called at process initialization time, so we shouldn't
392 // have to worry about thread-safety.
393 RenderView::SetNextPageID(next_page_id);
394}
395
[email protected]b9ab10c2009-08-07 18:09:55396// Called when to register CSS Color name->system color mappings.
397// We update the colors one by one and then tell WebKit to refresh all render
398// views.
399void RenderThread::OnSetCSSColors(
400 const std::vector<CSSColors::CSSColorMapping>& colors) {
[email protected]f5e4b9bf2009-10-08 00:59:59401 EnsureWebKitInitialized();
[email protected]b9ab10c2009-08-07 18:09:55402 size_t num_colors = colors.size();
403 scoped_array<WebKit::WebColorName> color_names(
404 new WebKit::WebColorName[num_colors]);
405 scoped_array<WebKit::WebColor> web_colors(new WebKit::WebColor[num_colors]);
406 size_t i = 0;
407 for (std::vector<CSSColors::CSSColorMapping>::const_iterator it =
408 colors.begin();
409 it != colors.end();
410 ++it, ++i) {
411 color_names[i] = it->first;
412 web_colors[i] = it->second;
413 }
414 WebKit::setNamedColors(color_names.get(), web_colors.get(), num_colors);
415}
416
[email protected]4e6419c2010-01-15 04:50:34417void RenderThread::OnCreateNewView(const ViewMsg_New_Params& params) {
[email protected]90a3fbb12009-02-28 01:13:47418 EnsureWebKitInitialized();
[email protected]be645db2009-02-06 20:36:33419 // When bringing in render_view, also bring in webkit's glue and jsbindings.
initial.commit09911bf2008-07-26 23:55:29420 RenderView::Create(
[email protected]4e6419c2010-01-15 04:50:34421 this, params.parent_window, MSG_ROUTING_NONE, params.renderer_preferences,
422 params.web_preferences, new SharedRenderViewCounter(0), params.view_id,
423 params.session_storage_namespace_id);
[email protected]7f874dec2009-02-06 01:48:27424}
[email protected]4274e582009-01-27 22:09:56425
initial.commit09911bf2008-07-26 23:55:29426void RenderThread::OnSetCacheCapacities(size_t min_dead_capacity,
427 size_t max_dead_capacity,
428 size_t capacity) {
[email protected]90a3fbb12009-02-28 01:13:47429 EnsureWebKitInitialized();
[email protected]2c434b32009-03-19 06:27:47430 WebCache::setCapacities(
431 min_dead_capacity, max_dead_capacity, capacity);
initial.commit09911bf2008-07-26 23:55:29432}
433
434void RenderThread::OnGetCacheResourceStats() {
[email protected]90a3fbb12009-02-28 01:13:47435 EnsureWebKitInitialized();
[email protected]2c434b32009-03-19 06:27:47436 WebCache::ResourceTypeStats stats;
437 WebCache::getResourceTypeStats(&stats);
initial.commit09911bf2008-07-26 23:55:29438 Send(new ViewHostMsg_ResourceTypeStats(stats));
439}
440
[email protected]c9a3ef82009-05-28 22:02:46441void RenderThread::OnGetRendererHistograms(int sequence_number) {
442 SendHistograms(sequence_number);
[email protected]55e57d42009-02-25 06:10:17443}
444
[email protected]d41041092009-10-08 06:56:57445#if defined(USE_TCMALLOC)
446void RenderThread::OnGetRendererTcmalloc() {
447 std::string result;
448 char buffer[1024 * 32];
[email protected]a4dc33f2009-10-20 15:09:55449 base::ProcessId pid = base::GetCurrentProcId();
[email protected]d41041092009-10-08 06:56:57450 MallocExtension::instance()->GetStats(buffer, sizeof(buffer));
451 result.append(buffer);
452 Send(new ViewHostMsg_RendererTcmalloc(pid, result));
453}
454#endif
455
[email protected]38b48a82009-11-11 01:51:32456void RenderThread::OnGetV8HeapStats() {
457 v8::HeapStatistics heap_stats;
458 v8::V8::GetHeapStatistics(&heap_stats);
459 Send(new ViewHostMsg_V8HeapStats(heap_stats.total_heap_size(),
460 heap_stats.used_heap_size()));
461}
462
initial.commit09911bf2008-07-26 23:55:29463void RenderThread::InformHostOfCacheStats() {
[email protected]90a3fbb12009-02-28 01:13:47464 EnsureWebKitInitialized();
[email protected]2c434b32009-03-19 06:27:47465 WebCache::UsageStats stats;
466 WebCache::getUsageStats(&stats);
initial.commit09911bf2008-07-26 23:55:29467 Send(new ViewHostMsg_UpdatedCacheStats(stats));
[email protected]bee16aab2009-08-26 15:55:03468 cache_stats_task_pending_ = false;
initial.commit09911bf2008-07-26 23:55:29469}
470
471void RenderThread::InformHostOfCacheStatsLater() {
472 // Rate limit informing the host of our cache stats.
[email protected]bee16aab2009-08-26 15:55:03473 if (cache_stats_task_pending_)
initial.commit09911bf2008-07-26 23:55:29474 return;
475
[email protected]bee16aab2009-08-26 15:55:03476 cache_stats_task_pending_ = true;
initial.commit09911bf2008-07-26 23:55:29477 MessageLoop::current()->PostDelayedTask(FROM_HERE,
[email protected]bee16aab2009-08-26 15:55:03478 task_factory_->NewRunnableMethod(
initial.commit09911bf2008-07-26 23:55:29479 &RenderThread::InformHostOfCacheStats),
480 kCacheStatsDelayMS);
481}
[email protected]90a3fbb12009-02-28 01:13:47482
[email protected]c40acc32010-01-14 01:02:53483void RenderThread::CloseCurrentConnections() {
484 Send(new ViewHostMsg_CloseCurrentConnections());
[email protected]b07f29092009-06-05 07:33:21485}
486
487void RenderThread::SetCacheMode(bool enabled) {
488 Send(new ViewHostMsg_SetCacheMode(enabled));
489}
490
[email protected]c8865962009-12-16 07:47:39491void RenderThread::UpdateActiveExtensions() {
492 // In single-process mode, the browser process reports the active extensions.
493 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess))
494 return;
495
496 std::set<std::string> active_extensions;
497 user_script_slave_->GetActiveExtensions(&active_extensions);
498 ExtensionProcessBindings::GetActiveExtensions(&active_extensions);
499 child_process_logging::SetActiveExtensions(active_extensions);
500}
501
[email protected]3df0c202009-03-31 23:51:26502static void* CreateHistogram(
503 const char *name, int min, int max, size_t buckets) {
[email protected]e8829a192009-12-06 00:09:37504 if (min <= 0)
505 min = 1;
[email protected]2753b392009-12-28 06:59:52506 scoped_refptr<Histogram> histogram = Histogram::FactoryGet(
507 name, min, max, buckets, Histogram::kUmaTargetedHistogramFlag);
[email protected]e8829a192009-12-06 00:09:37508 // We'll end up leaking these histograms, unless there is some code hiding in
509 // there to do the dec-ref.
[email protected]2753b392009-12-28 06:59:52510 // TODO(jar): Handle reference counting in webkit glue.
[email protected]e8829a192009-12-06 00:09:37511 histogram->AddRef();
512 return histogram.get();
[email protected]3df0c202009-03-31 23:51:26513}
514
515static void AddHistogramSample(void* hist, int sample) {
516 Histogram* histogram = static_cast<Histogram *>(hist);
517 histogram->Add(sample);
518}
519
[email protected]90a3fbb12009-02-28 01:13:47520void RenderThread::EnsureWebKitInitialized() {
521 if (webkit_client_.get())
522 return;
[email protected]da00a2882009-03-09 17:51:19523
[email protected]71d6d852009-12-07 22:12:36524 // For extensions, we want to ensure we call the IdleHandler every so often,
525 // even if the extension keeps up activity.
526 if (is_extension_process()) {
527 forced_idle_timer_.Start(
528 base::TimeDelta::FromSeconds(kMaxExtensionIdleHandlerDelayS),
529 this, &RenderThread::IdleHandler);
530 }
531
[email protected]da00a2882009-03-09 17:51:19532 v8::V8::SetCounterFunction(StatsTable::FindLocation);
[email protected]3df0c202009-03-31 23:51:26533 v8::V8::SetCreateHistogramFunction(CreateHistogram);
534 v8::V8::SetAddHistogramSampleFunction(AddHistogramSample);
[email protected]da00a2882009-03-09 17:51:19535
[email protected]90a3fbb12009-02-28 01:13:47536 webkit_client_.reset(new RendererWebKitClientImpl);
537 WebKit::initialize(webkit_client_.get());
[email protected]8881eca82009-03-12 18:20:44538
[email protected]98d7127b2009-10-23 18:26:51539 WebScriptController::enableV8SingleThreadMode();
[email protected]4ea00e82009-07-30 22:59:34540
[email protected]60e448982009-05-06 04:21:16541 // chrome: pages should not be accessible by normal content, and should
[email protected]8881eca82009-03-12 18:20:44542 // also be unable to script anything but themselves (to help limit the damage
[email protected]60e448982009-05-06 04:21:16543 // that a corrupt chrome: page could cause).
[email protected]2c434b32009-03-19 06:27:47544 WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme));
[email protected]204758c2009-10-22 03:56:30545 WebSecurityPolicy::registerURLSchemeAsLocal(chrome_ui_scheme);
546 WebSecurityPolicy::registerURLSchemeAsNoAccess(chrome_ui_scheme);
[email protected]da00a2882009-03-09 17:51:19547
[email protected]d53d8492009-07-14 01:51:32548 // print: pages should be not accessible by normal context.
549 WebString print_ui_scheme(ASCIIToUTF16(chrome::kPrintScheme));
[email protected]204758c2009-10-22 03:56:30550 WebSecurityPolicy::registerURLSchemeAsLocal(print_ui_scheme);
551 WebSecurityPolicy::registerURLSchemeAsNoAccess(print_ui_scheme);
[email protected]d53d8492009-07-14 01:51:32552
[email protected]6cf8b1a22009-05-26 23:36:00553#if defined(OS_WIN)
554 // We don't yet support Gears on non-Windows, so don't tell pages that we do.
[email protected]98d7127b2009-10-23 18:26:51555 WebScriptController::registerExtension(extensions_v8::GearsExtension::Get());
[email protected]6cf8b1a22009-05-26 23:36:00556#endif
[email protected]98d7127b2009-10-23 18:26:51557 WebScriptController::registerExtension(
558 extensions_v8::IntervalExtension::Get());
559 WebScriptController::registerExtension(
560 extensions_v8::LoadTimesExtension::Get());
561 WebScriptController::registerExtension(
562 extensions_v8::ExternalExtension::Get());
[email protected]309d7a282009-03-24 09:18:27563
[email protected]ad1f9bd2009-07-30 20:23:15564 const WebKit::WebString kExtensionScheme =
565 WebKit::WebString::fromUTF8(chrome::kExtensionScheme);
566
[email protected]98d7127b2009-10-23 18:26:51567 WebScriptController::registerExtension(
568 ExtensionProcessBindings::Get(), kExtensionScheme);
[email protected]ad1f9bd2009-07-30 20:23:15569
[email protected]98d7127b2009-10-23 18:26:51570 WebScriptController::registerExtension(
571 BaseJsV8Extension::Get(), EXTENSION_GROUP_CONTENT_SCRIPTS);
572 WebScriptController::registerExtension(
573 BaseJsV8Extension::Get(), kExtensionScheme);
574 WebScriptController::registerExtension(
575 JsonSchemaJsV8Extension::Get(), EXTENSION_GROUP_CONTENT_SCRIPTS);
576 WebScriptController::registerExtension(JsonSchemaJsV8Extension::Get(),
577 kExtensionScheme);
578 WebScriptController::registerExtension(
579 EventBindings::Get(), EXTENSION_GROUP_CONTENT_SCRIPTS);
580 WebScriptController::registerExtension(EventBindings::Get(),
581 kExtensionScheme);
582 WebScriptController::registerExtension(
583 RendererExtensionBindings::Get(), EXTENSION_GROUP_CONTENT_SCRIPTS);
584 WebScriptController::registerExtension(
585 RendererExtensionBindings::Get(), kExtensionScheme);
586 WebScriptController::registerExtension(
587 ExtensionApiTestV8Extension::Get(), kExtensionScheme);
588 WebScriptController::registerExtension(
589 ExtensionApiTestV8Extension::Get(), EXTENSION_GROUP_CONTENT_SCRIPTS);
[email protected]a1a0df02009-04-09 08:18:04590
[email protected]e2b2d4a2009-10-24 03:32:59591 renderer_web_database_observer_.reset(new RendererWebDatabaseObserver(this));
592 WebKit::WebDatabase::setObserver(renderer_web_database_observer_.get());
593
[email protected]06533c0b2009-03-05 21:39:11594 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
[email protected]a1a0df02009-04-09 08:18:04595
[email protected]98d7127b2009-10-23 18:26:51596 if (command_line.HasSwitch(switches::kEnableBenchmarking)) {
597 WebScriptController::registerExtension(
598 extensions_v8::BenchmarkingExtension::Get());
599 }
[email protected]b07f29092009-06-05 07:33:21600
[email protected]06533c0b2009-03-05 21:39:11601 if (command_line.HasSwitch(switches::kPlaybackMode) ||
[email protected]ca12c842009-04-14 22:20:18602 command_line.HasSwitch(switches::kRecordMode) ||
603 command_line.HasSwitch(switches::kNoJsRandomness)) {
[email protected]98d7127b2009-10-23 18:26:51604 WebScriptController::registerExtension(
605 extensions_v8::PlaybackExtension::Get());
[email protected]06533c0b2009-03-05 21:39:11606 }
[email protected]2cb82332009-03-18 17:24:55607
[email protected]b1b13212009-10-30 06:42:01608 WebRuntimeFeatures::enableMediaPlayer(
609 RenderProcess::current()->initialized_media_library());
[email protected]3553c6cc2009-10-20 05:51:55610
[email protected]b1b13212009-10-30 06:42:01611 WebRuntimeFeatures::enableSockets(
[email protected]cdf24782009-11-05 09:32:47612 !command_line.HasSwitch(switches::kDisableWebSockets));
[email protected]0afb9932009-10-24 00:37:58613
[email protected]b1b13212009-10-30 06:42:01614 WebRuntimeFeatures::enableDatabase(
[email protected]90a7ad522009-11-20 22:42:53615 !command_line.HasSwitch(switches::kDisableDatabases));
[email protected]bfa69d492009-10-31 03:27:19616
[email protected]13bc0d822009-11-07 01:17:14617 WebRuntimeFeatures::enableApplicationCache(
[email protected]425c270642010-01-26 20:42:37618 !command_line.HasSwitch(switches::kDisableApplicationCache));
[email protected]13bc0d822009-11-07 01:17:14619
[email protected]1a207072010-01-27 22:32:38620#if defined(OS_WIN) || defined(OS_LINUX)
[email protected]bfc815f2010-01-15 23:58:34621 // Notifications are supported on Windows and Linux only.
[email protected]bfa69d492009-10-31 03:27:19622 WebRuntimeFeatures::enableNotifications(
[email protected]380f1862009-11-14 02:48:01623 !command_line.HasSwitch(switches::kDisableDesktopNotifications));
[email protected]bfa69d492009-10-31 03:27:19624#endif
[email protected]7ee66e62009-11-05 09:16:30625
626 WebRuntimeFeatures::enableLocalStorage(
[email protected]5cf18362009-11-06 18:45:01627 !command_line.HasSwitch(switches::kDisableLocalStorage));
[email protected]7ee66e62009-11-05 09:16:30628 WebRuntimeFeatures::enableSessionStorage(
629 command_line.HasSwitch(switches::kEnableSessionStorage));
[email protected]2236bd1f2010-01-20 15:17:08630
631 WebRuntimeFeatures::enableGeolocation(
632 command_line.HasSwitch(switches::kEnableGeolocation));
[email protected]90a3fbb12009-02-28 01:13:47633}
[email protected]75e5a872009-04-02 23:56:11634
[email protected]bee16aab2009-08-26 15:55:03635void RenderThread::IdleHandler() {
[email protected]7e0d664a2009-12-03 21:07:47636#if defined(OS_WIN) && defined(USE_TCMALLOC)
[email protected]e94afbb92009-10-01 00:25:41637 MallocExtension::instance()->ReleaseFreeMemory();
[email protected]05001182009-09-15 23:34:22638#endif
[email protected]bee16aab2009-08-26 15:55:03639
[email protected]f5e4b9bf2009-10-08 00:59:59640 LOG(INFO) << "RenderThread calling v8 IdleNotification for " << this;
641 v8::V8::IdleNotification();
[email protected]05001182009-09-15 23:34:22642
643 // Schedule next invocation.
644 // Dampen the delay using the algorithm:
645 // delay = delay + 1 / (delay + 2)
646 // Using floor(delay) has a dampening effect such as:
647 // 1s, 1, 1, 2, 2, 2, 2, 3, 3, ...
648 // Note that idle_notification_delay_in_s_ would be reset to
649 // kInitialIdleHandlerDelayS in RenderThread::WidgetHidden.
[email protected]71d6d852009-12-07 22:12:36650 ScheduleIdleHandler(idle_notification_delay_in_s_ +
651 1.0 / (idle_notification_delay_in_s_ + 2.0));
652 if (is_extension_process()) {
653 // Dampen the forced delay as well if the extension stays idle for long
654 // periods of time.
655 int64 forced_delay_s =
656 std::max(static_cast<int64>(idle_notification_delay_in_s_),
657 kMaxExtensionIdleHandlerDelayS);
658 forced_idle_timer_.Stop();
659 forced_idle_timer_.Start(
660 base::TimeDelta::FromSeconds(forced_delay_s),
661 this, &RenderThread::IdleHandler);
662 }
663}
[email protected]05001182009-09-15 23:34:22664
[email protected]71d6d852009-12-07 22:12:36665void RenderThread::ScheduleIdleHandler(double initial_delay_s) {
666 idle_notification_delay_in_s_ = initial_delay_s;
667 idle_timer_.Stop();
668 idle_timer_.Start(
669 base::TimeDelta::FromSeconds(static_cast<int64>(initial_delay_s)),
670 this, &RenderThread::IdleHandler);
[email protected]bee16aab2009-08-26 15:55:03671}
672
[email protected]dfcb62a2009-06-17 19:32:43673void RenderThread::OnExtensionMessageInvoke(const std::string& function_name,
674 const ListValue& args) {
[email protected]7120f132009-07-20 21:05:37675 RendererExtensionBindings::Invoke(function_name, args, NULL);
[email protected]71d6d852009-12-07 22:12:36676
677 // Reset the idle handler each time there's any activity like event or message
678 // dispatch, for which Invoke is the chokepoint.
679 if (is_extension_process())
680 ScheduleIdleHandler(kInitialExtensionIdleHandlerDelayS);
[email protected]b68d5ed2009-04-16 02:41:28681}
[email protected]b547fd42009-04-23 23:16:27682
[email protected]fede6ca12009-10-08 18:24:26683void RenderThread::OnPurgeMemory() {
[email protected]85c55dc2009-11-06 03:05:46684 spellchecker_.reset(new SpellCheck());
[email protected]85c55dc2009-11-06 03:05:46685
[email protected]fede6ca12009-10-08 18:24:26686 EnsureWebKitInitialized();
687
688 // Clear the object cache (as much as possible; some live objects cannot be
689 // freed).
690 WebCache::clear();
691
692 // Clear the font/glyph cache.
693 WebFontCache::clear();
694
695 // Clear the Cross-Origin Preflight cache.
696 WebCrossOriginPreflightResultCache::clear();
697
[email protected]adf00bc2009-11-02 18:35:00698 // Release all freeable memory from the SQLite process-global page cache (a
699 // low-level object which backs the Connection-specific page caches).
[email protected]4a3dab22009-11-11 17:36:50700 while (sqlite3_release_memory(std::numeric_limits<int>::max()) > 0) {
701 }
[email protected]adf00bc2009-11-02 18:35:00702
[email protected]fede6ca12009-10-08 18:24:26703 // Repeatedly call the V8 idle notification until it returns true ("nothing
704 // more to free"). Note that it makes more sense to do this than to implement
705 // a new "delete everything" pass because object references make it difficult
706 // to free everything possible in just one pass.
[email protected]4a3dab22009-11-11 17:36:50707 while (!v8::V8::IdleNotification()) {
708 }
[email protected]fede6ca12009-10-08 18:24:26709
[email protected]7e0d664a2009-12-03 21:07:47710#if defined(OS_WIN) && defined(USE_TCMALLOC)
[email protected]fede6ca12009-10-08 18:24:26711 // Tell tcmalloc to release any free pages it's still holding.
712 MallocExtension::instance()->ReleaseFreeMemory();
713#endif
714}
715
[email protected]b78e168b2009-09-21 22:05:45716void RenderThread::OnPurgePluginListCache(bool reload_pages) {
[email protected]f5e4b9bf2009-10-08 00:59:59717 EnsureWebKitInitialized();
[email protected]b547fd42009-04-23 23:16:27718 // The call below will cause a GetPlugins call with refresh=true, but at this
719 // point we already know that the browser has refreshed its list, so disable
720 // refresh temporarily to prevent each renderer process causing the list to be
721 // regenerated.
722 plugin_refresh_allowed_ = false;
[email protected]b78e168b2009-09-21 22:05:45723 WebKit::resetPluginCache(reload_pages);
[email protected]b547fd42009-04-23 23:16:27724 plugin_refresh_allowed_ = true;
725}
[email protected]85c55dc2009-11-06 03:05:46726
[email protected]85c55dc2009-11-06 03:05:46727void RenderThread::OnInitSpellChecker(
[email protected]cb6037d2009-11-16 22:55:17728 IPC::PlatformFileForTransit bdict_file,
[email protected]85c55dc2009-11-06 03:05:46729 const std::vector<std::string>& custom_words,
730 const std::string& language,
731 bool auto_spell_correct) {
[email protected]cb6037d2009-11-16 22:55:17732 spellchecker_->Init(IPC::PlatformFileForTransitToPlatformFile(bdict_file),
733 custom_words, language);
[email protected]85c55dc2009-11-06 03:05:46734 spellchecker_->EnableAutoSpellCorrect(auto_spell_correct);
735}
736
737void RenderThread::OnSpellCheckWordAdded(const std::string& word) {
738 spellchecker_->WordAdded(word);
739}
740
741void RenderThread::OnSpellCheckEnableAutoSpellCorrect(bool enable) {
742 spellchecker_->EnableAutoSpellCorrect(enable);
743}