OSFileConstants.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 file,
  4. * You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_osfileconstants_h__
  6. #define mozilla_osfileconstants_h__
  7. #include "nsIOSFileConstantsService.h"
  8. #include "mozilla/Attributes.h"
  9. namespace mozilla {
  10. /**
  11. * Perform initialization of this module.
  12. *
  13. * This function _must_ be called:
  14. * - from the main thread;
  15. * - before any Chrome Worker is created.
  16. *
  17. * The function is idempotent.
  18. */
  19. nsresult InitOSFileConstants();
  20. /**
  21. * Perform cleanup of this module.
  22. *
  23. * This function _must_ be called:
  24. * - from the main thread;
  25. * - after all Chrome Workers are dead.
  26. *
  27. * The function is idempotent.
  28. */
  29. void CleanupOSFileConstants();
  30. /**
  31. * Define OS-specific constants.
  32. *
  33. * This function creates or uses JS object |OS.Constants| to store
  34. * all its constants.
  35. */
  36. bool DefineOSFileConstants(JSContext *cx, JS::Handle<JSObject*> global);
  37. /**
  38. * XPConnect initializer, for use in the main thread.
  39. */
  40. class OSFileConstantsService final : public nsIOSFileConstantsService
  41. {
  42. public:
  43. NS_DECL_ISUPPORTS
  44. NS_DECL_NSIOSFILECONSTANTSSERVICE
  45. OSFileConstantsService();
  46. private:
  47. ~OSFileConstantsService();
  48. };
  49. } // namespace mozilla
  50. #endif // mozilla_osfileconstants_h__