Backed out changeset c3cca6dfcaa7 for landing with the wrong bug number.
[gecko.git] / xpcom / components / nsNativeComponentLoader.h
blobe006d51649187f96d1ac2b81395322e9baa66d76
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 nsNativeModuleLoader_h__
7 #define nsNativeModuleLoader_h__
9 #include "nsISupports.h"
10 #include "mozilla/ModuleLoader.h"
11 #include "nsDataHashtable.h"
12 #include "nsHashKeys.h"
13 #include "mozilla/Module.h"
14 #include "prlink.h"
16 class nsNativeModuleLoader;
18 namespace mozilla {
19 template<>
20 struct HasDangerousPublicDestructor<nsNativeModuleLoader>
22 static const bool value = true;
26 class nsNativeModuleLoader : public mozilla::ModuleLoader
28 public:
29 NS_DECL_ISUPPORTS_INHERITED
31 nsNativeModuleLoader() {}
32 ~nsNativeModuleLoader() {}
34 virtual const mozilla::Module* LoadModule(mozilla::FileLocation &aFile) MOZ_OVERRIDE;
36 nsresult Init();
38 void UnloadLibraries();
40 private:
41 struct NativeLoadData
43 NativeLoadData()
44 : module(nullptr)
45 , library(nullptr)
46 { }
48 const mozilla::Module* module;
49 PRLibrary* library;
52 static PLDHashOperator
53 ReleaserFunc(nsIHashable* aHashedFile, NativeLoadData &aLoadData, void*);
55 static PLDHashOperator
56 UnloaderFunc(nsIHashable* aHashedFile, NativeLoadData &aLoadData, void*);
58 nsDataHashtable<nsHashableHashKey, NativeLoadData> mLibraries;
61 #endif /* nsNativeModuleLoader_h__ */