diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-02 01:29:29 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-02 01:29:29 +0000 |
commit | e3448ea27e38817f78ea1a4678831fb507a6d1c9 (patch) | |
tree | 464ad655ff1f1cc52710cc971bb6a240789bd40e /chrome/browser/profile.h | |
parent | d833fa2a5d20d413834b6db5a882142a6b7f965a (diff) | |
download | chromium_src-e3448ea27e38817f78ea1a4678831fb507a6d1c9.zip chromium_src-e3448ea27e38817f78ea1a4678831fb507a6d1c9.tar.gz chromium_src-e3448ea27e38817f78ea1a4678831fb507a6d1c9.tar.bz2 |
Add Profile::DeleteSpellChecker(), which my MemoryPurger will use to purge the spellchecker objects from memory.
This reworks the SpellChecker management functions inside the ProfileImpl for simplicity. The only notable side effect is that GetSpellChecker() will now cause a notification if it inits |spellchecker_|, just like ReinitializeSpellChecker() already did. This was just to simplify the code; at the point this fires, no one will be listening yet, so it won't actually do anything.
Also use a temporary at one spot in browser_render_process_host.cc instead of calling a heavyweight function twice in a row.
BUG=23400
TEST=none
Review URL: http://codereview.chromium.org/259009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27816 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/profile.h')
-rw-r--r-- | chrome/browser/profile.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/chrome/browser/profile.h b/chrome/browser/profile.h index 675c6aa..a2f055f 100644 --- a/chrome/browser/profile.h +++ b/chrome/browser/profile.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -313,7 +313,8 @@ class Profile { virtual void ResetTabRestoreService() = 0; // This reinitializes the spellchecker according to the current dictionary - // language, and enable spell check option, in the prefs. + // language, and enable spell check option, in the prefs. Then a + // SPELLCHECKER_REINITIALIZED notification is sent on the IO thread. virtual void ReinitializeSpellChecker() = 0; // Returns the spell checker object for this profile. THIS OBJECT MUST ONLY @@ -321,6 +322,10 @@ class Profile { // sent to the I/O thread where it is actually used. virtual SpellChecker* GetSpellChecker() = 0; + // Deletes the spellchecker. This is only really useful when we need to purge + // memory. + virtual void DeleteSpellChecker() = 0; + // Returns the WebKitContext assigned to this profile. virtual WebKitContext* GetWebKitContext() = 0; @@ -416,6 +421,7 @@ class ProfileImpl : public Profile, virtual void ResetTabRestoreService(); virtual void ReinitializeSpellChecker(); virtual SpellChecker* GetSpellChecker(); + virtual void DeleteSpellChecker() { DeleteSpellCheckerImpl(true); } virtual WebKitContext* GetWebKitContext(); virtual void MarkAsCleanShutdown(); virtual void InitExtensions(); @@ -448,14 +454,8 @@ class ProfileImpl : public Profile, GetSessionService(); } - // Initializes the spellchecker. If the spellchecker already exsts, then - // it is released, and initialized again. This model makes sure that - // spellchecker language can be changed without restarting the browser. - // NOTE: This is being currently called in the UI thread, which is OK as long - // as the spellchecker object is USED in the IO thread. - // The |need_to_broadcast| parameter tells it whether to broadcast the new - // spellchecker to the resource message filters. - void InitializeSpellChecker(bool need_to_broadcast); + void NotifySpellCheckerChanged(); + void DeleteSpellCheckerImpl(bool notify); NotificationRegistrar registrar_; @@ -551,8 +551,8 @@ struct hash<Profile*> { #endif // This struct is used to pass the spellchecker object through the notification -// NOTIFY_SPELLCHECKER_REINITIALIZED. This is used as the details for the -// notification service. +// SPELLCHECKER_REINITIALIZED. This is used as the details for the notification +// service. struct SpellcheckerReinitializedDetails { scoped_refptr<SpellChecker> spellchecker; }; |