dom/workers/WorkerInlines.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/workers/WorkerInlines.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,24 @@
     1.4 +/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +BEGIN_WORKERS_NAMESPACE
    1.10 +
    1.11 +inline
    1.12 +void
    1.13 +SetJSPrivateSafeish(JSObject* aObj, PrivatizableBase* aBase)
    1.14 +{
    1.15 +  JS_SetPrivate(aObj, aBase);
    1.16 +}
    1.17 +
    1.18 +template <class Derived>
    1.19 +inline
    1.20 +Derived*
    1.21 +GetJSPrivateSafeish(JSObject* aObj)
    1.22 +{
    1.23 +  return static_cast<Derived*>(
    1.24 +    static_cast<PrivatizableBase*>(JS_GetPrivate(aObj)));
    1.25 +}
    1.26 +
    1.27 +END_WORKERS_NAMESPACE

mercurial