1999-09-01 01:40:21 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1999-09-01 01:40:21 +04:00
|
|
|
|
2005-12-13 20:55:43 +03:00
|
|
|
#ifndef nsNativeModuleLoader_h__
|
|
|
|
#define nsNativeModuleLoader_h__
|
|
|
|
|
|
|
|
#include "nsDataHashtable.h"
|
|
|
|
#include "nsHashKeys.h"
|
|
|
|
#include "prlink.h"
|
1999-09-01 01:40:21 +04:00
|
|
|
|
2014-07-01 02:11:53 +04:00
|
|
|
namespace mozilla {
|
2014-07-28 21:15:58 +04:00
|
|
|
class FileLocation;
|
2014-07-01 02:11:53 +04:00
|
|
|
}
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsNativeModuleLoader final
|
2005-12-03 18:27:17 +03:00
|
|
|
{
|
2014-08-03 00:44:06 +04:00
|
|
|
public:
|
|
|
|
const mozilla::Module* LoadModule(mozilla::FileLocation& aFile);
|
2010-06-10 22:11:11 +04:00
|
|
|
|
2014-08-03 00:44:06 +04:00
|
|
|
nsresult Init();
|
2005-12-13 20:55:43 +03:00
|
|
|
|
2014-08-03 00:44:06 +04:00
|
|
|
void UnloadLibraries();
|
2004-01-15 09:14:18 +03:00
|
|
|
|
2014-08-03 00:44:06 +04:00
|
|
|
private:
|
|
|
|
struct NativeLoadData
|
|
|
|
{
|
|
|
|
NativeLoadData() : mModule(nullptr), mLibrary(nullptr) {}
|
2005-12-02 20:38:18 +03:00
|
|
|
|
2014-08-03 00:44:06 +04:00
|
|
|
const mozilla::Module* mModule;
|
|
|
|
PRLibrary* mLibrary;
|
|
|
|
};
|
2002-06-15 01:33:05 +04:00
|
|
|
|
2014-08-03 00:44:06 +04:00
|
|
|
static PLDHashOperator
|
|
|
|
ReleaserFunc(nsIHashable* aHashedFile, NativeLoadData& aLoadData, void*);
|
1999-09-14 17:40:22 +04:00
|
|
|
|
2014-08-03 00:44:06 +04:00
|
|
|
static PLDHashOperator
|
|
|
|
UnloaderFunc(nsIHashable* aHashedFile, NativeLoadData& aLoadData, void*);
|
1999-09-01 01:40:21 +04:00
|
|
|
|
2014-08-03 00:44:06 +04:00
|
|
|
nsDataHashtable<nsHashableHashKey, NativeLoadData> mLibraries;
|
2005-12-02 19:34:42 +03:00
|
|
|
};
|
2002-06-15 01:33:05 +04:00
|
|
|
|
2005-12-13 20:55:43 +03:00
|
|
|
#endif /* nsNativeModuleLoader_h__ */
|