1999-08-31 21:40:21 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 11:12:37 +00: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-08-31 21:40:21 +00:00
|
|
|
|
2005-12-13 17:55:43 +00:00
|
|
|
#ifndef nsNativeModuleLoader_h__
|
|
|
|
#define nsNativeModuleLoader_h__
|
|
|
|
|
1999-08-31 21:40:21 +00:00
|
|
|
#include "nsISupports.h"
|
2010-06-10 18:11:11 +00:00
|
|
|
#include "mozilla/ModuleLoader.h"
|
2005-12-13 17:55:43 +00:00
|
|
|
#include "nsDataHashtable.h"
|
|
|
|
#include "nsHashKeys.h"
|
2010-06-10 18:11:11 +00:00
|
|
|
#include "mozilla/Module.h"
|
2005-12-13 17:55:43 +00:00
|
|
|
#include "prlink.h"
|
1999-08-31 21:40:21 +00:00
|
|
|
|
2010-06-10 18:11:11 +00:00
|
|
|
class nsNativeModuleLoader : public mozilla::ModuleLoader
|
2005-12-03 15:27:17 +00:00
|
|
|
{
|
|
|
|
public:
|
2005-12-13 17:55:43 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
1999-08-31 21:40:21 +00:00
|
|
|
|
2005-12-13 17:55:43 +00:00
|
|
|
nsNativeModuleLoader() {}
|
|
|
|
~nsNativeModuleLoader() {}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual const mozilla::Module* LoadModule(mozilla::FileLocation &aFile) MOZ_OVERRIDE;
|
2010-06-10 18:11:11 +00:00
|
|
|
|
2005-12-13 17:55:43 +00:00
|
|
|
nsresult Init();
|
|
|
|
|
|
|
|
void UnloadLibraries();
|
2004-01-15 06:14:18 +00:00
|
|
|
|
2005-12-02 16:34:42 +00:00
|
|
|
private:
|
2005-12-13 17:55:43 +00:00
|
|
|
struct NativeLoadData
|
|
|
|
{
|
2010-06-10 18:11:11 +00:00
|
|
|
NativeLoadData()
|
2013-10-10 20:41:00 +00:00
|
|
|
: module(nullptr)
|
|
|
|
, library(nullptr)
|
2010-06-10 18:11:11 +00:00
|
|
|
{ }
|
2005-12-02 17:38:18 +00:00
|
|
|
|
2010-06-10 18:11:11 +00:00
|
|
|
const mozilla::Module* module;
|
|
|
|
PRLibrary* library;
|
2005-12-13 17:55:43 +00:00
|
|
|
};
|
2002-06-14 21:33:05 +00:00
|
|
|
|
2005-12-13 17:55:43 +00:00
|
|
|
static PLDHashOperator
|
|
|
|
ReleaserFunc(nsIHashable* aHashedFile, NativeLoadData &aLoadData, void*);
|
1999-09-14 13:40:22 +00:00
|
|
|
|
2005-12-13 17:55:43 +00:00
|
|
|
static PLDHashOperator
|
|
|
|
UnloaderFunc(nsIHashable* aHashedFile, NativeLoadData &aLoadData, void*);
|
1999-08-31 21:40:21 +00:00
|
|
|
|
2005-12-13 17:55:43 +00:00
|
|
|
nsDataHashtable<nsHashableHashKey, NativeLoadData> mLibraries;
|
2005-12-02 16:34:42 +00:00
|
|
|
};
|
2002-06-14 21:33:05 +00:00
|
|
|
|
2005-12-13 17:55:43 +00:00
|
|
|
#endif /* nsNativeModuleLoader_h__ */
|