WorkerInlines.h 613 B

12345678910111213141516171819202122232425
  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. BEGIN_WORKERS_NAMESPACE
  6. inline
  7. void
  8. SetJSPrivateSafeish(JSObject* aObj, PrivatizableBase* aBase)
  9. {
  10. JS_SetPrivate(aObj, aBase);
  11. }
  12. template <class Derived>
  13. inline
  14. Derived*
  15. GetJSPrivateSafeish(JSObject* aObj)
  16. {
  17. return static_cast<Derived*>(
  18. static_cast<PrivatizableBase*>(JS_GetPrivate(aObj)));
  19. }
  20. END_WORKERS_NAMESPACE