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

Side by Side Diff: chrome/browser/spellchecker.h

Issue 342090: Use ChromeThread::DeleteOnIOThread in a few places where an object must be de... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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/browser/renderer_host/resource_handler.h ('k') | chrome/browser/spellchecker.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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-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 #ifndef CHROME_BROWSER_SPELLCHECKER_H_ 5 #ifndef CHROME_BROWSER_SPELLCHECKER_H_
6 #define CHROME_BROWSER_SPELLCHECKER_H_ 6 #define CHROME_BROWSER_SPELLCHECKER_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "app/l10n_util.h" 12 #include "app/l10n_util.h"
13 #include "base/string16.h" 13 #include "base/string16.h"
14 #include "base/task.h" 14 #include "base/task.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/chrome_thread.h"
17 #include "chrome/browser/net/url_fetcher.h" 17 #include "chrome/browser/net/url_fetcher.h"
18 #include "chrome/browser/profile.h" 18 #include "chrome/browser/profile.h"
19 #include "chrome/browser/spellcheck_worditerator.h" 19 #include "chrome/browser/spellcheck_worditerator.h"
20 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
21 #include "chrome/common/pref_member.h" 21 #include "chrome/common/pref_member.h"
22 #include "unicode/uscript.h" 22 #include "unicode/uscript.h"
23 23
24 class FilePath; 24 class FilePath;
25 class Hunspell; 25 class Hunspell;
26 class PrefService; 26 class PrefService;
27 class Profile; 27 class Profile;
28 class URLFetcher; 28 class URLFetcher;
29 class URLRequestContextGetter; 29 class URLRequestContextGetter;
30 30
31 namespace file_util { 31 namespace file_util {
32 class MemoryMappedFile; 32 class MemoryMappedFile;
33 } 33 }
34 34
35 // The Browser's Spell Checker. It checks and suggests corrections. 35 // The Browser's Spell Checker. It checks and suggests corrections.
36 // 36 //
37 // This object is not threadsafe. In normal usage (not unit tests) it lives on 37 // This object is not threadsafe. In normal usage (not unit tests) it lives on
38 // the I/O thread of the browser. It is threadsafe refcounted so that I/O thread 38 // the I/O thread of the browser. It is threadsafe refcounted so that I/O thread
39 // and the profile on the main thread (which gives out references to it) can 39 // and the profile on the main thread (which gives out references to it) can
40 // keep it. However, all usage of this must be on the I/O thread. 40 // keep it. However, all usage of this must be on the I/O thread.
41 // 41 //
42 // This object should also be deleted on the I/O thread only. It owns a 42 // This object should also be deleted on the I/O thread only. It owns a
43 // reference to URLRequestContext which in turn owns the cache, etc. and must be 43 // reference to URLRequestContext which in turn owns the cache, etc. and must be
44 // deleted on the I/O thread itself. 44 // deleted on the I/O thread itself.
45 class SpellChecker : public base::RefCountedThreadSafe<SpellChecker>, 45 class SpellChecker
46 public URLFetcher::Delegate { 46 : public base::RefCountedThreadSafe<
47 SpellChecker, ChromeThread::DeleteOnIOThread>,
48 public URLFetcher::Delegate {
47 public: 49 public:
48 // Creates the spellchecker by reading dictionaries from the given directory, 50 // Creates the spellchecker by reading dictionaries from the given directory,
49 // and defaulting to the given language. Both strings must be provided. 51 // and defaulting to the given language. Both strings must be provided.
50 // 52 //
51 // The request context is used to download dictionaries if they do not exist. 53 // The request context is used to download dictionaries if they do not exist.
52 // This can be NULL if you don't want this (like in tests). 54 // This can be NULL if you don't want this (like in tests).
53 // The |custom_dictionary_file_name| should be left blank so that Spellchecker 55 // The |custom_dictionary_file_name| should be left blank so that Spellchecker
54 // can figure out the custom dictionary file. It is non empty only for unit 56 // can figure out the custom dictionary file. It is non empty only for unit
55 // testing. 57 // testing.
56 SpellChecker(const FilePath& dict_dir, 58 SpellChecker(const FilePath& dict_dir,
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 std::queue<std::string> custom_words_; 236 std::queue<std::string> custom_words_;
235 237
236 // Used for generating callbacks to spellchecker, since spellchecker is a 238 // Used for generating callbacks to spellchecker, since spellchecker is a
237 // non-reference counted object. 239 // non-reference counted object.
238 ScopedRunnableMethodFactory<SpellChecker> method_factory_; 240 ScopedRunnableMethodFactory<SpellChecker> method_factory_;
239 241
240 DISALLOW_COPY_AND_ASSIGN(SpellChecker); 242 DISALLOW_COPY_AND_ASSIGN(SpellChecker);
241 }; 243 };
242 244
243 #endif // CHROME_BROWSER_SPELLCHECKER_H_ 245 #endif // CHROME_BROWSER_SPELLCHECKER_H_
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/resource_handler.h ('k') | chrome/browser/spellchecker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698