LCOV - code coverage report
Current view: top level - layout/base - ArenaRefPtrInlines.h (source / functions) Hit Total Coverage
Test: output.info Lines: 8 8 100.0 %
Date: 2017-07-14 16:53:18 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
       2             :  * vim: set ts=2 sw=2 et tw=78:
       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
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       6             :  */
       7             : 
       8             : /* inline methods that belong in ArenaRefPtr.h, except that they require
       9             :    the inclusion of headers for all types that ArenaRefPtr can handle */
      10             : 
      11             : #ifndef mozilla_ArenaRefPtrInlines_h
      12             : #define mozilla_ArenaRefPtrInlines_h
      13             : 
      14             : #include "mozilla/ArenaObjectID.h"
      15             : #include "mozilla/Assertions.h"
      16             : #include "nsStyleStruct.h"
      17             : 
      18             : namespace mozilla {
      19             : 
      20             : template<typename T>
      21             : void
      22           4 : ArenaRefPtr<T>::AssertValidType()
      23             : {
      24             : #ifdef DEBUG
      25             :   bool ok =
      26             : #define PRES_ARENA_OBJECT_WITH_ARENAREFPTR_SUPPORT(name_) \
      27             :     T::ArenaObjectID() == eArenaObjectID_##name_ ||
      28             : #include "nsPresArenaObjectList.h"
      29             : #undef PRES_ARENA_OBJECT_WITH_ARENAREFPTR_SUPPORT
      30           4 :     false;
      31           4 :   MOZ_ASSERT(ok, "ArenaRefPtr<T> template parameter T must be declared in "
      32             :                  "nsPresArenaObjectList with "
      33             :                  "PRES_ARENA_OBJECT_WITH_ARENAREFPTR_SUPPORT");
      34             : #endif
      35           4 : }
      36             : 
      37             : } // namespace mozilla
      38             : 
      39             : template<typename T>
      40             : void
      41           4 : nsPresArena::RegisterArenaRefPtr(mozilla::ArenaRefPtr<T>* aPtr)
      42             : {
      43           4 :   MOZ_ASSERT(!mArenaRefPtrs.Contains(aPtr));
      44           4 :   mArenaRefPtrs.Put(aPtr, T::ArenaObjectID());
      45           4 : }
      46             : 
      47             : #endif

Generated by: LCOV version 1.13