michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsNativeModuleLoader_h__ michael@0: #define nsNativeModuleLoader_h__ michael@0: michael@0: #include "nsISupports.h" michael@0: #include "mozilla/ModuleLoader.h" michael@0: #include "nsDataHashtable.h" michael@0: #include "nsHashKeys.h" michael@0: #include "mozilla/Module.h" michael@0: #include "prlink.h" michael@0: michael@0: class nsNativeModuleLoader : public mozilla::ModuleLoader michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: michael@0: nsNativeModuleLoader() {} michael@0: ~nsNativeModuleLoader() {} michael@0: michael@0: virtual const mozilla::Module* LoadModule(mozilla::FileLocation &aFile) MOZ_OVERRIDE; michael@0: michael@0: nsresult Init(); michael@0: michael@0: void UnloadLibraries(); michael@0: michael@0: private: michael@0: struct NativeLoadData michael@0: { michael@0: NativeLoadData() michael@0: : module(nullptr) michael@0: , library(nullptr) michael@0: { } michael@0: michael@0: const mozilla::Module* module; michael@0: PRLibrary* library; michael@0: }; michael@0: michael@0: static PLDHashOperator michael@0: ReleaserFunc(nsIHashable* aHashedFile, NativeLoadData &aLoadData, void*); michael@0: michael@0: static PLDHashOperator michael@0: UnloaderFunc(nsIHashable* aHashedFile, NativeLoadData &aLoadData, void*); michael@0: michael@0: nsDataHashtable mLibraries; michael@0: }; michael@0: michael@0: #endif /* nsNativeModuleLoader_h__ */