LCOV - code coverage report
Current view: top level - dom/bindings - RootedDictionary.h (source / functions) Hit Total Coverage
Test: output.info Lines: 4 7 57.1 %
Date: 2017-07-14 16:53:18 Functions: 6 262 2.3 %
Legend: Lines: hit not hit

          Line data    Source code
       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_RootedDictionary_h__
       8             : #define mozilla_dom_RootedDictionary_h__
       9             : 
      10             : #include "mozilla/GuardObjects.h"
      11             : #include "mozilla/dom/Nullable.h"
      12             : #include "jsapi.h"
      13             : 
      14             : namespace mozilla {
      15             : namespace dom {
      16             : 
      17             : template<typename T>
      18          11 : class MOZ_RAII RootedDictionary final : public T,
      19             :                                          private JS::CustomAutoRooter
      20             : {
      21             : public:
      22             :   template <typename CX>
      23          11 :   explicit RootedDictionary(const CX& cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
      24             :     T(),
      25          11 :     JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)
      26             :   {
      27          11 :   }
      28             : 
      29           0 :   virtual void trace(JSTracer *trc) override
      30             :   {
      31           0 :     this->TraceDictionary(trc);
      32           0 :   }
      33             : };
      34             : 
      35             : template<typename T>
      36             : class MOZ_RAII NullableRootedDictionary final : public Nullable<T>,
      37             :                                                  private JS::CustomAutoRooter
      38             : {
      39             : public:
      40             :   template <typename CX>
      41             :   explicit NullableRootedDictionary(const CX& cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
      42             :     Nullable<T>(),
      43             :     JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)
      44             :   {
      45             :   }
      46             : 
      47             :   virtual void trace(JSTracer *trc) override
      48             :   {
      49             :     if (!this->IsNull()) {
      50             :       this->Value().TraceDictionary(trc);
      51             :     }
      52             :   }
      53             : };
      54             : 
      55             : } // namespace dom
      56             : } // namespace mozilla
      57             : 
      58             : #endif /* mozilla_dom_RootedDictionary_h__ */

Generated by: LCOV version 1.13