LCOV - code coverage report
Current view: top level - widget - nsAutoRollup.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 1 22 4.5 %
Date: 2017-07-14 16:53:18 Functions: 0 5 0.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             : /* This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : #include "mozilla/widget/nsAutoRollup.h"
       7             : 
       8             : namespace mozilla {
       9             : namespace widget {
      10             : 
      11             : /*static*/ uint32_t nsAutoRollup::sCount = 0;
      12           3 : /*static*/ StaticRefPtr<nsIContent> nsAutoRollup::sLastRollup;
      13             : 
      14           0 : nsAutoRollup::nsAutoRollup()
      15             : {
      16             :   // remember if sLastRollup was null, and only clear it upon destruction
      17             :   // if so. This prevents recursive usage of nsAutoRollup from clearing
      18             :   // sLastRollup when it shouldn't.
      19           0 :   mWasClear = !sLastRollup;
      20           0 :   sCount++;
      21           0 : }
      22             : 
      23           0 : nsAutoRollup::nsAutoRollup(nsIContent* aRollup)
      24             : {
      25           0 :   MOZ_ASSERT(!sLastRollup);
      26           0 :   mWasClear = true;
      27           0 :   sCount++;
      28           0 :   SetLastRollup(aRollup);
      29           0 : }
      30             : 
      31           0 : nsAutoRollup::~nsAutoRollup()
      32             : {
      33           0 :   if (sLastRollup && mWasClear) {
      34           0 :     sLastRollup = nullptr;
      35             :   }
      36           0 :   sCount--;
      37           0 : }
      38             : 
      39             : /*static*/ void
      40           0 : nsAutoRollup::SetLastRollup(nsIContent* aLastRollup)
      41             : {
      42             :   // There must be at least one nsAutoRollup on the stack.
      43           0 :   MOZ_ASSERT(sCount);
      44             : 
      45           0 :   sLastRollup = aLastRollup;
      46           0 : }
      47             : 
      48             : /*static*/ nsIContent*
      49           0 : nsAutoRollup::GetLastRollup()
      50             : {
      51           0 :   return sLastRollup.get();
      52             : }
      53             : 
      54             : } // namespace widget
      55             : } // namespace mozilla

Generated by: LCOV version 1.13