tor-browser

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

nsAutoLayoutPhase.h (1391B)


      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
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef nsAutoLayoutPhase_h
      8 #define nsAutoLayoutPhase_h
      9 
     10 #ifdef DEBUG
     11 
     12 #  include <stdint.h>
     13 
     14 enum class nsLayoutPhase : uint8_t;
     15 class nsPresContext;
     16 
     17 struct nsAutoLayoutPhase {
     18  nsAutoLayoutPhase(nsPresContext* aPresContext, nsLayoutPhase aPhase);
     19  ~nsAutoLayoutPhase();
     20 
     21  void Enter();
     22  void Exit();
     23 
     24 private:
     25  nsPresContext* mPresContext;
     26  nsLayoutPhase mPhase;
     27  uint32_t mCount;
     28 };
     29 
     30 #  define AUTO_LAYOUT_PHASE_ENTRY_POINT(pc_, phase_) \
     31    nsAutoLayoutPhase autoLayoutPhase((pc_), (nsLayoutPhase::phase_))
     32 #  define LAYOUT_PHASE_TEMP_EXIT() \
     33    PR_BEGIN_MACRO                 \
     34    autoLayoutPhase.Exit();        \
     35    PR_END_MACRO
     36 #  define LAYOUT_PHASE_TEMP_REENTER() \
     37    PR_BEGIN_MACRO                    \
     38    autoLayoutPhase.Enter();          \
     39    PR_END_MACRO
     40 
     41 #else  // DEBUG
     42 
     43 #  define AUTO_LAYOUT_PHASE_ENTRY_POINT(pc_, phase_) PR_BEGIN_MACRO PR_END_MACRO
     44 #  define LAYOUT_PHASE_TEMP_EXIT() PR_BEGIN_MACRO PR_END_MACRO
     45 #  define LAYOUT_PHASE_TEMP_REENTER() PR_BEGIN_MACRO PR_END_MACRO
     46 
     47 #endif  // DEBUG
     48 
     49 #endif  // nsAutoLayoutPhase_h