nsHyphenationManager.h (1594B)
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/. */ 5 6 #ifndef nsHyphenationManager_h__ 7 #define nsHyphenationManager_h__ 8 9 #include "base/process.h" 10 #include "mozilla/Omnijar.h" 11 #include "mozilla/ipc/SharedMemoryHandle.h" 12 #include "nsHashKeys.h" 13 #include "nsAtomHashKeys.h" 14 #include "nsInterfaceHashtable.h" 15 #include "nsIObserver.h" 16 #include "nsRefPtrHashtable.h" 17 class nsHyphenator; 18 class nsAtom; 19 class nsIURI; 20 21 class nsHyphenationManager : public nsIObserver { 22 public: 23 NS_DECL_ISUPPORTS 24 NS_DECL_NSIOBSERVER 25 26 nsHyphenationManager(); 27 28 already_AddRefed<nsHyphenator> GetHyphenator(nsAtom* aLocale); 29 30 void ShareHyphDictToProcess( 31 nsIURI* aURI, base::ProcessId aPid, 32 mozilla::ipc::ReadOnlySharedMemoryHandle* aOutHandle); 33 34 static nsHyphenationManager* Instance(); 35 36 static void Shutdown(); 37 38 size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); 39 40 private: 41 virtual ~nsHyphenationManager(); 42 43 protected: 44 void LoadPatternList(); 45 void LoadPatternListFromOmnijar(mozilla::Omnijar::Type aType); 46 void LoadPatternListFromDir(nsIFile* aDir); 47 void LoadAliases(); 48 49 nsRefPtrHashtable<nsAtomHashKey, nsAtom> mHyphAliases; 50 nsInterfaceHashtable<nsAtomHashKey, nsIURI> mPatternFiles; 51 nsRefPtrHashtable<nsAtomHashKey, nsHyphenator> mHyphenators; 52 53 static nsHyphenationManager* sInstance; 54 }; 55 56 #endif // nsHyphenationManager_h__