1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/components/ModuleLoader.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,43 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 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 mozilla_ModuleLoader_h 1.10 +#define mozilla_ModuleLoader_h 1.11 + 1.12 +#include "nsISupports.h" 1.13 +#include "mozilla/Module.h" 1.14 +#include "mozilla/FileLocation.h" 1.15 + 1.16 +#define MOZILLA_MODULELOADER_PSEUDO_IID \ 1.17 +{ 0xD951A8CE, 0x6E9F, 0x464F, \ 1.18 + { 0x8A, 0xC8, 0x14, 0x61, 0xC0, 0xD3, 0x63, 0xC8 } } 1.19 + 1.20 +namespace mozilla { 1.21 + 1.22 +/** 1.23 + * Module loaders are responsible for loading a component file. The static 1.24 + * component loader is special and does not use this abstract interface. 1.25 + * 1.26 + * @note Implementations of this interface should be threadsafe, 1.27 + * methods may be called from any thread. 1.28 + */ 1.29 +class ModuleLoader : public nsISupports 1.30 +{ 1.31 +public: 1.32 + NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_MODULELOADER_PSEUDO_IID) 1.33 + 1.34 + /** 1.35 + * Return the module for a specified file. The caller should cache 1.36 + * the module: the implementer should not expect for the same file 1.37 + * to be loaded multiple times. The Module object should either be 1.38 + * statically or permanently allocated; it will not be freed. 1.39 + */ 1.40 + virtual const Module* LoadModule(mozilla::FileLocation &aFile) = 0; 1.41 +}; 1.42 +NS_DEFINE_STATIC_IID_ACCESSOR(ModuleLoader, MOZILLA_MODULELOADER_PSEUDO_IID) 1.43 + 1.44 +} // namespace mozilla 1.45 + 1.46 +#endif // mozilla_ModuleLoader_h