Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: chrome/renderer/render_thread.cc

Issue 395007: Move Mac to using renderer spellchecker. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: ui test fix Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/render_thread.h ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/renderer/render_thread.h" 5 #include "chrome/renderer/render_thread.h"
6 6
7 #include <v8.h> 7 #include <v8.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "chrome/renderer/extensions/js_only_v8_extensions.h" 46 #include "chrome/renderer/extensions/js_only_v8_extensions.h"
47 #include "chrome/renderer/extensions/renderer_extension_bindings.h" 47 #include "chrome/renderer/extensions/renderer_extension_bindings.h"
48 #include "chrome/renderer/external_extension.h" 48 #include "chrome/renderer/external_extension.h"
49 #include "chrome/renderer/loadtimes_extension_bindings.h" 49 #include "chrome/renderer/loadtimes_extension_bindings.h"
50 #include "chrome/renderer/net/render_dns_master.h" 50 #include "chrome/renderer/net/render_dns_master.h"
51 #include "chrome/renderer/render_process.h" 51 #include "chrome/renderer/render_process.h"
52 #include "chrome/renderer/render_view.h" 52 #include "chrome/renderer/render_view.h"
53 #include "chrome/renderer/renderer_webkitclient_impl.h" 53 #include "chrome/renderer/renderer_webkitclient_impl.h"
54 #include "chrome/renderer/renderer_web_database_observer.h" 54 #include "chrome/renderer/renderer_web_database_observer.h"
55 #include "chrome/renderer/socket_stream_dispatcher.h" 55 #include "chrome/renderer/socket_stream_dispatcher.h"
56 #if defined(SPELLCHECKER_IN_RENDERER)
57 #include "chrome/renderer/spellchecker/spellcheck.h" 56 #include "chrome/renderer/spellchecker/spellcheck.h"
58 #endif
59 #include "chrome/renderer/user_script_slave.h" 57 #include "chrome/renderer/user_script_slave.h"
60 #include "ipc/ipc_message.h" 58 #include "ipc/ipc_message.h"
61 #include "ipc/ipc_platform_file.h" 59 #include "ipc/ipc_platform_file.h"
62 #include "third_party/tcmalloc/tcmalloc/src/google/malloc_extension.h" 60 #include "third_party/tcmalloc/tcmalloc/src/google/malloc_extension.h"
63 #include "third_party/WebKit/WebKit/chromium/public/WebCache.h" 61 #include "third_party/WebKit/WebKit/chromium/public/WebCache.h"
64 #include "third_party/WebKit/WebKit/chromium/public/WebColor.h" 62 #include "third_party/WebKit/WebKit/chromium/public/WebColor.h"
65 #include "third_party/WebKit/WebKit/chromium/public/WebCrossOriginPreflightResul tCache.h" 63 #include "third_party/WebKit/WebKit/chromium/public/WebCrossOriginPreflightResul tCache.h"
66 #include "third_party/WebKit/WebKit/chromium/public/WebDatabase.h" 64 #include "third_party/WebKit/WebKit/chromium/public/WebDatabase.h"
67 #include "third_party/WebKit/WebKit/chromium/public/WebFontCache.h" 65 #include "third_party/WebKit/WebKit/chromium/public/WebFontCache.h"
68 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" 66 #include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 visited_link_slave_.reset(new VisitedLinkSlave()); 149 visited_link_slave_.reset(new VisitedLinkSlave());
152 user_script_slave_.reset(new UserScriptSlave()); 150 user_script_slave_.reset(new UserScriptSlave());
153 dns_master_.reset(new RenderDnsMaster()); 151 dns_master_.reset(new RenderDnsMaster());
154 histogram_snapshots_.reset(new RendererHistogramSnapshots()); 152 histogram_snapshots_.reset(new RendererHistogramSnapshots());
155 appcache_dispatcher_.reset(new AppCacheDispatcher(this)); 153 appcache_dispatcher_.reset(new AppCacheDispatcher(this));
156 socket_stream_dispatcher_.reset(new SocketStreamDispatcher()); 154 socket_stream_dispatcher_.reset(new SocketStreamDispatcher());
157 devtools_agent_filter_ = new DevToolsAgentFilter(); 155 devtools_agent_filter_ = new DevToolsAgentFilter();
158 AddFilter(devtools_agent_filter_.get()); 156 AddFilter(devtools_agent_filter_.get());
159 db_message_filter_ = new DBMessageFilter(); 157 db_message_filter_ = new DBMessageFilter();
160 AddFilter(db_message_filter_.get()); 158 AddFilter(db_message_filter_.get());
161 #if defined(SPELLCHECKER_IN_RENDERER)
162 spellchecker_.reset(new SpellCheck()); 159 spellchecker_.reset(new SpellCheck());
163 #endif
164 160
165 #if defined(OS_POSIX) 161 #if defined(OS_POSIX)
166 suicide_on_channel_error_filter_ = new SuicideOnChannelErrorFilter; 162 suicide_on_channel_error_filter_ = new SuicideOnChannelErrorFilter;
167 AddFilter(suicide_on_channel_error_filter_.get()); 163 AddFilter(suicide_on_channel_error_filter_.get());
168 #endif 164 #endif
169 } 165 }
170 166
171 RenderThread::~RenderThread() { 167 RenderThread::~RenderThread() {
172 // Shutdown in reverse of the initialization order. 168 // Shutdown in reverse of the initialization order.
173 RemoveFilter(devtools_agent_filter_.get()); 169 RemoveFilter(devtools_agent_filter_.get());
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetHostPermissions, 330 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetHostPermissions,
335 OnExtensionSetHostPermissions) 331 OnExtensionSetHostPermissions)
336 IPC_MESSAGE_HANDLER(ViewMsg_DOMStorageEvent, 332 IPC_MESSAGE_HANDLER(ViewMsg_DOMStorageEvent,
337 OnDOMStorageEvent) 333 OnDOMStorageEvent)
338 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetL10nMessages, 334 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetL10nMessages,
339 OnExtensionSetL10nMessages) 335 OnExtensionSetL10nMessages)
340 #if defined(IPC_MESSAGE_LOG_ENABLED) 336 #if defined(IPC_MESSAGE_LOG_ENABLED)
341 IPC_MESSAGE_HANDLER(ViewMsg_SetIPCLoggingEnabled, 337 IPC_MESSAGE_HANDLER(ViewMsg_SetIPCLoggingEnabled,
342 OnSetIPCLoggingEnabled) 338 OnSetIPCLoggingEnabled)
343 #endif 339 #endif
344 #if defined(SPELLCHECKER_IN_RENDERER)
345 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_Init, 340 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_Init,
346 OnInitSpellChecker) 341 OnInitSpellChecker)
347 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_WordAdded, 342 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_WordAdded,
348 OnSpellCheckWordAdded) 343 OnSpellCheckWordAdded)
349 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_EnableAutoSpellCorrect, 344 IPC_MESSAGE_HANDLER(ViewMsg_SpellChecker_EnableAutoSpellCorrect,
350 OnSpellCheckEnableAutoSpellCorrect) 345 OnSpellCheckEnableAutoSpellCorrect)
351 #endif
352 IPC_END_MESSAGE_MAP() 346 IPC_END_MESSAGE_MAP()
353 } 347 }
354 348
355 void RenderThread::OnSetNextPageID(int32 next_page_id) { 349 void RenderThread::OnSetNextPageID(int32 next_page_id) {
356 // This should only be called at process initialization time, so we shouldn't 350 // This should only be called at process initialization time, so we shouldn't
357 // have to worry about thread-safety. 351 // have to worry about thread-safety.
358 RenderView::SetNextPageID(next_page_id); 352 RenderView::SetNextPageID(next_page_id);
359 } 353 }
360 354
361 // Called when to register CSS Color name->system color mappings. 355 // Called when to register CSS Color name->system color mappings.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 } 442 }
449 443
450 void RenderThread::CloseIdleConnections() { 444 void RenderThread::CloseIdleConnections() {
451 Send(new ViewHostMsg_CloseIdleConnections()); 445 Send(new ViewHostMsg_CloseIdleConnections());
452 } 446 }
453 447
454 void RenderThread::SetCacheMode(bool enabled) { 448 void RenderThread::SetCacheMode(bool enabled) {
455 Send(new ViewHostMsg_SetCacheMode(enabled)); 449 Send(new ViewHostMsg_SetCacheMode(enabled));
456 } 450 }
457 451
458 #if defined(SPELLCHECKER_IN_RENDERER)
459 void RenderThread::RequestSpellCheckDictionary() {
460 Send(new ViewHostMsg_SpellChecker_RequestDictionary);
461 }
462 #endif
463
464 static void* CreateHistogram( 452 static void* CreateHistogram(
465 const char *name, int min, int max, size_t buckets) { 453 const char *name, int min, int max, size_t buckets) {
466 Histogram* histogram = new Histogram(name, min, max, buckets); 454 Histogram* histogram = new Histogram(name, min, max, buckets);
467 if (histogram) { 455 if (histogram) {
468 histogram->SetFlags(kUmaTargetedHistogramFlag); 456 histogram->SetFlags(kUmaTargetedHistogramFlag);
469 } 457 }
470 return histogram; 458 return histogram;
471 } 459 }
472 460
473 static void AddHistogramSample(void* hist, int sample) { 461 static void AddHistogramSample(void* hist, int sample) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 task_factory_->NewRunnableMethod(&RenderThread::IdleHandler), 595 task_factory_->NewRunnableMethod(&RenderThread::IdleHandler),
608 static_cast<int64>(floor(idle_notification_delay_in_s_)) * 1000); 596 static_cast<int64>(floor(idle_notification_delay_in_s_)) * 1000);
609 } 597 }
610 598
611 void RenderThread::OnExtensionMessageInvoke(const std::string& function_name, 599 void RenderThread::OnExtensionMessageInvoke(const std::string& function_name,
612 const ListValue& args) { 600 const ListValue& args) {
613 RendererExtensionBindings::Invoke(function_name, args, NULL); 601 RendererExtensionBindings::Invoke(function_name, args, NULL);
614 } 602 }
615 603
616 void RenderThread::OnPurgeMemory() { 604 void RenderThread::OnPurgeMemory() {
617 #if defined(SPELLCHECKER_IN_RENDERER)
618 spellchecker_.reset(new SpellCheck()); 605 spellchecker_.reset(new SpellCheck());
619 #endif
620 606
621 EnsureWebKitInitialized(); 607 EnsureWebKitInitialized();
622 608
623 // Clear the object cache (as much as possible; some live objects cannot be 609 // Clear the object cache (as much as possible; some live objects cannot be
624 // freed). 610 // freed).
625 WebCache::clear(); 611 WebCache::clear();
626 612
627 // Clear the font/glyph cache. 613 // Clear the font/glyph cache.
628 WebFontCache::clear(); 614 WebFontCache::clear();
629 615
(...skipping 22 matching lines...) Expand all
652 EnsureWebKitInitialized(); 638 EnsureWebKitInitialized();
653 // The call below will cause a GetPlugins call with refresh=true, but at this 639 // The call below will cause a GetPlugins call with refresh=true, but at this
654 // point we already know that the browser has refreshed its list, so disable 640 // point we already know that the browser has refreshed its list, so disable
655 // refresh temporarily to prevent each renderer process causing the list to be 641 // refresh temporarily to prevent each renderer process causing the list to be
656 // regenerated. 642 // regenerated.
657 plugin_refresh_allowed_ = false; 643 plugin_refresh_allowed_ = false;
658 WebKit::resetPluginCache(reload_pages); 644 WebKit::resetPluginCache(reload_pages);
659 plugin_refresh_allowed_ = true; 645 plugin_refresh_allowed_ = true;
660 } 646 }
661 647
662 #if defined(SPELLCHECKER_IN_RENDERER)
663 void RenderThread::OnInitSpellChecker( 648 void RenderThread::OnInitSpellChecker(
664 IPC::PlatformFileForTransit bdict_file, 649 IPC::PlatformFileForTransit bdict_file,
665 const std::vector<std::string>& custom_words, 650 const std::vector<std::string>& custom_words,
666 const std::string& language, 651 const std::string& language,
667 bool auto_spell_correct) { 652 bool auto_spell_correct) {
668 spellchecker_->Init(IPC::PlatformFileForTransitToPlatformFile(bdict_file), 653 spellchecker_->Init(IPC::PlatformFileForTransitToPlatformFile(bdict_file),
669 custom_words, language); 654 custom_words, language);
670 spellchecker_->EnableAutoSpellCorrect(auto_spell_correct); 655 spellchecker_->EnableAutoSpellCorrect(auto_spell_correct);
671 } 656 }
672 657
673 void RenderThread::OnSpellCheckWordAdded(const std::string& word) { 658 void RenderThread::OnSpellCheckWordAdded(const std::string& word) {
674 spellchecker_->WordAdded(word); 659 spellchecker_->WordAdded(word);
675 } 660 }
676 661
677 void RenderThread::OnSpellCheckEnableAutoSpellCorrect(bool enable) { 662 void RenderThread::OnSpellCheckEnableAutoSpellCorrect(bool enable) {
678 spellchecker_->EnableAutoSpellCorrect(enable); 663 spellchecker_->EnableAutoSpellCorrect(enable);
679 } 664 }
680 #endif
OLDNEW
« no previous file with comments | « chrome/renderer/render_thread.h ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698