nsUUIDGenerator.h 1009 B

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 _NSUUIDGENERATOR_H_
  6. #define _NSUUIDGENERATOR_H_
  7. #include "mozilla/Attributes.h"
  8. #include "mozilla/Mutex.h"
  9. #include "nsIUUIDGenerator.h"
  10. class nsUUIDGenerator final : public nsIUUIDGenerator
  11. {
  12. public:
  13. nsUUIDGenerator();
  14. NS_DECL_THREADSAFE_ISUPPORTS
  15. NS_DECL_NSIUUIDGENERATOR
  16. nsresult Init();
  17. private:
  18. ~nsUUIDGenerator();
  19. protected:
  20. mozilla::Mutex mLock;
  21. #if !defined(XP_WIN) && !defined(HAVE_ARC4RANDOM)
  22. char mState[128];
  23. char* mSavedState;
  24. uint8_t mRBytes;
  25. #endif
  26. };
  27. #define NS_UUID_GENERATOR_CONTRACTID "@mozilla.org/uuid-generator;1"
  28. #define NS_UUID_GENERATOR_CID \
  29. { 0x706d36bb, 0xbf79, 0x4293, \
  30. { 0x81, 0xf2, 0x8f, 0x68, 0x28, 0xc1, 0x8f, 0x9d } }
  31. #endif /* _NSUUIDGENERATOR_H_ */