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

Issue 357003: Move the spellchecker to the renderer.... (Closed)

Created:
11 years, 1 month ago by Evan Stade
Modified:
9 years, 6 months ago
Reviewers:
Peter Kasting, brettw, jam
CC:
chromium-reviews_googlegroups.com, brettw+cc_chromium.org, ben+cc_chromium.org, John Grabowski, jam, pam+watch_chromium.org, darin (slow to review)
Visibility:
Public.

Description

Move the spellchecker to the renderer. The motivation is that this removes the sync IPC on every call to the spellchecker. Also, currently we spellcheck in the IO thread, which frequently needs to go to disk (in particular, the entire spellcheck dictionary starts paged out), so this will block just the single renderer when that happens, rather than the whole IO thread. This breaks the SpellChecker class into two new classes. 1) On the browser side, we have SpellCheckHost. This class handles browser-wide tasks, such as keeping the custom words list in sync with the on-disk custom words dictionary, downloading missing dictionaries, etc. On Posix, it also opens the bdic file since the renderer isn't allowed to open files. SpellCheckHost is created and destroyed on the UI thread. It is initialized on the file thread. 2) On the renderer side, SpellChecker2. This class will one day be renamed SpellChecker. It handles actual checking of the words, memory maps the dictionary file, loads hunspell, etc. There is one SpellChecker2 per RenderThread (hence one per render process). My intention is for this patch to move Linux to this new approach, and follow up with ports for Windows (which will involve passing a dictionary file name rather than a file descriptor through to the renderer) and Mac (which will involve adding sync ViewHost IPC callsfor when the platform spellchecker is enabled). Note that anyone using the platform spellchecker rather than Hunspell will get no benefit out of this refactor. There should be no loss of functionality for Linux (or any other platform) in this patch. The following should all still work: - dictionary is loaded lazily - hunspell is initialized lazily, per renderer - language changes work. - Dynamic downloading of new dictionaries - auto spell correct works (as well as toggling it). - disabling spellcheck works. - custom words work (including adding in one renderer and immediately having it take effect in other renderers, for certain values of "immediate") TODO: - move spellchecker unit tests to test SpellCheck2 - add sync IPC for platform spellchecker; port to Mac - add dictionary location fallback; port to Windows - remove SpellChecker classes from browser/ BUG=25677

Patch Set 1 #

Patch Set 2 : svn add #

Total comments: 40

Patch Set 3 : testing profile #

Total comments: 16

Patch Set 4 : review fixes #

Patch Set 5 : '' #

Total comments: 10

Patch Set 6 : more review fixes #

Patch Set 7 : '' #

Patch Set 8 : '' #

Patch Set 9 : renaming #

Patch Set 10 : rename #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+979 lines, -953 lines) Patch
M base/file_util.h View 1 2 3 4 5 4 chunks +13 lines, -1 line 0 comments Download
M base/file_util_posix.cc View 1 2 3 4 5 2 chunks +28 lines, -11 lines 0 comments Download
M build/common.gypi View 4 5 3 chunks +10 lines, -1 line 0 comments Download
M chrome/browser/automation/automation_profile_impl.h View 7 8 1 chunk +8 lines, -0 lines 0 comments Download
M chrome/browser/profile.h View 1 2 3 4 5 6 7 8 6 chunks +33 lines, -0 lines 0 comments Download
M chrome/browser/profile.cc View 1 2 3 4 5 6 7 8 5 chunks +66 lines, -2 lines 0 comments Download
M chrome/browser/renderer_host/browser_render_process_host.h View 1 2 3 4 5 1 chunk +19 lines, -0 lines 0 comments Download
M chrome/browser/renderer_host/browser_render_process_host.cc View 1 2 3 4 5 6 7 chunks +84 lines, -0 lines 0 comments Download
A chrome/browser/spellcheck_host.h View 4 5 6 7 8 1 chunk +102 lines, -0 lines 1 comment Download
A chrome/browser/spellcheck_host.cc View 4 5 1 chunk +278 lines, -0 lines 0 comments Download
M chrome/browser/spellchecker.cc View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/spellchecker_mac.mm View 1 2 3 4 5 2 chunks +1 line, -1 line 0 comments Download
M chrome/browser/tab_contents/render_view_context_menu.cc View 1 2 3 4 5 3 chunks +15 lines, -2 lines 0 comments Download
M chrome/chrome.gyp View 1 2 3 4 5 6 7 8 3 chunks +9 lines, -0 lines 0 comments Download
M chrome/common/notification_type.h View 1 2 3 4 5 1 chunk +10 lines, -0 lines 0 comments Download
M chrome/common/render_messages_internal.h View 1 2 3 4 5 2 chunks +30 lines, -0 lines 0 comments Download
M chrome/renderer/render_thread.h View 1 2 3 4 5 6 7 8 6 chunks +25 lines, -0 lines 0 comments Download
M chrome/renderer/render_thread.cc View 1 2 3 4 5 6 7 8 6 chunks +43 lines, -0 lines 0 comments Download
M chrome/renderer/render_view.cc View 5 6 7 8 9 3 chunks +17 lines, -0 lines 0 comments Download
A + chrome/renderer/spellchecker/spellcheck.h View 9 4 chunks +42 lines, -154 lines 0 comments Download
A + chrome/renderer/spellchecker/spellcheck.cc View 9 5 chunks +134 lines, -774 lines 0 comments Download
A + chrome/renderer/spellchecker/spellcheck_worditerator.h View 2 chunks +4 lines, -4 lines 0 comments Download
A + chrome/renderer/spellchecker/spellcheck_worditerator.cc View 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/test/testing_profile.h View 3 4 5 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 19 (0 generated)
Evan Stade
I have not even tried to compile it on windows/mac, so for now just assume ...
11 years, 1 month ago (2009-11-04 02:49:37 UTC) #1
darin (slow to review)
Out of curiosity, what problems does this solve? -Darin On Tue, Nov 3, 2009 at ...
11 years, 1 month ago (2009-11-04 03:15:10 UTC) #2
Evan Stade
It removes the sync IPC on every call to the spellchecker. Also, currently we spellcheck ...
11 years, 1 month ago (2009-11-04 03:47:27 UTC) #3
darin (slow to review)
oh, that does sound like a huge win. can you add this to the CL ...
11 years, 1 month ago (2009-11-04 04:21:35 UTC) #4
Peter Kasting
Generally looks fine, although I didn't think hard about it. The one thing you haven't ...
11 years, 1 month ago (2009-11-04 21:00:00 UTC) #5
jam
http://codereview.chromium.org/357003/diff/8001/9006 File chrome/browser/profile.cc (right): http://codereview.chromium.org/357003/diff/8001/9006#newcode481 Line 481: #if defined(OS_LINUX) Instead of having the code that ...
11 years, 1 month ago (2009-11-04 21:57:13 UTC) #6
Evan Stade
http://codereview.chromium.org/357003/diff/6001/7006 File chrome/browser/profile.cc (right): http://codereview.chromium.org/357003/diff/6001/7006#newcode1310 Line 1310: NotificationService::current()->Notify( On 2009/11/04 21:00:00, Peter Kasting wrote: > ...
11 years, 1 month ago (2009-11-04 23:28:49 UTC) #7
Peter Kasting
http://codereview.chromium.org/357003/diff/6001/7020 File chrome/browser/spellcheck_util.cc (right): http://codereview.chromium.org/357003/diff/6001/7020#newcode28 Line 28: } g_supported_spellchecker_languages[] = { On 2009/11/04 23:28:49, Evan ...
11 years, 1 month ago (2009-11-05 00:00:50 UTC) #8
Evan Stade
On 2009/11/05 00:00:50, Peter Kasting wrote: > http://codereview.chromium.org/357003/diff/6001/7020 > File chrome/browser/spellcheck_util.cc (right): > > http://codereview.chromium.org/357003/diff/6001/7020#newcode28 ...
11 years, 1 month ago (2009-11-05 19:13:49 UTC) #9
Peter Kasting
LGTM, basically http://codereview.chromium.org/357003/diff/9046/9050 File chrome/browser/profile.h (right): http://codereview.chromium.org/357003/diff/9046/9050#newcode360 Line 360: virtual void ReinitializeSpellCheckHost(bool force) = 0; ...
11 years, 1 month ago (2009-11-05 19:40:14 UTC) #10
Evan Stade
http://codereview.chromium.org/357003/diff/9046/9050 File chrome/browser/profile.h (right): http://codereview.chromium.org/357003/diff/9046/9050#newcode360 Line 360: virtual void ReinitializeSpellCheckHost(bool force) = 0; On 2009/11/05 ...
11 years, 1 month ago (2009-11-05 19:55:47 UTC) #11
Peter Kasting
http://codereview.chromium.org/357003/diff/9046/9050 File chrome/browser/profile.h (right): http://codereview.chromium.org/357003/diff/9046/9050#newcode360 Line 360: virtual void ReinitializeSpellCheckHost(bool force) = 0; On 2009/11/05 ...
11 years, 1 month ago (2009-11-05 20:13:28 UTC) #12
Evan Stade
done and done. All trybots are go. John?
11 years, 1 month ago (2009-11-05 22:33:57 UTC) #13
jam
http://codereview.chromium.org/357003/diff/8001/9021 File chrome/browser/spellcheck_util.h (right): http://codereview.chromium.org/357003/diff/8001/9021#newcode27 Line 27: virtual ~SpellCheckUtil(); On 2009/11/04 23:28:49, Evan Stade wrote: ...
11 years, 1 month ago (2009-11-05 23:54:10 UTC) #14
Evan Stade
ok, i figured out the incantations: friend class DeleteTask<SpellCheckHost>; friend class ChromeThread; > I guess ...
11 years, 1 month ago (2009-11-06 00:16:58 UTC) #15
jam
On Thu, Nov 5, 2009 at 4:16 PM, <estade@chromium.org> wrote: > ok, i figured out ...
11 years, 1 month ago (2009-11-06 00:21:22 UTC) #16
jam
On Thu, Nov 5, 2009 at 4:21 PM, John Abd-El-Malek <jam@chromium.org> wrote: > > > ...
11 years, 1 month ago (2009-11-06 00:31:01 UTC) #17
Evan Stade
renamed spellchecker2 to spellcheck, added scoped_refptr to profile, left friend classes alone as discussed offline.
11 years, 1 month ago (2009-11-06 01:27:06 UTC) #18
jam
11 years, 1 month ago (2009-11-06 01:51:52 UTC) #19
lgtm

http://codereview.chromium.org/357003/diff/18003/18022
File chrome/browser/spellcheck_host.h (right):

http://codereview.chromium.org/357003/diff/18003/18022#newcode47
Line 47: friend class DeleteTask<SpellCheckHost>;
nit: order

Powered by Google App Engine
This is Rietveld 408576698