2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 04:12:37 -07: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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef nsNativeModuleLoader_h__
|
|
|
|
#define nsNativeModuleLoader_h__
|
|
|
|
|
|
|
|
#include "nsISupports.h"
|
2010-06-10 11:11:11 -07:00
|
|
|
#include "mozilla/ModuleLoader.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsDataHashtable.h"
|
|
|
|
#include "nsHashKeys.h"
|
2010-06-10 11:11:11 -07:00
|
|
|
#include "mozilla/Module.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "prlink.h"
|
|
|
|
|
2010-06-10 11:11:11 -07:00
|
|
|
class nsNativeModuleLoader : public mozilla::ModuleLoader
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
nsNativeModuleLoader() {}
|
|
|
|
~nsNativeModuleLoader() {}
|
|
|
|
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual const mozilla::Module* LoadModule(mozilla::FileLocation &aFile) MOZ_OVERRIDE;
|
2010-06-10 11:11:11 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult Init();
|
|
|
|
|
|
|
|
void UnloadLibraries();
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct NativeLoadData
|
|
|
|
{
|
2010-06-10 11:11:11 -07:00
|
|
|
NativeLoadData()
|
2013-10-10 13:41:00 -07:00
|
|
|
: module(nullptr)
|
|
|
|
, library(nullptr)
|
2010-06-10 11:11:11 -07:00
|
|
|
{ }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-06-10 11:11:11 -07:00
|
|
|
const mozilla::Module* module;
|
|
|
|
PRLibrary* library;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
static PLDHashOperator
|
|
|
|
ReleaserFunc(nsIHashable* aHashedFile, NativeLoadData &aLoadData, void*);
|
|
|
|
|
|
|
|
static PLDHashOperator
|
|
|
|
UnloaderFunc(nsIHashable* aHashedFile, NativeLoadData &aLoadData, void*);
|
|
|
|
|
|
|
|
nsDataHashtable<nsHashableHashKey, NativeLoadData> mLibraries;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsNativeModuleLoader_h__ */
|