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