Bug 1888590 - Mark some subtests on trusted-types-event-handlers.html as failing...
[gecko.git] / extensions / spellcheck / src / mozPersonalDictionary.h
blob584c7edf56af682551933f48479dd8f76d30a1e2
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozPersonalDictionary_h__
7 #define mozPersonalDictionary_h__
9 #include "nsCOMPtr.h"
10 #include "nsString.h"
11 #include "mozIPersonalDictionary.h"
12 #include "nsIObserver.h"
13 #include "nsWeakReference.h"
14 #include "nsTHashSet.h"
15 #include "nsCRT.h"
16 #include "nsCycleCollectionParticipant.h"
17 #include "nsHashKeys.h"
18 #include <mozilla/Monitor.h>
20 #define MOZ_PERSONALDICTIONARY_CONTRACTID \
21 "@mozilla.org/spellchecker/personaldictionary;1"
22 #define MOZ_PERSONALDICTIONARY_CID \
23 { /* 7EF52EAF-B7E1-462B-87E2-5D1DBACA9048 */ \
24 0X7EF52EAF, 0XB7E1, 0X462B, { \
25 0X87, 0XE2, 0X5D, 0X1D, 0XBA, 0XCA, 0X90, 0X48 \
26 } \
29 class mozPersonalDictionaryLoader;
30 class mozPersonalDictionarySave;
32 class mozPersonalDictionary final : public mozIPersonalDictionary,
33 public nsIObserver,
34 public nsSupportsWeakReference {
35 public:
36 NS_DECL_ISUPPORTS
37 NS_DECL_MOZIPERSONALDICTIONARY
38 NS_DECL_NSIOBSERVER
40 mozPersonalDictionary();
42 nsresult Init();
44 protected:
45 virtual ~mozPersonalDictionary();
47 /* true if the dictionary has been loaded from disk */
48 bool mIsLoaded;
50 /* true if a dictionary save is pending */
51 bool mSavePending;
53 nsCOMPtr<nsIFile> mFile;
54 mozilla::Monitor mMonitor MOZ_UNANNOTATED;
55 mozilla::Monitor mMonitorSave MOZ_UNANNOTATED;
56 nsTHashSet<nsString> mDictionaryTable;
57 nsTHashSet<nsString> mIgnoreTable;
59 private:
60 /* wait for the asynchronous load of the dictionary to be completed */
61 void WaitForLoad();
63 /* enter the monitor before starting a synchronous load off the main-thread */
64 void SyncLoad();
66 /* launch an asynchrounous load of the dictionary from the main-thread
67 * after successfully initializing mFile with the path of the dictionary */
68 nsresult LoadInternal();
70 /* perform a synchronous load of the dictionary from disk */
71 void SyncLoadInternal();
73 /* wait for the asynchronous save of the dictionary to be completed */
74 void WaitForSave();
76 friend class mozPersonalDictionaryLoader;
77 friend class mozPersonalDictionarySave;
80 #endif