tor-browser

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

RootedRecord.h (921B)


      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 #ifndef mozilla_dom_RootedRecord_h__
      8 #define mozilla_dom_RootedRecord_h__
      9 
     10 #include "js/RootingAPI.h"
     11 #include "mozilla/dom/Record.h"
     12 
     13 namespace mozilla::dom {
     14 
     15 template <typename K, typename V>
     16 class MOZ_RAII RootedRecord final : public Record<K, V>,
     17                                    private JS::CustomAutoRooter {
     18 public:
     19  template <typename CX>
     20  explicit RootedRecord(const CX& cx)
     21      : Record<K, V>(), JS::CustomAutoRooter(cx) {}
     22 
     23  virtual void trace(JSTracer* trc) override { TraceRecord(trc, *this); }
     24 };
     25 
     26 }  // namespace mozilla::dom
     27 
     28 #endif /* mozilla_dom_RootedRecord_h__ */