xpcom/components/nsNativeComponentLoader.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xpcom/components/nsNativeComponentLoader.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,51 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nsNativeModuleLoader_h__
    1.10 +#define nsNativeModuleLoader_h__
    1.11 +
    1.12 +#include "nsISupports.h"
    1.13 +#include "mozilla/ModuleLoader.h"
    1.14 +#include "nsDataHashtable.h"
    1.15 +#include "nsHashKeys.h"
    1.16 +#include "mozilla/Module.h"
    1.17 +#include "prlink.h"
    1.18 +
    1.19 +class nsNativeModuleLoader : public mozilla::ModuleLoader
    1.20 +{
    1.21 + public:
    1.22 +    NS_DECL_ISUPPORTS_INHERITED
    1.23 +
    1.24 +    nsNativeModuleLoader() {}
    1.25 +    ~nsNativeModuleLoader() {}
    1.26 +
    1.27 +    virtual const mozilla::Module* LoadModule(mozilla::FileLocation &aFile) MOZ_OVERRIDE;
    1.28 +
    1.29 +    nsresult Init();
    1.30 +
    1.31 +    void UnloadLibraries();
    1.32 +
    1.33 + private:
    1.34 +    struct NativeLoadData
    1.35 +    {
    1.36 +        NativeLoadData()
    1.37 +            : module(nullptr)
    1.38 +            , library(nullptr)
    1.39 +        { }
    1.40 +
    1.41 +        const mozilla::Module* module;
    1.42 +        PRLibrary* library;
    1.43 +    };
    1.44 +
    1.45 +    static PLDHashOperator
    1.46 +    ReleaserFunc(nsIHashable* aHashedFile, NativeLoadData &aLoadData, void*);
    1.47 +
    1.48 +    static PLDHashOperator
    1.49 +    UnloaderFunc(nsIHashable* aHashedFile, NativeLoadData &aLoadData, void*);
    1.50 +
    1.51 +    nsDataHashtable<nsHashableHashKey, NativeLoadData> mLibraries;
    1.52 +};
    1.53 +
    1.54 +#endif /* nsNativeModuleLoader_h__ */

mercurial