ModuleLoader.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_ModuleLoader_h
  6. #define mozilla_ModuleLoader_h
  7. #include "nsISupports.h"
  8. #include "mozilla/Module.h"
  9. #include "mozilla/FileLocation.h"
  10. #define MOZILLA_MODULELOADER_PSEUDO_IID \
  11. { 0xD951A8CE, 0x6E9F, 0x464F, \
  12. { 0x8A, 0xC8, 0x14, 0x61, 0xC0, 0xD3, 0x63, 0xC8 } }
  13. namespace mozilla {
  14. /**
  15. * Module loaders are responsible for loading a component file. The static
  16. * component loader is special and does not use this abstract interface.
  17. *
  18. * @note Implementations of this interface should be threadsafe,
  19. * methods may be called from any thread.
  20. */
  21. class ModuleLoader : public nsISupports
  22. {
  23. public:
  24. NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_MODULELOADER_PSEUDO_IID)
  25. /**
  26. * Return the module for a specified file. The caller should cache
  27. * the module: the implementer should not expect for the same file
  28. * to be loaded multiple times. The Module object should either be
  29. * statically or permanently allocated; it will not be freed.
  30. */
  31. virtual const Module* LoadModule(mozilla::FileLocation& aFile) = 0;
  32. };
  33. NS_DEFINE_STATIC_IID_ACCESSOR(ModuleLoader, MOZILLA_MODULELOADER_PSEUDO_IID)
  34. } // namespace mozilla
  35. #endif // mozilla_ModuleLoader_h