tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

XrayExpandoClass.h (1813B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 /**
      8 * This file declares a macro for defining Xray expando classes and declares the
      9 * default Xray expando class.  The actual definition of that default class
     10 * lives elsewhere.
     11 */
     12 #ifndef mozilla_dom_XrayExpandoClass_h
     13 #define mozilla_dom_XrayExpandoClass_h
     14 
     15 #include "js/Class.h"
     16 
     17 /*
     18 * maybeStatic_ Should be either `static` or nothing (because some Xray expando
     19 * classes are not static).
     20 *
     21 * name_ should be the name of the variable.
     22 *
     23 * extraSlots_ should be how many extra slots to give the class, in addition to
     24 * the ones Xray expandos want.
     25 *
     26 * ops_ should be the JSClassOps to use for the class.
     27 */
     28 #define DEFINE_XRAY_EXPANDO_CLASS_WITH_OPS(maybeStatic_, name_, extraSlots_,  \
     29                                           ops_)                              \
     30  maybeStatic_ const JSClass name_ = {                                        \
     31      "XrayExpandoObject",                                                    \
     32      JSCLASS_HAS_RESERVED_SLOTS(xpc::JSSLOT_EXPANDO_COUNT + (extraSlots_)) | \
     33          JSCLASS_FOREGROUND_FINALIZE,                                        \
     34      ops_}
     35 
     36 #define DEFINE_XRAY_EXPANDO_CLASS(maybeStatic_, name_, extraSlots_)    \
     37  DEFINE_XRAY_EXPANDO_CLASS_WITH_OPS(maybeStatic_, name_, extraSlots_, \
     38                                     &xpc::XrayExpandoObjectClassOps)
     39 
     40 namespace mozilla::dom {
     41 
     42 extern const JSClass DefaultXrayExpandoObjectClass;
     43 
     44 }  // namespace mozilla::dom
     45 
     46 #endif /* mozilla_dom_XrayExpandoClass_h */