blob: 0a5fe6a8d35bd6da4af7f29b2f348749a4f062e7 [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]18bcc3c2009-01-27 21:39:15417void RenderThread::OnCreateNewView(gfx::NativeViewId parent_hwnd,
[email protected]80d96fa2009-06-10 22:34:51418 const RendererPreferences& renderer_prefs,
initial.commit09911bf2008-07-26 23:55:29419 const WebPreferences& webkit_prefs,
420 int32 view_id) {
[email protected]90a3fbb12009-02-28 01:13:47421 EnsureWebKitInitialized();
[email protected]be645db2009-02-06 20:36:33422 // When bringing in render_view, also bring in webkit's glue and jsbindings.
initial.commit09911bf2008-07-26 23:55:29423 RenderView::Create(
[email protected]12636df2009-09-28 22:32:21424 this, parent_hwnd, MSG_ROUTING_NONE, renderer_prefs,
[email protected]80d96fa2009-06-10 22:34:51425 webkit_prefs, new SharedRenderViewCounter(0), view_id);
[email protected]7f874dec2009-02-06 01:48:27426}
[email protected]4274e582009-01-27 22:09:56427
initial.commit09911bf2008-07-26 23:55:29428void RenderThread::OnSetCacheCapacities(size_t min_dead_capacity,
429 size_t max_dead_capacity,
430 size_t capacity) {
[email protected]90a3fbb12009-02-28 01:13:47431 EnsureWebKitInitialized();
[email protected]2c434b32009-03-19 06:27:47432 WebCache::setCapacities(
433 min_dead_capacity, max_dead_capacity, capacity);
initial.commit09911bf2008-07-26 23:55:29434}
435
436void RenderThread::OnGetCacheResourceStats() {
[email protected]90a3fbb12009-02-28 01:13:47437 EnsureWebKitInitialized();
[email protected]2c434b32009-03-19 06:27:47438 WebCache::ResourceTypeStats stats;
439 WebCache::getResourceTypeStats(&stats);
initial.commit09911bf2008-07-26 23:55:29440 Send(new ViewHostMsg_ResourceTypeStats(stats));
441}
442
[email protected]c9a3ef82009-05-28 22:02:46443void RenderThread::OnGetRendererHistograms(int sequence_number) {
444 SendHistograms(sequence_number);
[email protected]55e57d42009-02-25 06:10:17445}
446
[email protected]d41041092009-10-08 06:56:57447#if defined(USE_TCMALLOC)
448void RenderThread::OnGetRendererTcmalloc() {
449 std::string result;
450 char buffer[1024 * 32];
[email protected]a4dc33f2009-10-20 15:09:55451 base::ProcessId pid = base::GetCurrentProcId();
[email protected]d41041092009-10-08 06:56:57452 MallocExtension::instance()->GetStats(buffer, sizeof(buffer));
453 result.append(buffer);
454 Send(new ViewHostMsg_RendererTcmalloc(pid, result));
455}
456#endif
457
[email protected]38b48a82009-11-11 01:51:32458void RenderThread::OnGetV8HeapStats() {
459 v8::HeapStatistics heap_stats;
460 v8::V8::GetHeapStatistics(&heap_stats);
461 Send(new ViewHostMsg_V8HeapStats(heap_stats.total_heap_size(),
462 heap_stats.used_heap_size()));
463}
464
initial.commit09911bf2008-07-26 23:55:29465void RenderThread::InformHostOfCacheStats() {
[email protected]90a3fbb12009-02-28 01:13:47466 EnsureWebKitInitialized();
[email protected]2c434b32009-03-19 06:27:47467 WebCache::UsageStats stats;
468 WebCache::getUsageStats(&stats);
initial.commit09911bf2008-07-26 23:55:29469 Send(new ViewHostMsg_UpdatedCacheStats(stats));
[email protected]bee16aab2009-08-26 15:55:03470 cache_stats_task_pending_ = false;
initial.commit09911bf2008-07-26 23:55:29471}
472
473void RenderThread::InformHostOfCacheStatsLater() {
474 // Rate limit informing the host of our cache stats.
[email protected]bee16aab2009-08-26 15:55:03475 if (cache_stats_task_pending_)
initial.commit09911bf2008-07-26 23:55:29476 return;
477
[email protected]bee16aab2009-08-26 15:55:03478 cache_stats_task_pending_ = true;
initial.commit09911bf2008-07-26 23:55:29479 MessageLoop::current()->PostDelayedTask(FROM_HERE,
[email protected]bee16aab2009-08-26 15:55:03480 task_factory_->NewRunnableMethod(
initial.commit09911bf2008-07-26 23:55:29481 &RenderThread::InformHostOfCacheStats),
482 kCacheStatsDelayMS);
483}
[email protected]90a3fbb12009-02-28 01:13:47484
[email protected]c40acc32010-01-14 01:02:53485void RenderThread::CloseCurrentConnections() {
486 Send(new ViewHostMsg_CloseCurrentConnections());
[email protected]b07f29092009-06-05 07:33:21487}
488
489void RenderThread::SetCacheMode(bool enabled) {
490 Send(new ViewHostMsg_SetCacheMode(enabled));
491}
492
[email protected]c8865962009-12-16 07:47:39493void RenderThread::UpdateActiveExtensions() {
494 // In single-process mode, the browser process reports the active extensions.
495 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess))
496 return;
497
498 std::set<std::string> active_extensions;
499 user_script_slave_->GetActiveExtensions(&active_extensions);
500 ExtensionProcessBindings::GetActiveExtensions(&active_extensions);
501 child_process_logging::SetActiveExtensions(active_extensions);
502}
503
[email protected]3df0c202009-03-31 23:51:26504static void* CreateHistogram(
505 const char *name, int min, int max, size_t buckets) {
[email protected]e8829a192009-12-06 00:09:37506 if (min <= 0)
507 min = 1;
[email protected]2753b392009-12-28 06:59:52508 scoped_refptr<Histogram> histogram = Histogram::FactoryGet(
509 name, min, max, buckets, Histogram::kUmaTargetedHistogramFlag);
[email protected]e8829a192009-12-06 00:09:37510 // We'll end up leaking these histograms, unless there is some code hiding in
511 // there to do the dec-ref.
[email protected]2753b392009-12-28 06:59:52512 // TODO(jar): Handle reference counting in webkit glue.
[email protected]e8829a192009-12-06 00:09:37513 histogram->AddRef();
514 return histogram.get();
[email protected]3df0c202009-03-31 23:51:26515}
516
517static void AddHistogramSample(void* hist, int sample) {
518 Histogram* histogram = static_cast<Histogram *>(hist);
519 histogram->Add(sample);
520}
521
[email protected]90a3fbb12009-02-28 01:13:47522void RenderThread::EnsureWebKitInitialized() {
523 if (webkit_client_.get())
524 return;
[email protected]da00a2882009-03-09 17:51:19525
[email protected]71d6d852009-12-07 22:12:36526 // For extensions, we want to ensure we call the IdleHandler every so often,
527 // even if the extension keeps up activity.
528 if (is_extension_process()) {
529 forced_idle_timer_.Start(
530 base::TimeDelta::FromSeconds(kMaxExtensionIdleHandlerDelayS),
531 this, &RenderThread::IdleHandler);
532 }
533
[email protected]da00a2882009-03-09 17:51:19534 v8::V8::SetCounterFunction(StatsTable::FindLocation);
[email protected]3df0c202009-03-31 23:51:26535 v8::V8::SetCreateHistogramFunction(CreateHistogram);
536 v8::V8::SetAddHistogramSampleFunction(AddHistogramSample);
[email protected]da00a2882009-03-09 17:51:19537
[email protected]90a3fbb12009-02-28 01:13:47538 webkit_client_.reset(new RendererWebKitClientImpl);
539 WebKit::initialize(webkit_client_.get());
[email protected]8881eca82009-03-12 18:20:44540
[email protected]98d7127b2009-10-23 18:26:51541 WebScriptController::enableV8SingleThreadMode();
[email protected]4ea00e82009-07-30 22:59:34542
[email protected]60e448982009-05-06 04:21:16543 // chrome: pages should not be accessible by normal content, and should
[email protected]8881eca82009-03-12 18:20:44544 // also be unable to script anything but themselves (to help limit the damage
[email protected]60e448982009-05-06 04:21:16545 // that a corrupt chrome: page could cause).
[email protected]2c434b32009-03-19 06:27:47546 WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme));
[email protected]204758c2009-10-22 03:56:30547 WebSecurityPolicy::registerURLSchemeAsLocal(chrome_ui_scheme);
548 WebSecurityPolicy::registerURLSchemeAsNoAccess(chrome_ui_scheme);
[email protected]da00a2882009-03-09 17:51:19549
[email protected]d53d8492009-07-14 01:51:32550 // print: pages should be not accessible by normal context.
551 WebString print_ui_scheme(ASCIIToUTF16(chrome::kPrintScheme));
[email protected]204758c2009-10-22 03:56:30552 WebSecurityPolicy::registerURLSchemeAsLocal(print_ui_scheme);
553 WebSecurityPolicy::registerURLSchemeAsNoAccess(print_ui_scheme);
[email protected]d53d8492009-07-14 01:51:32554
[email protected]6cf8b1a22009-05-26 23:36:00555#if defined(OS_WIN)
556 // We don't yet support Gears on non-Windows, so don't tell pages that we do.
[email protected]98d7127b2009-10-23 18:26:51557 WebScriptController::registerExtension(extensions_v8::GearsExtension::Get());
[email protected]6cf8b1a22009-05-26 23:36:00558#endif
[email protected]98d7127b2009-10-23 18:26:51559 WebScriptController::registerExtension(
560 extensions_v8::IntervalExtension::Get());
561 WebScriptController::registerExtension(
562 extensions_v8::LoadTimesExtension::Get());
563 WebScriptController::registerExtension(
564 extensions_v8::ExternalExtension::Get());
[email protected]309d7a282009-03-24 09:18:27565
[email protected]ad1f9bd2009-07-30 20:23:15566 const WebKit::WebString kExtensionScheme =
567 WebKit::WebString::fromUTF8(chrome::kExtensionScheme);
568
[email protected]98d7127b2009-10-23 18:26:51569 WebScriptController::registerExtension(
570 ExtensionProcessBindings::Get(), kExtensionScheme);
[email protected]ad1f9bd2009-07-30 20:23:15571
[email protected]98d7127b2009-10-23 18:26:51572 WebScriptController::registerExtension(
573 BaseJsV8Extension::Get(), EXTENSION_GROUP_CONTENT_SCRIPTS);
574 WebScriptController::registerExtension(
575 BaseJsV8Extension::Get(), kExtensionScheme);
576 WebScriptController::registerExtension(
577 JsonSchemaJsV8Extension::Get(), EXTENSION_GROUP_CONTENT_SCRIPTS);
578 WebScriptController::registerExtension(JsonSchemaJsV8Extension::Get(),
579 kExtensionScheme);
580 WebScriptController::registerExtension(
581 EventBindings::Get(), EXTENSION_GROUP_CONTENT_SCRIPTS);
582 WebScriptController::registerExtension(EventBindings::Get(),
583 kExtensionScheme);
584 WebScriptController::registerExtension(
585 RendererExtensionBindings::Get(), EXTENSION_GROUP_CONTENT_SCRIPTS);
586 WebScriptController::registerExtension(
587 RendererExtensionBindings::Get(), kExtensionScheme);
588 WebScriptController::registerExtension(
589 ExtensionApiTestV8Extension::Get(), kExtensionScheme);
590 WebScriptController::registerExtension(
591 ExtensionApiTestV8Extension::Get(), EXTENSION_GROUP_CONTENT_SCRIPTS);
[email protected]a1a0df02009-04-09 08:18:04592
[email protected]e2b2d4a2009-10-24 03:32:59593 renderer_web_database_observer_.reset(new RendererWebDatabaseObserver(this));
594 WebKit::WebDatabase::setObserver(renderer_web_database_observer_.get());
595
[email protected]06533c0b2009-03-05 21:39:11596 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
[email protected]a1a0df02009-04-09 08:18:04597
[email protected]98d7127b2009-10-23 18:26:51598 if (command_line.HasSwitch(switches::kEnableBenchmarking)) {
599 WebScriptController::registerExtension(
600 extensions_v8::BenchmarkingExtension::Get());
601 }
[email protected]b07f29092009-06-05 07:33:21602
[email protected]06533c0b2009-03-05 21:39:11603 if (command_line.HasSwitch(switches::kPlaybackMode) ||
[email protected]ca12c842009-04-14 22:20:18604 command_line.HasSwitch(switches::kRecordMode) ||
605 command_line.HasSwitch(switches::kNoJsRandomness)) {
[email protected]98d7127b2009-10-23 18:26:51606 WebScriptController::registerExtension(
607 extensions_v8::PlaybackExtension::Get());
[email protected]06533c0b2009-03-05 21:39:11608 }
[email protected]2cb82332009-03-18 17:24:55609
[email protected]b1b13212009-10-30 06:42:01610 WebRuntimeFeatures::enableMediaPlayer(
611 RenderProcess::current()->initialized_media_library());
[email protected]3553c6cc2009-10-20 05:51:55612
[email protected]b1b13212009-10-30 06:42:01613 WebRuntimeFeatures::enableSockets(
[email protected]cdf24782009-11-05 09:32:47614 !command_line.HasSwitch(switches::kDisableWebSockets));
[email protected]0afb9932009-10-24 00:37:58615
[email protected]b1b13212009-10-30 06:42:01616 WebRuntimeFeatures::enableDatabase(
[email protected]90a7ad522009-11-20 22:42:53617 !command_line.HasSwitch(switches::kDisableDatabases));
[email protected]bfa69d492009-10-31 03:27:19618
[email protected]13bc0d822009-11-07 01:17:14619 WebRuntimeFeatures::enableApplicationCache(
620 command_line.HasSwitch(switches::kEnableApplicationCache));
621
[email protected]bfa69d492009-10-31 03:27:19622#if defined(OS_WIN)
[email protected]380f1862009-11-14 02:48:01623 // We don't yet support notifications on non-Windows.
[email protected]bfa69d492009-10-31 03:27:19624 WebRuntimeFeatures::enableNotifications(
[email protected]380f1862009-11-14 02:48:01625 !command_line.HasSwitch(switches::kDisableDesktopNotifications));
[email protected]bfa69d492009-10-31 03:27:19626#endif
[email protected]7ee66e62009-11-05 09:16:30627
628 WebRuntimeFeatures::enableLocalStorage(
[email protected]5cf18362009-11-06 18:45:01629 !command_line.HasSwitch(switches::kDisableLocalStorage));
[email protected]7ee66e62009-11-05 09:16:30630 WebRuntimeFeatures::enableSessionStorage(
631 command_line.HasSwitch(switches::kEnableSessionStorage));
[email protected]90a3fbb12009-02-28 01:13:47632}
[email protected]75e5a872009-04-02 23:56:11633
[email protected]bee16aab2009-08-26 15:55:03634void RenderThread::IdleHandler() {
[email protected]7e0d664a2009-12-03 21:07:47635#if defined(OS_WIN) && defined(USE_TCMALLOC)
[email protected]e94afbb92009-10-01 00:25:41636 MallocExtension::instance()->ReleaseFreeMemory();
[email protected]05001182009-09-15 23:34:22637#endif
[email protected]bee16aab2009-08-26 15:55:03638
[email protected]f5e4b9bf2009-10-08 00:59:59639 LOG(INFO) << "RenderThread calling v8 IdleNotification for " << this;
640 v8::V8::IdleNotification();
[email protected]05001182009-09-15 23:34:22641
642 // Schedule next invocation.
643 // Dampen the delay using the algorithm:
644 // delay = delay + 1 / (delay + 2)
645 // Using floor(delay) has a dampening effect such as:
646 // 1s, 1, 1, 2, 2, 2, 2, 3, 3, ...
647 // Note that idle_notification_delay_in_s_ would be reset to
648 // kInitialIdleHandlerDelayS in RenderThread::WidgetHidden.
[email protected]71d6d852009-12-07 22:12:36649 ScheduleIdleHandler(idle_notification_delay_in_s_ +
650 1.0 / (idle_notification_delay_in_s_ + 2.0));
651 if (is_extension_process()) {
652 // Dampen the forced delay as well if the extension stays idle for long
653 // periods of time.
654 int64 forced_delay_s =
655 std::max(static_cast<int64>(idle_notification_delay_in_s_),
656 kMaxExtensionIdleHandlerDelayS);
657 forced_idle_timer_.Stop();
658 forced_idle_timer_.Start(
659 base::TimeDelta::FromSeconds(forced_delay_s),
660 this, &RenderThread::IdleHandler);
661 }
662}
[email protected]05001182009-09-15 23:34:22663
[email protected]71d6d852009-12-07 22:12:36664void RenderThread::ScheduleIdleHandler(double initial_delay_s) {
665 idle_notification_delay_in_s_ = initial_delay_s;
666 idle_timer_.Stop();
667 idle_timer_.Start(
668 base::TimeDelta::FromSeconds(static_cast<int64>(initial_delay_s)),
669 this, &RenderThread::IdleHandler);
[email protected]bee16aab2009-08-26 15:55:03670}
671
[email protected]dfcb62a2009-06-17 19:32:43672void RenderThread::OnExtensionMessageInvoke(const std::string& function_name,
673 const ListValue& args) {
[email protected]7120f132009-07-20 21:05:37674 RendererExtensionBindings::Invoke(function_name, args, NULL);
[email protected]71d6d852009-12-07 22:12:36675
676 // Reset the idle handler each time there's any activity like event or message
677 // dispatch, for which Invoke is the chokepoint.
678 if (is_extension_process())
679 ScheduleIdleHandler(kInitialExtensionIdleHandlerDelayS);
[email protected]b68d5ed2009-04-16 02:41:28680}
[email protected]b547fd42009-04-23 23:16:27681
[email protected]fede6ca12009-10-08 18:24:26682void RenderThread::OnPurgeMemory() {
[email protected]85c55dc2009-11-06 03:05:46683 spellchecker_.reset(new SpellCheck());
[email protected]85c55dc2009-11-06 03:05:46684
[email protected]fede6ca12009-10-08 18:24:26685 EnsureWebKitInitialized();
686
687 // Clear the object cache (as much as possible; some live objects cannot be
688 // freed).
689 WebCache::clear();
690
691 // Clear the font/glyph cache.
692 WebFontCache::clear();
693
694 // Clear the Cross-Origin Preflight cache.
695 WebCrossOriginPreflightResultCache::clear();
696
[email protected]adf00bc2009-11-02 18:35:00697 // Release all freeable memory from the SQLite process-global page cache (a
698 // low-level object which backs the Connection-specific page caches).
[email protected]4a3dab22009-11-11 17:36:50699 while (sqlite3_release_memory(std::numeric_limits<int>::max()) > 0) {
700 }
[email protected]adf00bc2009-11-02 18:35:00701
[email protected]fede6ca12009-10-08 18:24:26702 // Repeatedly call the V8 idle notification until it returns true ("nothing
703 // more to free"). Note that it makes more sense to do this than to implement
704 // a new "delete everything" pass because object references make it difficult
705 // to free everything possible in just one pass.
[email protected]4a3dab22009-11-11 17:36:50706 while (!v8::V8::IdleNotification()) {
707 }
[email protected]fede6ca12009-10-08 18:24:26708
[email protected]7e0d664a2009-12-03 21:07:47709#if defined(OS_WIN) && defined(USE_TCMALLOC)
[email protected]fede6ca12009-10-08 18:24:26710 // Tell tcmalloc to release any free pages it's still holding.
711 MallocExtension::instance()->ReleaseFreeMemory();
712#endif
713}
714
[email protected]b78e168b2009-09-21 22:05:45715void RenderThread::OnPurgePluginListCache(bool reload_pages) {
[email protected]f5e4b9bf2009-10-08 00:59:59716 EnsureWebKitInitialized();
[email protected]b547fd42009-04-23 23:16:27717 // The call below will cause a GetPlugins call with refresh=true, but at this
718 // point we already know that the browser has refreshed its list, so disable
719 // refresh temporarily to prevent each renderer process causing the list to be
720 // regenerated.
721 plugin_refresh_allowed_ = false;
[email protected]b78e168b2009-09-21 22:05:45722 WebKit::resetPluginCache(reload_pages);
[email protected]b547fd42009-04-23 23:16:27723 plugin_refresh_allowed_ = true;
724}
[email protected]85c55dc2009-11-06 03:05:46725
[email protected]85c55dc2009-11-06 03:05:46726void RenderThread::OnInitSpellChecker(
[email protected]cb6037d2009-11-16 22:55:17727 IPC::PlatformFileForTransit bdict_file,
[email protected]85c55dc2009-11-06 03:05:46728 const std::vector<std::string>& custom_words,
729 const std::string& language,
730 bool auto_spell_correct) {
[email protected]cb6037d2009-11-16 22:55:17731 spellchecker_->Init(IPC::PlatformFileForTransitToPlatformFile(bdict_file),
732 custom_words, language);
[email protected]85c55dc2009-11-06 03:05:46733 spellchecker_->EnableAutoSpellCorrect(auto_spell_correct);
734}
735
736void RenderThread::OnSpellCheckWordAdded(const std::string& word) {
737 spellchecker_->WordAdded(word);
738}
739
740void RenderThread::OnSpellCheckEnableAutoSpellCorrect(bool enable) {
741 spellchecker_->EnableAutoSpellCorrect(enable);
742}