XrayExpandoClass.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. /**
  6. * This file declares a macro for defining Xray expando classes and declares the
  7. * default Xray expando class. The actual definition of that default class
  8. * lives elsewhere.
  9. */
  10. #ifndef mozilla_dom_XrayExpandoClass_h
  11. #define mozilla_dom_XrayExpandoClass_h
  12. /*
  13. * maybeStatic_ Should be either `static` or nothing (because some Xray expando
  14. * classes are not static).
  15. *
  16. * name_ should be the name of the variable.
  17. *
  18. * extraSlots_ should be how many extra slots to give the class, in addition to
  19. * the ones Xray expandos want.
  20. */
  21. #define DEFINE_XRAY_EXPANDO_CLASS(maybeStatic_, name_, extraSlots_) \
  22. maybeStatic_ const JSClass name_ = { \
  23. "XrayExpandoObject", \
  24. JSCLASS_HAS_RESERVED_SLOTS(xpc::JSSLOT_EXPANDO_COUNT + \
  25. (extraSlots_)) | \
  26. JSCLASS_FOREGROUND_FINALIZE, \
  27. &xpc::XrayExpandoObjectClassOps \
  28. }
  29. namespace mozilla {
  30. namespace dom {
  31. extern const JSClass DefaultXrayExpandoObjectClass;
  32. } // namespace mozilla
  33. } // namespace dom
  34. #endif /* mozilla_dom_XrayExpandoClass_h */